Group similar functions together

This commit is contained in:
toasted-nutbread 2019-10-25 20:11:44 -04:00
parent 6d85dae68d
commit bcffe80a1e

View File

@ -129,25 +129,6 @@ class Frontend {
this.popupTimerClear(); this.popupTimerClear();
} }
onWindowMessage(e) {
const action = e.data;
const handlers = Frontend.windowMessageHandlers;
if (handlers.hasOwnProperty(action)) {
const handler = handlers[action];
handler(this);
}
}
async onResize() {
if (this.textSourceCurrent !== null && await this.popup.isVisibleAsync()) {
const textSource = this.textSourceCurrent;
this.lastShowPromise = this.popup.showContent(
textSource.getRect(),
textSource.getWritingMode()
);
}
}
onClick(e) { onClick(e) {
if (this.preventNextClick) { if (this.preventNextClick) {
this.preventNextClick = false; this.preventNextClick = false;
@ -157,6 +138,19 @@ class Frontend {
} }
} }
onAuxClick(e) {
this.preventNextContextMenu = false;
}
onContextMenu(e) {
if (this.preventNextContextMenu) {
this.preventNextContextMenu = false;
e.preventDefault();
e.stopPropagation();
return false;
}
}
onTouchStart(e) { onTouchStart(e) {
if (this.primaryTouchIdentifier !== null || e.changedTouches.length === 0) { if (this.primaryTouchIdentifier !== null || e.changedTouches.length === 0) {
return; return;
@ -233,16 +227,22 @@ class Frontend {
e.preventDefault(); // Disable scroll e.preventDefault(); // Disable scroll
} }
onAuxClick(e) { async onResize() {
this.preventNextContextMenu = false; if (this.textSourceCurrent !== null && await this.popup.isVisibleAsync()) {
const textSource = this.textSourceCurrent;
this.lastShowPromise = this.popup.showContent(
textSource.getRect(),
textSource.getWritingMode()
);
}
} }
onContextMenu(e) { onWindowMessage(e) {
if (this.preventNextContextMenu) { const action = e.data;
this.preventNextContextMenu = false; const handlers = Frontend.windowMessageHandlers;
e.preventDefault(); if (handlers.hasOwnProperty(action)) {
e.stopPropagation(); const handler = handlers[action];
return false; handler(this);
} }
} }