make the app listen to hashchange and move the viewport accordingly, or reload the page when the wall changes
This commit is contained in:
parent
b1ee244eaa
commit
7465913944
2 changed files with 22 additions and 5 deletions
|
@ -115,6 +115,10 @@ class CanvasRenderer extends HTMLElement {
|
|||
}
|
||||
}
|
||||
|
||||
sendViewportUpdate() {
|
||||
this.dispatchEvent(new Event(".viewportUpdate"));
|
||||
}
|
||||
|
||||
async #panningBehaviour() {
|
||||
while (true) {
|
||||
let mouseDown = await listen([this, "mousedown"]);
|
||||
|
@ -124,7 +128,7 @@ class CanvasRenderer extends HTMLElement {
|
|||
let event = await listen([window, "mousemove"], [window, "mouseup"]);
|
||||
if (event.type == "mousemove") {
|
||||
this.viewport.panAround(event.movementX, event.movementY);
|
||||
this.dispatchEvent(new Event(".viewportUpdate"));
|
||||
this.sendViewportUpdate();
|
||||
} else if (event.type == "mouseup" && event.button == mouseDown.button) {
|
||||
this.dispatchEvent(new Event(".viewportUpdateEnd"));
|
||||
break;
|
||||
|
@ -140,7 +144,7 @@ class CanvasRenderer extends HTMLElement {
|
|||
|
||||
// TODO: Touchpad zoom
|
||||
this.viewport.zoomIn(event.deltaY > 0 ? -1 : 1);
|
||||
this.dispatchEvent(new Event(".viewportUpdate"));
|
||||
this.sendViewportUpdate();
|
||||
this.dispatchEvent(new Event(".viewportUpdateEnd"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue