feat: close mobile canvas menu on canvas pointerdown

This commit is contained in:
dwelle 2021-05-25 22:31:59 +02:00
parent 790c9fd02e
commit c96b0404ba

View File

@ -2280,11 +2280,14 @@ class App extends React.Component<AppProps, AppState> {
invalidateContextMenu = true;
};
private handleCanvasPointerDown = (
event: React.PointerEvent<HTMLCanvasElement>,
) => {
private handleCanvasPointerDown = withBatchedUpdates(
(event: React.PointerEvent<HTMLCanvasElement>) => {
event.persist();
if (this.state.openMenu === "canvas") {
this.setState({ openMenu: null });
}
// remove any active selection when we start to interact with canvas
// (mainly, we care about removing selection outside the component which
// would prevent our copy handling otherwise)
@ -2388,7 +2391,8 @@ class App extends React.Component<AppProps, AppState> {
pointerDownState.eventListeners.onKeyUp = onKeyUp;
pointerDownState.eventListeners.onKeyDown = onKeyDown;
}
};
},
);
private maybeOpenContextMenuAfterPointerDownOnTouchDevices = (
event: React.PointerEvent<HTMLCanvasElement>,