Commit fb94e5bf by Tianqing Liu

feat: 增加节流控制

1 parent 3ecf4e47
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
<div ref="container" <div ref="container"
:data-player-type="this.playerType" :data-player-type="this.playerType"
:class="containerClassName" :class="containerClassName"
@wheel="handleWheel"
> >
</div> </div>
</template> </template>
<script> <script>
import { merge } from 'lodash'; import { merge, throttle } from 'lodash';
// checkSupportMSEHevc checkSupportSIMD, checkSupportWCSHevc // checkSupportMSEHevc checkSupportSIMD, checkSupportWCSHevc
import { getWatermarkCanvasImg } from './utils'; import { getWatermarkCanvasImg } from './utils';
import { getPlayerConfig, getRotateConfig, getMirrorRotate, getPlaybackConfig } from './config'; import { getPlayerConfig, getRotateConfig, getMirrorRotate, getPlaybackConfig } from './config';
...@@ -143,6 +142,7 @@ export default { ...@@ -143,6 +142,7 @@ export default {
}); });
// 电子放大 // 电子放大
this.$refs.container.addEventListener('wheel', throttle(this.handleWheel, 200));
}, },
setForward(rate) { setForward(rate) {
this._jessibuca.forward(rate); this._jessibuca.forward(rate);
...@@ -180,7 +180,6 @@ export default { ...@@ -180,7 +180,6 @@ export default {
}, },
handleWheel(event) { handleWheel(event) {
console.log('handleWheel', event); console.log('handleWheel', event);
// TODO: 增加防抖动
event.stopPropagation(); event.stopPropagation();
const direction = event.deltaY < 0; const direction = event.deltaY < 0;
this.zoom(direction); this.zoom(direction);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!