fix: contextMenu timer & pointers not correctly reset on iOS (#4765)
This commit is contained in:
parent
0cdd0eebf1
commit
9653d676fe
@ -1315,11 +1315,14 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onTapEnd = (event: TouchEvent) => {
|
private onTapEnd = (event: TouchEvent) => {
|
||||||
|
this.resetContextMenuTimer();
|
||||||
if (event.touches.length > 0) {
|
if (event.touches.length > 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
previousSelectedElementIds: {},
|
previousSelectedElementIds: {},
|
||||||
selectedElementIds: this.state.previousSelectedElementIds,
|
selectedElementIds: this.state.previousSelectedElementIds,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
gesture.pointers.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1532,11 +1535,8 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
removePointer = (event: React.PointerEvent<HTMLElement> | PointerEvent) => {
|
removePointer = (event: React.PointerEvent<HTMLElement> | PointerEvent) => {
|
||||||
// remove touch handler for context menu on touch devices
|
if (touchTimeout) {
|
||||||
if (event.pointerType === "touch" && touchTimeout) {
|
this.resetContextMenuTimer();
|
||||||
clearTimeout(touchTimeout);
|
|
||||||
touchTimeout = 0;
|
|
||||||
invalidateContextMenu = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gesture.pointers.delete(event.pointerId);
|
gesture.pointers.delete(event.pointerId);
|
||||||
@ -2937,6 +2937,12 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private resetContextMenuTimer = () => {
|
||||||
|
clearTimeout(touchTimeout);
|
||||||
|
touchTimeout = 0;
|
||||||
|
invalidateContextMenu = false;
|
||||||
|
};
|
||||||
|
|
||||||
private maybeCleanupAfterMissingPointerUp(
|
private maybeCleanupAfterMissingPointerUp(
|
||||||
event: React.PointerEvent<HTMLCanvasElement>,
|
event: React.PointerEvent<HTMLCanvasElement>,
|
||||||
): void {
|
): void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user