Scaled pinch to zoom by stage scale

This commit is contained in:
Mitchell McCaffrey 2020-10-24 09:47:53 +11:00
parent 41ffd15a0c
commit 8ca9c39bca

View File

@ -82,7 +82,10 @@ function useStageInteraction(
const originXDelta = originX - pinchPreviousOriginRef.current.x; const originXDelta = originX - pinchPreviousOriginRef.current.x;
const originYDelta = originY - pinchPreviousOriginRef.current.y; const originYDelta = originY - pinchPreviousOriginRef.current.y;
const newScale = Math.min( const newScale = Math.min(
Math.max(stageScale + distanceDelta * touchZoomSpeed, minZoom), Math.max(
stageScale + distanceDelta * touchZoomSpeed * stageScale,
minZoom
),
maxZoom maxZoom
); );