summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-24 20:45:30 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-28 17:03:42 -0400
commite91bcf5f553eb4199fff067044413064c46d1844 (patch)
tree2fa6afa8a449ac1cadea3d94725625586b2042ed
parentbe27781c150bc081cc65c06b0a08d7b49044cbf3 (diff)
Rename textSourceLast to textSourceCurrent
-rw-r--r--ext/fg/js/frontend.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 52fdaacf..5ab69b9a 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -21,7 +21,7 @@ class Frontend {
constructor(popup, ignoreNodes) {
this.popup = popup;
this.popupTimerPromise = null;
- this.textSourceLast = null;
+ this.textSourceCurrent = null;
this.pendingLookup = false;
this.options = null;
this.ignoreNodes = (Array.isArray(ignoreNodes) && ignoreNodes.length > 0 ? ignoreNodes.join(',') : null);
@@ -139,8 +139,8 @@ class Frontend {
}
async onResize() {
- if (this.textSourceLast !== null && await this.popup.isVisibleAsync()) {
- const textSource = this.textSourceLast;
+ if (this.textSourceCurrent !== null && await this.popup.isVisibleAsync()) {
+ const textSource = this.textSourceCurrent;
this.lastShowPromise = this.popup.showContent(
textSource.getRect(),
textSource.getWritingMode()
@@ -321,7 +321,7 @@ class Frontend {
const textSource = docRangeFromPoint(x, y, this.options);
if (
textSource === null ||
- (this.textSourceLast !== null && this.textSourceLast.equals(textSource))
+ (this.textSourceCurrent !== null && this.textSourceCurrent.equals(textSource))
) {
return;
}
@@ -367,8 +367,10 @@ class Frontend {
}
this.pendingLookup = false;
- this.onAfterSearch(this.textSourceLast, cause);
+ this.onAfterSearch(this.textSourceCurrent, cause);
}
+
+ return results !== null;
}
showContent(textSource, focus, definitions, type) {
@@ -381,7 +383,7 @@ class Frontend {
{definitions, context: {sentence, url, focus}}
);
- this.textSourceLast = textSource;
+ this.textSourceCurrent = textSource;
if (this.options.scanning.selectText) {
textSource.select();
}
@@ -417,11 +419,13 @@ class Frontend {
this.popup.hide(changeFocus);
this.popup.clearAutoPlayTimer();
- if (this.options.scanning.selectText && this.textSourceLast) {
- this.textSourceLast.deselect();
- }
+ if (this.textSourceCurrent !== null) {
+ if (this.options.scanning.selectText) {
+ this.textSourceCurrent.deselect();
+ }
- this.textSourceLast = null;
+ this.textSourceCurrent = null;
+ }
}
getPrimaryTouch(touchList) {
@@ -460,7 +464,7 @@ class Frontend {
}
else {
this.primaryTouchIdentifier = touch.identifier;
- this.contextMenuPreviousRange = this.textSourceLast ? this.textSourceLast.clone() : null;
+ this.contextMenuPreviousRange = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null;
this.contextMenuChecking = true;
this.scrollPrevent = false;
this.setContextMenuPrevent(false, false);