Parcourir la source

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

任一存 il y a 3 ans
Parent
commit
9d3b755146
1 fichiers modifiés avec 4 ajouts et 4 suppressions
  1. 4 4
      web/src/views/accessibility.vue

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

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