소스 검색

给指读模式下的mouseover事件添加debounce,降低计算量的同时,还能够通过快速移动鼠标到放大镜区域来在放大镜区域操作滚动条,而不会在移动时更换放大镜区域的显示内容。而播放音频函数应该是不需要debounce了。

任一存 3 년 전
부모
커밋
9d3b755146
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      web/src/views/accessibility.vue

+ 4 - 4
web/src/views/accessibility.vue

@@ -665,7 +665,7 @@ export default {
     })
   },
   methods: {
-    planToPlayAudio: utils.debounce(function(taskId, text = '') {
+    planToPlayAudio(taskId, text = '') {
       let XHR = new XMLHttpRequest()
       const that = this
       XHR.onreadystatechange = function() {
@@ -697,7 +697,7 @@ export default {
       XHR.send(JSON.stringify({
         content: text || this.elemType + (this.elemType ? ': ' : '') + this.elemDisc
       }))
-    }, 500),
+    },
     keyEventHandler(e) {
       if (e.repeat) {
         return
@@ -816,7 +816,7 @@ export default {
       this.crosshairPosition.x = e.clientX
       this.crosshairPosition.y = e.clientY
     },
-    onMouseOverForPointRead(e) {
+    onMouseOverForPointRead: utils.debounce(function(e) {
       if (!this.ariaSettings.isCompActive) {
         return
       }
@@ -827,7 +827,7 @@ export default {
 
         this.planToPlayAudio()
       }
-    },
+    }, 500),
     onMouseOverForContinueRead(e) {
       if (!this.ariaSettings.isCompActive) {
         return