debug tiny issues

This commit is contained in:
HF 2022-02-10 03:29:17 +01:00
parent c4c5bc7063
commit 34c53d0c89
2 changed files with 17 additions and 4 deletions

View File

@ -48,6 +48,8 @@ class PixelPlainterControls {
this.onTouchEnd = this.onTouchEnd.bind(this);
this.onTouchMove = this.onTouchMove.bind(this);
this.onViewFinishChangeTimeOut = null;
this.clickTapStartView = [0, 0];
this.clickTapStartTime = 0;
this.clickTapStartCoords = [0, 0];
@ -77,7 +79,9 @@ class PixelPlainterControls {
viewport.addEventListener('mousedown', this.onMouseDown, false);
viewport.addEventListener('mousemove', this.onMouseMove, false);
viewport.addEventListener('mouseup', this.onMouseUp, false);
viewport.addEventListener('wheel', this.onWheel, { passive: true });
// TODO check if we can go passive here
//viewport.addEventListener('wheel', this.onWheel, { passive: true });
viewport.addEventListener('wheel', this.onWheel, false);
viewport.addEventListener('touchstart', this.onTouchStart, false);
viewport.addEventListener('touchend', this.onTouchEnd, false);
viewport.addEventListener('touchmove', this.onTouchMove, false);
@ -116,6 +120,15 @@ class PixelPlainterControls {
}
}
scheduleOnViewFinishChange() {
if (this.onViewFinishChangeTimeOut) {
clearTimeout(this.onViewFinishChangeTimeOut);
}
this.onViewFinishChangeTimeOut = setTimeout(() => {
this.store.dispatch(onViewFinishChange());
}, 250);
}
onMouseUp(event: MouseEvent) {
event.preventDefault();
@ -347,7 +360,7 @@ class PixelPlainterControls {
}
onWheel(event: MouseEvent) {
//event.preventDefault();
event.preventDefault();
document.activeElement.blur();
const { deltaY } = event;
@ -364,7 +377,7 @@ class PixelPlainterControls {
if (deltaY > 0) {
store.dispatch(zoomOut(zoompoint));
}
store.dispatch(onViewFinishChange());
this.scheduleOnViewFinishChange();
}
onMouseMove(event: MouseEvent) {

View File

@ -52,7 +52,7 @@ router.use('/adminapi', adminapi);
// (this should be served with nginx or other webserver)
// -----------------------------------------------------------------------------
router.use(express.static(path.join(__dirname, 'public'), {
maxAge: 3 * MONTH,
maxAge: 12 * MONTH,
extensions: ['html'],
}));