From 8e330d54d6bca67b06a6afda3119b0e4bded41e6 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 23 May 2021 14:30:31 -0400 Subject: Fix popup preview disappearing after changing a setting (#1707) --- ext/js/app/frontend.js | 1 + ext/js/language/text-scanner.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index e40b400d..1c6def06 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -565,6 +565,7 @@ class Frontend { _updateTextScannerEnabled() { const enabled = (this._options !== null && this._options.general.enable && !this._disabledOverride); + if (enabled === this._textScanner.isEnabled()) { return; } this._textScanner.setEnabled(enabled); this._clearSelection(true); } diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index 80887b8e..c7cedd7e 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -119,6 +119,10 @@ class TextScanner extends EventDispatcher { this.setEnabled(this._enabled); } + isEnabled() { + return this._enabled; + } + setEnabled(enabled) { this._enabled = enabled; -- cgit v1.2.3