LinguaCafe
LinguaCafe copied to clipboard
fix: only clear timeout if the ongoingSelection is not empty
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