aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-11 22:46:41 -0400
committerGitHub <noreply@github.com>2020-09-11 22:46:41 -0400
commit568775c6dc9ff4acc2386b8983cda037b87655e0 (patch)
tree9b85585940feb9de306c61dab00401ab3a205673
parente56674e4ee39c706078558259305cb12babec343 (diff)
Text scanner cause update (#813)
* Rename _searchAtFromMouse to _searchAtFromMouseMove * Rename cause 'mouse' to 'mouseMove' for clarity
-rw-r--r--ext/fg/js/frontend.js2
-rw-r--r--ext/mixed/js/display.js3
-rw-r--r--ext/mixed/js/text-scanner.js6
3 files changed, 6 insertions, 5 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 8189b8ad..6b0b50a6 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -267,7 +267,7 @@ class Frontend {
}
} if (type !== null) {
this._stopClearSelectionDelayed();
- const focus = (cause === 'mouse');
+ const focus = (cause === 'mouseMove');
this._showContent(textSource, focus, definitions, type, sentence, optionsContext);
} else {
if (scanningOptions.autoHideResults) {
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 4c42a48d..92e27faa 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -510,9 +510,10 @@ class Display extends EventDispatcher {
_onQueryParserSearch({type, definitions, sentence, input: {cause}, textSource}) {
const query = textSource.text();
+ const history = (cause === 'click');
const details = {
focus: false,
- history: cause !== 'mouse',
+ history,
params: this._createSearchParams(type, query, false),
state: {
sentence,
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index cff53b47..b2a5508c 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -253,7 +253,7 @@ class TextScanner extends EventDispatcher {
if (inputInfo === null) { return; }
const {index, empty} = inputInfo;
- this._searchAtFromMouse(e.clientX, e.clientY, index, empty);
+ this._searchAtFromMouseMove(e.clientX, e.clientY, index, empty);
}
_onMouseDown(e) {
@@ -501,7 +501,7 @@ class TextScanner extends EventDispatcher {
}
}
- async _searchAtFromMouse(x, y, inputIndex, inputEmpty) {
+ async _searchAtFromMouseMove(x, y, inputIndex, inputEmpty) {
if (this._pendingLookup) { return; }
if (inputEmpty) {
@@ -511,7 +511,7 @@ class TextScanner extends EventDispatcher {
}
}
- await this._searchAt(x, y, {type: 'mouse', cause: 'mouse', index: inputIndex, empty: inputEmpty});
+ await this._searchAt(x, y, {type: 'mouse', cause: 'mouseMove', index: inputIndex, empty: inputEmpty});
}
async _searchAtFromTouchStart(e, x, y) {