Text scanner cause update (#813)

* Rename _searchAtFromMouse to _searchAtFromMouseMove

* Rename cause 'mouse' to 'mouseMove' for clarity
This commit is contained in:
toasted-nutbread 2020-09-11 22:46:41 -04:00 committed by GitHub
parent e56674e4ee
commit 568775c6dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -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) {