diff --git a/native/components/full-screen-view-modal.react.js b/native/components/full-screen-view-modal.react.js --- a/native/components/full-screen-view-modal.react.js +++ b/native/components/full-screen-view-modal.react.js @@ -37,7 +37,7 @@ import { derivedDimensionsInfoSelector } from '../selectors/dimensions-selectors.js'; import type { NativeMethods } from '../types/react-native.js'; import type { UserProfileBottomSheetNavigationProp } from '../user-profile/user-profile-bottom-sheet-navigator.react.js'; -import { clampV2 } from '../utils/animation-utils.js'; +import { clamp } from '../utils/animation-utils.js'; const defaultTimingConfig = { duration: 250, @@ -486,12 +486,12 @@ const horizPanPercent = horizPanSpace / imageWidth.value / targetScale; const vertPanPercent = vertPanSpace / imageHeight.value / targetScale; - const tapXPercentClamped = clampV2( + const tapXPercentClamped = clamp( tapXPercent, -horizPanPercent, horizPanPercent, ); - const tapYPercentClamped = clampV2( + const tapYPercentClamped = clamp( tapYPercent, -vertPanPercent, vertPanPercent, @@ -557,12 +557,12 @@ const recenteredScale = Math.max(curScale.value, 1); const horizontalPanSpace = getHorizontalPanSpace(recenteredScale); const verticalPanSpace = getVerticalPanSpace(recenteredScale); - const recenteredX = clampV2( + const recenteredX = clamp( curX.value, -horizontalPanSpace, horizontalPanSpace, ); - const recenteredY = clampV2( + const recenteredY = clamp( curY.value, -verticalPanSpace, verticalPanSpace, diff --git a/native/media/camera-modal.react.js b/native/media/camera-modal.react.js --- a/native/media/camera-modal.react.js +++ b/native/media/camera-modal.react.js @@ -51,7 +51,7 @@ import { useSelector } from '../redux/redux-utils.js'; import { colors } from '../themes/colors.js'; import type { NativeMethods } from '../types/react-native.js'; -import { clampV2 } from '../utils/animation-utils.js'; +import { clamp } from '../utils/animation-utils.js'; const maxZoom = 16; const zoomUpdateFactor = (() => { @@ -708,7 +708,7 @@ const onPinchUpdate = React.useCallback( (pinchScale: number) => { 'worklet'; - currentZoom.value = clampV2(zoomBase.value * pinchScale, 1, 8); + currentZoom.value = clamp(zoomBase.value * pinchScale, 1, 8); if ( Math.abs(currentZoom.value / zoomReported.value - 1) > zoomUpdateFactor diff --git a/native/utils/animation-utils.js b/native/utils/animation-utils.js --- a/native/utils/animation-utils.js +++ b/native/utils/animation-utils.js @@ -3,7 +3,7 @@ import * as React from 'react'; import { useSharedValue, type SharedValue } from 'react-native-reanimated'; -function clampV2(value: number, min: number, max: number): number { +function clamp(value: number, min: number, max: number): number { 'worklet'; return Math.max(Math.min(value, max), min); } @@ -16,4 +16,4 @@ return sharedValue; } -export { clampV2, useSharedValueForBoolean }; +export { clamp, useSharedValueForBoolean };