fix url update and isClicking stuck on mouseout
This commit is contained in:
parent
2b27a98132
commit
17553f999b
|
@ -68,6 +68,7 @@ class PixelPlainterControls {
|
||||||
viewport.addEventListener('touchend', this.onTouchEnd, false);
|
viewport.addEventListener('touchend', this.onTouchEnd, false);
|
||||||
viewport.addEventListener('touchmove', this.onTouchMove, false);
|
viewport.addEventListener('touchmove', this.onTouchMove, false);
|
||||||
viewport.addEventListener('mouseout', this.onMouseOut, false);
|
viewport.addEventListener('mouseout', this.onMouseOut, false);
|
||||||
|
viewport.addEventListener('touchcancel', this.onMouseOut, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
|
@ -96,6 +97,7 @@ class PixelPlainterControls {
|
||||||
onMouseUp(event: MouseEvent) {
|
onMouseUp(event: MouseEvent) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
const { store } = this;
|
||||||
if (event.button === 0) {
|
if (event.button === 0) {
|
||||||
this.isClicking = false;
|
this.isClicking = false;
|
||||||
const { clientX, clientY } = event;
|
const { clientX, clientY } = event;
|
||||||
|
@ -108,7 +110,7 @@ class PixelPlainterControls {
|
||||||
if (clickTapStartTime > Date.now() - 250
|
if (clickTapStartTime > Date.now() - 250
|
||||||
&& coordsDiff[0] < 2 && coordsDiff[1] < 2) {
|
&& coordsDiff[0] < 2 && coordsDiff[1] < 2) {
|
||||||
PixelPlainterControls.placePixel(
|
PixelPlainterControls.placePixel(
|
||||||
this.store,
|
store,
|
||||||
this.viewport,
|
this.viewport,
|
||||||
this.renderer,
|
this.renderer,
|
||||||
[clientX, clientY],
|
[clientX, clientY],
|
||||||
|
@ -116,6 +118,7 @@ class PixelPlainterControls {
|
||||||
}
|
}
|
||||||
this.viewport.style.cursor = 'auto';
|
this.viewport.style.cursor = 'auto';
|
||||||
}
|
}
|
||||||
|
store.dispatch(onViewFinishChange());
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTouchCenter(event: TouchEvent) {
|
static getTouchCenter(event: TouchEvent) {
|
||||||
|
@ -213,7 +216,7 @@ class PixelPlainterControls {
|
||||||
this.clickTapStartCoords[1],
|
this.clickTapStartCoords[1],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}, 500);
|
}, 800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +224,7 @@ class PixelPlainterControls {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
const { store } = this;
|
||||||
if (event.touches.length === 0 && this.isClicking) {
|
if (event.touches.length === 0 && this.isClicking) {
|
||||||
const { pageX, pageY } = event.changedTouches[0];
|
const { pageX, pageY } = event.changedTouches[0];
|
||||||
const { clickTapStartCoords, clickTapStartTime } = this;
|
const { clickTapStartCoords, clickTapStartTime } = this;
|
||||||
|
@ -231,7 +235,7 @@ class PixelPlainterControls {
|
||||||
// thresholds for single click / holding
|
// thresholds for single click / holding
|
||||||
if (clickTapStartTime > Date.now() - 250
|
if (clickTapStartTime > Date.now() - 250
|
||||||
&& coordsDiff[0] < 2 && coordsDiff[1] < 2) {
|
&& coordsDiff[0] < 2 && coordsDiff[1] < 2) {
|
||||||
const { store, viewport } = this;
|
const { viewport } = this;
|
||||||
PixelPlainterControls.placePixel(
|
PixelPlainterControls.placePixel(
|
||||||
store,
|
store,
|
||||||
viewport,
|
viewport,
|
||||||
|
@ -243,6 +247,7 @@ class PixelPlainterControls {
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
store.dispatch(onViewFinishChange());
|
||||||
this.clearTabTimeout();
|
this.clearTabTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +363,8 @@ class PixelPlainterControls {
|
||||||
const { store, viewport } = this;
|
const { store, viewport } = this;
|
||||||
viewport.style.cursor = 'auto';
|
viewport.style.cursor = 'auto';
|
||||||
store.dispatch(unsetHover());
|
store.dispatch(unsetHover());
|
||||||
|
store.dispatch(onViewFinishChange());
|
||||||
|
this.clearTabTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
static selectColor(store, viewport, renderer, center) {
|
static selectColor(store, viewport, renderer, center) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user