From fda354b579d22022948ff0724059752d8c92d2ed Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Mon, 27 Jan 2025 15:34:52 -0500 Subject: [PATCH] Apply preventNextMouseDown for touch end to prevent instantly closing popup (#1777) Apply preventNextMouseDown to searchAtFromTouchEnd --- ext/js/language/text-scanner.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index a7b4eb22b..a0ef97838 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -1349,7 +1349,16 @@ export class TextScanner extends EventDispatcher { * @param {import('text-scanner').InputInfo} inputInfo */ async _searchAtFromTouchEnd(x, y, inputInfo) { + const textSourceCurrentPrevious = this._textSourceCurrent !== null ? this._textSourceCurrent.clone() : null; + await this._searchAt(x, y, inputInfo); + + if ( + this._textSourceCurrent !== null && + !(textSourceCurrentPrevious !== null && this._textSourceCurrent.hasSameStart(textSourceCurrentPrevious)) + ) { + this._preventNextMouseDown = true; + } } /**