diff options
Diffstat (limited to 'ext/js/app')
| -rw-r--r-- | ext/js/app/frontend.js | 19 | 
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index 7913d7d8..e40b400d 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -121,7 +121,7 @@ class Frontend {          yomichan.on('closePopups', this._onClosePopups.bind(this));          chrome.runtime.onMessage.addListener(this._onRuntimeMessage.bind(this)); -        this._textScanner.on('clearSelection', this._onClearSelection.bind(this)); +        this._textScanner.on('clear', this._onTextScannerClear.bind(this));          this._textScanner.on('searched', this._onSearched.bind(this));          yomichan.crossFrame.registerHandlers([ @@ -253,13 +253,8 @@ class Frontend {          this._updateContentScale();      } -    _onClearSelection({passive}) { -        this._stopClearSelectionDelayed(); -        if (this._popup !== null) { -            this._popup.hide(!passive); -            this._popup.clearAutoPlayTimer(); -            this._isPointerOverPopup = false; -        } +    _onTextScannerClear() { +        this._clearSelection(false);      }      _onSearched({type, dictionaryEntries, sentence, inputInfo: {eventType, passive, detail}, textSource, optionsContext, detail: {documentTitle}, error}) { @@ -299,7 +294,12 @@ class Frontend {      _clearSelection(passive) {          this._stopClearSelectionDelayed(); -        this._textScanner.clearSelection(passive); +        if (this._popup !== null) { +            this._popup.clearAutoPlayTimer(); +            this._popup.hide(!passive); +            this._isPointerOverPopup = false; +        } +        this._textScanner.clearSelection();      }      _clearSelectionDelayed(delay, restart, passive) { @@ -566,6 +566,7 @@ class Frontend {      _updateTextScannerEnabled() {          const enabled = (this._options !== null && this._options.general.enable && !this._disabledOverride);          this._textScanner.setEnabled(enabled); +        this._clearSelection(true);      }      _updateContentScale() {  |