Skip to content

Commit

Permalink
set minimum double tap scale
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispader committed Dec 14, 2023
1 parent 226b3d5 commit 5531728
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/MultiGestureCanvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import useThemeStyles from '@hooks/useThemeStyles';
import getCanvasFitScale from './getCanvasFitScale';
import {multiGestureCanvasDefaultProps, multiGestureCanvasPropTypes} from './propTypes';

const DOUBLE_TAP_SCALE = 3;

const defaultZoomRange = {
min: 1,
max: 20,
Expand Down Expand Up @@ -79,7 +81,7 @@ function MultiGestureCanvas({canvasSize, isActive = true, onScaleChanged, childr
const scaledHeight = useMemo(() => contentSize.height * minContentScale, [contentSize.height, minContentScale]);

// On double tap zoom to fill, but at least 3x zoom
const doubleTapScale = useMemo(() => maxContentScale / minContentScale, [maxContentScale, minContentScale]);
const doubleTapScale = useMemo(() => Math.max(DOUBLE_TAP_SCALE, maxContentScale / minContentScale), [maxContentScale, minContentScale]);

const zoomScale = useSharedValue(1);
// Adding together the pinch zoom scale and the initial scale to fit the content into the canvas
Expand Down

0 comments on commit 5531728

Please sign in to comment.