Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Text scanner cause update #813

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/fg/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion ext/mixed/js/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions ext/mixed/js/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down