Remove setters

This commit is contained in:
toasted-nutbread 2019-10-24 21:15:02 -04:00
parent c74c466c36
commit 9178636613

View File

@ -112,8 +112,8 @@ class Frontend {
onMouseDown(e) { onMouseDown(e) {
if (this.mouseDownPrevent) { if (this.mouseDownPrevent) {
this.setMouseDownPrevent(false, false); this.mouseDownPrevent = false;
this.setClickPrevent(true); this.clickPrevent = true;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return false; return false;
@ -148,7 +148,7 @@ class Frontend {
onClick(e) { onClick(e) {
if (this.clickPrevent) { if (this.clickPrevent) {
this.setClickPrevent(false); this.clickPrevent = false;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return false; return false;
@ -203,7 +203,7 @@ class Frontend {
onContextMenu(e) { onContextMenu(e) {
if (this.contextMenuPrevent) { if (this.contextMenuPrevent) {
this.setContextMenuPrevent(false, false); this.contextMenuPrevent = false;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return false; return false;
@ -435,16 +435,18 @@ class Frontend {
if (touch === null) { if (touch === null) {
this.primaryTouchIdentifier = null; this.primaryTouchIdentifier = null;
this.scrollPrevent = false; this.scrollPrevent = false;
this.setContextMenuPrevent(false, true); this.clickPrevent = false;
this.setMouseDownPrevent(false, true); // Don't revert context menu and mouse down prevention,
this.setClickPrevent(false); // since these events can occur after the touch has ended.
// this.contextMenuPrevent = false;
// this.mouseDownPrevent = false;
} }
else { else {
this.primaryTouchIdentifier = touch.identifier; this.primaryTouchIdentifier = touch.identifier;
this.scrollPrevent = false; this.scrollPrevent = false;
this.setContextMenuPrevent(false, false); this.contextMenuPrevent = false;
this.setMouseDownPrevent(false, false); this.mouseDownPrevent = false;
this.setClickPrevent(false); this.clickPrevent = false;
const textSourceCurrentPrevious = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null; const textSourceCurrentPrevious = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null;
@ -459,28 +461,12 @@ class Frontend {
} }
this.scrollPrevent = true; this.scrollPrevent = true;
this.setContextMenuPrevent(true, false); this.contextMenuPrevent = true;
this.setMouseDownPrevent(true, false); this.mouseDownPrevent = true;
}); });
} }
} }
setContextMenuPrevent(value, delay) {
if (!delay) {
this.contextMenuPrevent = value;
}
}
setMouseDownPrevent(value, delay) {
if (!delay) {
this.mouseDownPrevent = value;
}
}
setClickPrevent(value) {
this.clickPrevent = value;
}
selectionContainsPoint(selection, x, y) { selectionContainsPoint(selection, x, y) {
for (let i = 0; i < selection.rangeCount; ++i) { for (let i = 0; i < selection.rangeCount; ++i) {
const range = selection.getRangeAt(i); const range = selection.getRangeAt(i);