Commit 129fedbd authored by liujiangnan's avatar liujiangnan

feat

parent 19056cab
......@@ -297,20 +297,21 @@
</el-button>
</el-button-group>
<el-slider
v-model="zoomLevel"
:min="1"
:max="500"
@change="handleZoom"
:disabled="audioLoading"
style="width: 200px;">
</el-slider>
<el-button-group style="margin-left: 10px;">
<el-button size="small" @click="handleZoomOut" :disabled="audioLoading">
<i class="el-icon-zoom-out"></i>
</el-button>
<el-button size="small" @click="handleZoomIn" :disabled="audioLoading">
<i class="el-icon-zoom-in"></i>
</el-button>
</el-button-group>
<el-button
size="small"
:type="isPageLocked ? 'danger' : 'primary'"
@click="togglePageLock"
:class="{ 'is-active': isPageLocked }">
:class="{ 'is-active': isPageLocked }"
style="margin-left: 10px;">
<i :class="isPageLocked ? 'el-icon-lock' : 'el-icon-unlock'"></i>
{{ isPageLocked ? '解锁页面' : '锁定页面' }}
</el-button>
......
......@@ -5,6 +5,9 @@ new Vue({
wavesurfer: null,
isPlaying: false,
zoomLevel: 50,
minZoom: 1,
maxZoom: 500,
zoomStep: 20, // 每次放大/缩小的步长
audioRegions: {},
// 数据相关
......@@ -589,6 +592,27 @@ new Vue({
}
},
// 缩放控制方法
handleZoomIn() {
if (!this.wavesurfer) return;
const newZoom = Math.min(this.maxZoom, this.zoomLevel + this.zoomStep);
if (newZoom !== this.zoomLevel) {
this.zoomLevel = newZoom;
this.handleZoom(this.zoomLevel);
}
},
handleZoomOut() {
if (!this.wavesurfer) return;
const newZoom = Math.max(this.minZoom, this.zoomLevel - this.zoomStep);
if (newZoom !== this.zoomLevel) {
this.zoomLevel = newZoom;
this.handleZoom(this.zoomLevel);
}
},
handleZoom(value) {
if (!this.wavesurfer) return;
......@@ -599,7 +623,7 @@ new Vue({
const progress = currentTime / duration;
// 更新缩放设置
if (value === 1) {
if (value === this.minZoom) {
// 最小缩放级别时,填充父容器
this.wavesurfer.params.fillParent = true;
this.wavesurfer.params.scrollParent = false;
......@@ -613,7 +637,7 @@ new Vue({
this.wavesurfer.zoom(value);
// 重新定位到之前的位置
if (value > 1) {
if (value > this.minZoom) {
// 使用保存的进度或当前进度作为锚点
const targetProgress = this.currentProgress || progress;
this.wavesurfer.seekTo(targetProgress);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment