Added more checks to stage interaction

This commit is contained in:
Mitchell McCaffrey 2021-01-03 12:34:01 +11:00
parent a4c67ce81f
commit f8a2a1ece5

View File

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