LinguaCafe icon indicating copy to clipboard operation
LinguaCafe copied to clipboard

fix: only clear timeout if the ongoingSelection is not empty

Open mateuszmrw opened this issue 9 months ago • 0 comments

Closes: #262

Sorry for another one line PR.

It seems that for Apple Pencil touch events the updateSelectionTouchEvent function is called right away after the startSelectionTouchEvent, meaning that the function inside the touchTimer setTimeout never executes due to clearTimeout. This leaves the ongoingSelection array empty meaning that the updateSelection is never called due to this if:

   if (wordIndex !== null && this.ongoingSelection.length) {
      this.updateSelection(wordIndex);
   }

This PR fixes it by only calling the clearTimeout if the this.touchTimer exists and the ongoingSelection is not empty

mateuszmrw avatar May 19 '24 21:05 mateuszmrw