Fix crash with interacting with page while loading

This commit is contained in:
Mitchell McCaffrey 2020-11-27 12:02:00 +11:00
parent ddda241c56
commit 9fa8667081

View File

@ -26,8 +26,10 @@ function useStageInteraction(
...gesture,
onWheelStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
if (layer) {
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
}
gesture.onWheelStart && gesture.onWheelStart(props);
},
onWheel: (props) => {
@ -61,8 +63,10 @@ function useStageInteraction(
},
onPinchStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
if (layer) {
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
}
const { da, origin } = props;
const [distance] = da;
const [originX, originY] = origin;
@ -123,8 +127,10 @@ function useStageInteraction(
},
onDragStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
if (layer) {
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
}
gesture.onDragStart && gesture.onDragStart(props);
},
onDrag: (props) => {