From 8ca9c39bca987fc3b66ef1fb3aef1af647eb0be1 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sat, 24 Oct 2020 09:47:53 +1100 Subject: [PATCH] Scaled pinch to zoom by stage scale --- src/helpers/useStageInteraction.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/helpers/useStageInteraction.js b/src/helpers/useStageInteraction.js index 3d8a881..e408a2a 100644 --- a/src/helpers/useStageInteraction.js +++ b/src/helpers/useStageInteraction.js @@ -82,7 +82,10 @@ function useStageInteraction( const originXDelta = originX - pinchPreviousOriginRef.current.x; const originYDelta = originY - pinchPreviousOriginRef.current.y; const newScale = Math.min( - Math.max(stageScale + distanceDelta * touchZoomSpeed, minZoom), + Math.max( + stageScale + distanceDelta * touchZoomSpeed * stageScale, + minZoom + ), maxZoom );