react-native-screen-transitions 3.9.0-beta.2 → 3.9.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/shared/components/boundary/components/boundary-target.js +19 -14
- package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +14 -7
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +1 -0
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +32 -2
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js +4 -3
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js +3 -2
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +2 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +2 -3
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +1 -0
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js +1 -3
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/teleport.js +2 -1
- package/lib/commonjs/shared/components/boundary/portal/teleport.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +16 -3
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/commonjs/shared/constants.js +4 -0
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +4 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/activation/use-pan-activation.js +10 -10
- package/lib/commonjs/shared/providers/screen/gestures/pan/activation/use-pan-activation.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js +10 -2
- package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/use-build-pan-gesture.js +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/use-build-pan-gesture.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +25 -3
- package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -6
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -2
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js +6 -1
- package/lib/commonjs/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/shared/snapshot.js +2 -0
- package/lib/commonjs/shared/providers/screen/gestures/shared/snapshot.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/shared/values.js +2 -0
- package/lib/commonjs/shared/providers/screen/gestures/shared/values.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +11 -0
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/commonjs/shared/stores/gesture.store.js +8 -0
- package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +24 -7
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +2 -1
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +177 -314
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/config.js +12 -18
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js +196 -0
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js +94 -108
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/mask.js +72 -0
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/mask.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/targets.js +55 -0
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/targets.js.map +1 -0
- package/lib/module/shared/components/boundary/components/boundary-target.js +20 -15
- package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js +14 -7
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js +2 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/components/host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +32 -2
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js +5 -4
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js +3 -2
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +3 -2
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +3 -4
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +1 -0
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js +1 -3
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/teleport.js +1 -0
- package/lib/module/shared/components/boundary/portal/teleport.js.map +1 -1
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +17 -4
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/module/shared/constants.js +4 -0
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js +4 -0
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/activation/use-pan-activation.js +10 -10
- package/lib/module/shared/providers/screen/gestures/pan/activation/use-pan-activation.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js +10 -2
- package/lib/module/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/use-build-pan-gesture.js +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/use-build-pan-gesture.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +23 -2
- package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +4 -6
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js +2 -2
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js +6 -1
- package/lib/module/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/shared/snapshot.js +2 -0
- package/lib/module/shared/providers/screen/gestures/shared/snapshot.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/shared/values.js +2 -0
- package/lib/module/shared/providers/screen/gestures/shared/values.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +11 -0
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/module/shared/stores/gesture.store.js +8 -0
- package/lib/module/shared/stores/gesture.store.js.map +1 -1
- package/lib/module/shared/types/bounds.types.js +26 -0
- package/lib/module/shared/types/bounds.types.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +24 -7
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js +2 -1
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js +181 -318
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/config.js +11 -17
- package/lib/module/shared/utils/bounds/navigation/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/drag.js +184 -0
- package/lib/module/shared/utils/bounds/navigation/zoom/drag.js.map +1 -0
- package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js +91 -102
- package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/mask.js +67 -0
- package/lib/module/shared/utils/bounds/navigation/zoom/mask.js.map +1 -0
- package/lib/module/shared/utils/bounds/navigation/zoom/targets.js +50 -0
- package/lib/module/shared/utils/bounds/navigation/zoom/targets.js.map +1 -0
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts +3 -1
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/components/host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts +1 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts +2 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts +2 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts +1 -0
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +1 -0
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -1
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/activation/use-pan-activation.d.ts +2 -0
- package/lib/typescript/shared/providers/screen/gestures/pan/activation/use-pan-activation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/use-build-pan-gesture.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts +2 -0
- package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/shared/snapshot.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/shared/values.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts +4 -0
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
- package/lib/typescript/shared/stores/gesture.store.d.ts +4 -0
- package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +115 -88
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/gesture.types.d.ts +10 -0
- package/lib/typescript/shared/types/gesture.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/config.d.ts +7 -17
- package/lib/typescript/shared/utils/bounds/navigation/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts +55 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts +31 -34
- package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/mask.d.ts +25 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/mask.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/targets.d.ts +16 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/targets.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/navigation/zoom/types.d.ts +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/boundary/components/boundary-target.tsx +37 -26
- package/src/shared/components/boundary/hooks/lifecycles/use-initial-destination-measurement.ts +16 -13
- package/src/shared/components/boundary/portal/components/boundary-content-portal/components/host.tsx +6 -2
- package/src/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +46 -3
- package/src/shared/components/boundary/portal/components/boundary-content-portal/index.tsx +8 -5
- package/src/shared/components/boundary/portal/components/boundary-portal/components/host.tsx +3 -2
- package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +3 -2
- package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.tsx +4 -5
- package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +5 -1
- package/src/shared/components/boundary/portal/components/boundary-portal/index.tsx +1 -4
- package/src/shared/components/boundary/portal/teleport.ts +1 -0
- package/src/shared/components/boundary/providers/boundary-root.provider.tsx +23 -3
- package/src/shared/constants.ts +4 -0
- package/src/shared/index.ts +2 -0
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/index.ts +8 -0
- package/src/shared/providers/screen/gestures/pan/activation/use-pan-activation.ts +16 -7
- package/src/shared/providers/screen/gestures/pan/behavior/use-pan-behavior.ts +18 -1
- package/src/shared/providers/screen/gestures/pan/use-build-pan-gesture.ts +1 -0
- package/src/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.ts +40 -2
- package/src/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +7 -11
- package/src/shared/providers/screen/gestures/pinch/behavior/use-pinch-behavior.ts +12 -15
- package/src/shared/providers/screen/gestures/scroll-coordination/use-scroll-gesture-coordination.ts +6 -1
- package/src/shared/providers/screen/gestures/shared/snapshot.ts +2 -0
- package/src/shared/providers/screen/gestures/shared/values.ts +2 -0
- package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +14 -1
- package/src/shared/stores/gesture.store.ts +12 -0
- package/src/shared/types/bounds.types.ts +119 -90
- package/src/shared/types/gesture.types.ts +10 -0
- package/src/shared/types/index.ts +2 -0
- package/src/shared/utils/animation/animate-to-progress.ts +23 -7
- package/src/shared/utils/bounds/navigation/reveal/math.ts +2 -1
- package/src/shared/utils/bounds/navigation/zoom/build.ts +223 -411
- package/src/shared/utils/bounds/navigation/zoom/config.ts +15 -18
- package/src/shared/utils/bounds/navigation/zoom/drag.ts +327 -0
- package/src/shared/utils/bounds/navigation/zoom/helpers.ts +122 -184
- package/src/shared/utils/bounds/navigation/zoom/mask.ts +130 -0
- package/src/shared/utils/bounds/navigation/zoom/targets.ts +74 -0
- package/src/shared/utils/bounds/navigation/zoom/types.ts +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/math.js +0 -25
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/math.js.map +0 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/math.js +0 -20
- package/lib/module/shared/utils/bounds/navigation/zoom/math.js.map +0 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/math.d.ts +0 -8
- package/lib/typescript/shared/utils/bounds/navigation/zoom/math.d.ts.map +0 -1
- package/src/shared/utils/bounds/navigation/zoom/math.ts +0 -25
|
@@ -3,24 +3,21 @@ export const ZOOM_SHARED_OPTIONS = Object.freeze({
|
|
|
3
3
|
scaleMode: "uniform" as const,
|
|
4
4
|
});
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
export const ZOOM_DRAG_DIRECTIONAL_SCALE_MAX = 1.06;
|
|
8
|
-
export const ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT = 2;
|
|
9
|
-
export const ZOOM_DRAG_TRANSLATION_NEGATIVE_MAX = 1;
|
|
10
|
-
export const ZOOM_DRAG_TRANSLATION_POSITIVE_MAX = 1;
|
|
11
|
-
export const ZOOM_DRAG_TRANSLATION_EXPONENT = 1;
|
|
12
|
-
export const ZOOM_DISMISS_SCALE_ORBIT_DEPTH = 0.5;
|
|
6
|
+
export const ZOOM_DISMISS_VELOCITY_DEPTH = 1.0;
|
|
13
7
|
export const ZOOM_BACKGROUND_SCALE = 0.9375;
|
|
14
|
-
|
|
15
|
-
export const
|
|
16
|
-
|
|
8
|
+
// Keep the previous screen visible beneath the zoom instead of reaching black.
|
|
9
|
+
export const ZOOM_BACKDROP_MAX_OPACITY = 0.45;
|
|
10
|
+
// Geometry-aligned native frames reach their darkest point around here.
|
|
11
|
+
export const ZOOM_SCREEN_A_FADE_END = 0.54;
|
|
12
|
+
// Open uses a tight owner handoff after red has traveled about one quarter.
|
|
13
|
+
export const ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [0, 0.4, 0, 1] as const;
|
|
14
|
+
export const ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE = [
|
|
15
|
+
1.27, 1.4, 1, 0,
|
|
16
|
+
] as const;
|
|
17
|
+
// On close, red is prepared behind opaque blue before blue fades away.
|
|
18
|
+
export const ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [
|
|
19
|
+
0.13, 0.7, 0, 1,
|
|
20
|
+
] as const;
|
|
17
21
|
export const ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE = [
|
|
18
|
-
1.
|
|
22
|
+
1.7, 2, 1, 0,
|
|
19
23
|
] as const;
|
|
20
|
-
|
|
21
|
-
export const ZOOM_MASK_OUTSET = Object.freeze({
|
|
22
|
-
top: 0,
|
|
23
|
-
right: 0,
|
|
24
|
-
bottom: 0,
|
|
25
|
-
left: 0,
|
|
26
|
-
});
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import type { MeasuredDimensions } from "react-native-reanimated";
|
|
2
|
+
import { EPSILON } from "../../../../constants";
|
|
3
|
+
import type {
|
|
4
|
+
BoundsInterpolationProps,
|
|
5
|
+
BoundsNavigationZoomDragOptions,
|
|
6
|
+
} from "../../../../types/bounds.types";
|
|
7
|
+
import type { Layout } from "../../../../types/screen.types";
|
|
8
|
+
import { resolveRevealContentBaseTransform } from "../reveal/math";
|
|
9
|
+
import { ZOOM_DISMISS_VELOCITY_DEPTH } from "./config";
|
|
10
|
+
|
|
11
|
+
const ZOOM_DRAG_SCALE_EXPONENT = 2;
|
|
12
|
+
const ZOOM_DRAG_SCALE_FLOOR = 0.5;
|
|
13
|
+
const ZOOM_COUNTER_DRAG_SCALE_INTENSITY = 0.4;
|
|
14
|
+
const ZOOM_PRIMARY_DRAG_TRANSLATION_SCALE = 0.8;
|
|
15
|
+
const ZOOM_PRIMARY_DRAG_RESISTANCE = 2;
|
|
16
|
+
const ZOOM_HORIZONTAL_DRAG_DISTANCE_SCALE = 1.5;
|
|
17
|
+
const ZOOM_CROSS_AXIS_DRAG_TRANSLATION_SCALE = 0.35;
|
|
18
|
+
const ZOOM_CROSS_AXIS_DRAG_RESISTANCE = 0.05;
|
|
19
|
+
const ZOOM_PINCH_SCALE_RESPONSE = 1;
|
|
20
|
+
const ZOOM_PINCH_VELOCITY_DEPTH_MULTIPLIER = 2;
|
|
21
|
+
|
|
22
|
+
type ZoomGesture = BoundsInterpolationProps["active"]["gesture"];
|
|
23
|
+
|
|
24
|
+
export type ZoomDragState = {
|
|
25
|
+
collapsesMask: boolean;
|
|
26
|
+
dismissContentScale: number;
|
|
27
|
+
dismissNorm: number;
|
|
28
|
+
dismissProgress: number;
|
|
29
|
+
dragX: number;
|
|
30
|
+
dragY: number;
|
|
31
|
+
gestureScale: number;
|
|
32
|
+
isDismissing: boolean;
|
|
33
|
+
isVerticalInverted: boolean;
|
|
34
|
+
rotation: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function resolveZoomDismissContentScale({
|
|
38
|
+
transitionRemaining,
|
|
39
|
+
releaseScale,
|
|
40
|
+
targetScale,
|
|
41
|
+
velocity,
|
|
42
|
+
velocityDepth,
|
|
43
|
+
}: {
|
|
44
|
+
transitionRemaining: number;
|
|
45
|
+
releaseScale: number;
|
|
46
|
+
targetScale: number;
|
|
47
|
+
velocity: number;
|
|
48
|
+
velocityDepth: number;
|
|
49
|
+
}) {
|
|
50
|
+
"worklet";
|
|
51
|
+
|
|
52
|
+
const closeProgress = 1 - transitionRemaining;
|
|
53
|
+
const depth = velocityDepth * velocity;
|
|
54
|
+
|
|
55
|
+
const scaleDelta = targetScale - releaseScale;
|
|
56
|
+
const controlScale1 = releaseScale + scaleDelta / 3;
|
|
57
|
+
const linearControlScale2 = releaseScale + (2 * scaleDelta) / 3;
|
|
58
|
+
const controlScale2 = Math.max(EPSILON, linearControlScale2 * (1 - depth));
|
|
59
|
+
const remaining = 1 - closeProgress;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
remaining * remaining * remaining * releaseScale +
|
|
63
|
+
3 * remaining * remaining * closeProgress * controlScale1 +
|
|
64
|
+
3 * remaining * closeProgress * closeProgress * controlScale2 +
|
|
65
|
+
closeProgress * closeProgress * closeProgress * targetScale
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function resolveZoomPrimaryDragTranslation({
|
|
70
|
+
translation,
|
|
71
|
+
dimension,
|
|
72
|
+
}: {
|
|
73
|
+
translation: number;
|
|
74
|
+
dimension: number;
|
|
75
|
+
}) {
|
|
76
|
+
"worklet";
|
|
77
|
+
|
|
78
|
+
const direction = translation < 0 ? -1 : 1;
|
|
79
|
+
const translationDistance = Math.abs(translation);
|
|
80
|
+
const baseDistance = Math.max(1, dimension);
|
|
81
|
+
const normalizedTranslation = translationDistance / baseDistance;
|
|
82
|
+
const effectiveResistance = ZOOM_PRIMARY_DRAG_RESISTANCE * 0.85;
|
|
83
|
+
const resistedTranslation =
|
|
84
|
+
(baseDistance *
|
|
85
|
+
(1 - Math.exp(-effectiveResistance * normalizedTranslation))) /
|
|
86
|
+
effectiveResistance;
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
direction *
|
|
90
|
+
Math.min(
|
|
91
|
+
baseDistance,
|
|
92
|
+
resistedTranslation * ZOOM_PRIMARY_DRAG_TRANSLATION_SCALE,
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function resolveZoomHorizontalDragTranslation({
|
|
98
|
+
translation,
|
|
99
|
+
dimension,
|
|
100
|
+
}: {
|
|
101
|
+
translation: number;
|
|
102
|
+
dimension: number;
|
|
103
|
+
}) {
|
|
104
|
+
"worklet";
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
resolveZoomPrimaryDragTranslation({ translation, dimension }) *
|
|
108
|
+
ZOOM_HORIZONTAL_DRAG_DISTANCE_SCALE
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function resolveZoomCrossAxisDragTranslation({
|
|
113
|
+
translation,
|
|
114
|
+
dimension,
|
|
115
|
+
}: {
|
|
116
|
+
translation: number;
|
|
117
|
+
dimension: number;
|
|
118
|
+
}) {
|
|
119
|
+
"worklet";
|
|
120
|
+
|
|
121
|
+
const direction = translation < 0 ? -1 : 1;
|
|
122
|
+
const translationDistance = Math.abs(translation);
|
|
123
|
+
const baseDistance = Math.max(1, dimension);
|
|
124
|
+
const normalizedTranslation = translationDistance / baseDistance;
|
|
125
|
+
const resistedTranslation =
|
|
126
|
+
(baseDistance *
|
|
127
|
+
(1 -
|
|
128
|
+
Math.exp(-ZOOM_CROSS_AXIS_DRAG_RESISTANCE * normalizedTranslation))) /
|
|
129
|
+
ZOOM_CROSS_AXIS_DRAG_RESISTANCE;
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
direction *
|
|
133
|
+
Math.min(
|
|
134
|
+
baseDistance,
|
|
135
|
+
resistedTranslation * ZOOM_CROSS_AXIS_DRAG_TRANSLATION_SCALE,
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function resolveZoomDragScale(normalized: number) {
|
|
141
|
+
"worklet";
|
|
142
|
+
|
|
143
|
+
const scaleInput =
|
|
144
|
+
normalized < 0
|
|
145
|
+
? normalized * ZOOM_COUNTER_DRAG_SCALE_INTENSITY
|
|
146
|
+
: normalized;
|
|
147
|
+
const progress = Math.min(1, scaleInput);
|
|
148
|
+
const rawMinimumScale =
|
|
149
|
+
ZOOM_DRAG_SCALE_FLOOR ** (1 / ZOOM_DRAG_SCALE_EXPONENT);
|
|
150
|
+
const rawScale = 1 + (rawMinimumScale - 1) * progress;
|
|
151
|
+
|
|
152
|
+
return rawScale ** ZOOM_DRAG_SCALE_EXPONENT;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function resolveZoomPinchScale(scale: number) {
|
|
156
|
+
"worklet";
|
|
157
|
+
return 1 + (scale - 1) * ZOOM_PINCH_SCALE_RESPONSE;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function resolveZoomDismissalNorm(
|
|
161
|
+
normalized: number,
|
|
162
|
+
isInverted: boolean,
|
|
163
|
+
) {
|
|
164
|
+
"worklet";
|
|
165
|
+
return isInverted ? -normalized : normalized;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function resolveZoomDragState({
|
|
169
|
+
gesture,
|
|
170
|
+
activeTransitionProgress,
|
|
171
|
+
screenLayout,
|
|
172
|
+
sourceBounds,
|
|
173
|
+
trackingContentTarget,
|
|
174
|
+
dragOptions,
|
|
175
|
+
}: {
|
|
176
|
+
gesture: ZoomGesture;
|
|
177
|
+
activeTransitionProgress: number;
|
|
178
|
+
screenLayout: Layout;
|
|
179
|
+
sourceBounds: MeasuredDimensions;
|
|
180
|
+
trackingContentTarget: MeasuredDimensions;
|
|
181
|
+
dragOptions?: BoundsNavigationZoomDragOptions;
|
|
182
|
+
}): ZoomDragState {
|
|
183
|
+
"worklet";
|
|
184
|
+
|
|
185
|
+
const gestureHandoff = gesture.handoff;
|
|
186
|
+
const isDismissing = gesture.dismissing === 1;
|
|
187
|
+
const activeGesture = gestureHandoff.active;
|
|
188
|
+
const isHorizontalInverted = activeGesture === "horizontal-inverted";
|
|
189
|
+
const isHorizontal = activeGesture === "horizontal" || isHorizontalInverted;
|
|
190
|
+
const isVerticalInverted = activeGesture === "vertical-inverted";
|
|
191
|
+
const isVertical = activeGesture === "vertical" || isVerticalInverted;
|
|
192
|
+
const isPinchIn = activeGesture === "pinch-in";
|
|
193
|
+
const isInverted = isHorizontalInverted || isVerticalInverted;
|
|
194
|
+
const translationResponse = Math.max(
|
|
195
|
+
0,
|
|
196
|
+
isHorizontal
|
|
197
|
+
? (dragOptions?.translation?.horizontal ?? 1)
|
|
198
|
+
: isVertical
|
|
199
|
+
? (dragOptions?.translation?.vertical ?? 1)
|
|
200
|
+
: 1,
|
|
201
|
+
);
|
|
202
|
+
const scaleResponse = Math.max(
|
|
203
|
+
0,
|
|
204
|
+
isHorizontal
|
|
205
|
+
? (dragOptions?.scale?.horizontal ?? 1)
|
|
206
|
+
: isVertical
|
|
207
|
+
? (dragOptions?.scale?.vertical ?? 1)
|
|
208
|
+
: 1,
|
|
209
|
+
);
|
|
210
|
+
const handoffPrimaryNorm = isPinchIn
|
|
211
|
+
? -gestureHandoff.normScale
|
|
212
|
+
: isHorizontal
|
|
213
|
+
? gestureHandoff.normX
|
|
214
|
+
: gestureHandoff.normY;
|
|
215
|
+
const livePrimaryNorm = isPinchIn
|
|
216
|
+
? -gesture.normScale
|
|
217
|
+
: isHorizontal
|
|
218
|
+
? gesture.normX
|
|
219
|
+
: gesture.normY;
|
|
220
|
+
const dismissNorm = Math.max(
|
|
221
|
+
0,
|
|
222
|
+
resolveZoomDismissalNorm(handoffPrimaryNorm, isInverted),
|
|
223
|
+
);
|
|
224
|
+
const nativeDragX = isPinchIn
|
|
225
|
+
? gesture.x
|
|
226
|
+
: isHorizontal
|
|
227
|
+
? resolveZoomHorizontalDragTranslation({
|
|
228
|
+
translation: gesture.x,
|
|
229
|
+
dimension: screenLayout.width,
|
|
230
|
+
})
|
|
231
|
+
: isVertical
|
|
232
|
+
? resolveZoomCrossAxisDragTranslation({
|
|
233
|
+
translation: gesture.x,
|
|
234
|
+
dimension: screenLayout.width,
|
|
235
|
+
})
|
|
236
|
+
: 0;
|
|
237
|
+
const nativeDragY = isPinchIn
|
|
238
|
+
? gesture.y
|
|
239
|
+
: isHorizontal
|
|
240
|
+
? resolveZoomCrossAxisDragTranslation({
|
|
241
|
+
translation: gesture.y,
|
|
242
|
+
dimension: screenLayout.height,
|
|
243
|
+
})
|
|
244
|
+
: resolveZoomPrimaryDragTranslation({
|
|
245
|
+
translation: gesture.y,
|
|
246
|
+
dimension: screenLayout.height,
|
|
247
|
+
});
|
|
248
|
+
const dragX = nativeDragX * translationResponse;
|
|
249
|
+
const dragY = nativeDragY * translationResponse;
|
|
250
|
+
const scaleNorm = resolveZoomDismissalNorm(
|
|
251
|
+
isDismissing ? handoffPrimaryNorm : livePrimaryNorm,
|
|
252
|
+
isInverted,
|
|
253
|
+
);
|
|
254
|
+
const nativeGestureScale = isPinchIn
|
|
255
|
+
? resolveZoomPinchScale(isDismissing ? gestureHandoff.scale : gesture.scale)
|
|
256
|
+
: resolveZoomDragScale(scaleNorm);
|
|
257
|
+
const gestureScale = isPinchIn
|
|
258
|
+
? nativeGestureScale
|
|
259
|
+
: Math.max(EPSILON, 1 + (nativeGestureScale - 1) * scaleResponse);
|
|
260
|
+
const rotation = isPinchIn
|
|
261
|
+
? isDismissing
|
|
262
|
+
? gestureHandoff.rotation * activeTransitionProgress
|
|
263
|
+
: gesture.rotation
|
|
264
|
+
: 0;
|
|
265
|
+
|
|
266
|
+
let dismissContentScale = gestureScale;
|
|
267
|
+
|
|
268
|
+
if (isDismissing) {
|
|
269
|
+
const targetContentScale = resolveRevealContentBaseTransform({
|
|
270
|
+
progress: 0,
|
|
271
|
+
sourceBounds,
|
|
272
|
+
destinationBounds: trackingContentTarget,
|
|
273
|
+
screenLayout,
|
|
274
|
+
}).scale;
|
|
275
|
+
dismissContentScale = resolveZoomDismissContentScale({
|
|
276
|
+
transitionRemaining: activeTransitionProgress,
|
|
277
|
+
releaseScale: gestureScale,
|
|
278
|
+
targetScale: targetContentScale,
|
|
279
|
+
velocity: gestureHandoff.velocity,
|
|
280
|
+
velocityDepth:
|
|
281
|
+
ZOOM_DISMISS_VELOCITY_DEPTH *
|
|
282
|
+
(isPinchIn ? ZOOM_PINCH_VELOCITY_DEPTH_MULTIPLIER : 1),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
collapsesMask: isVertical,
|
|
288
|
+
dismissContentScale,
|
|
289
|
+
dismissNorm,
|
|
290
|
+
dismissProgress: isDismissing ? 1 - activeTransitionProgress : 0,
|
|
291
|
+
dragX,
|
|
292
|
+
dragY,
|
|
293
|
+
gestureScale,
|
|
294
|
+
isDismissing,
|
|
295
|
+
isVerticalInverted,
|
|
296
|
+
rotation,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function resolveZoomTrackedGestureScale({
|
|
301
|
+
drag,
|
|
302
|
+
activeTransitionProgress,
|
|
303
|
+
screenLayout,
|
|
304
|
+
sourceBounds,
|
|
305
|
+
trackingContentTarget,
|
|
306
|
+
}: {
|
|
307
|
+
drag: ZoomDragState;
|
|
308
|
+
activeTransitionProgress: number;
|
|
309
|
+
screenLayout: Layout;
|
|
310
|
+
sourceBounds: MeasuredDimensions;
|
|
311
|
+
trackingContentTarget: MeasuredDimensions;
|
|
312
|
+
}) {
|
|
313
|
+
"worklet";
|
|
314
|
+
|
|
315
|
+
if (!drag.isDismissing) {
|
|
316
|
+
return drag.gestureScale;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const trackedContentBaseScale = resolveRevealContentBaseTransform({
|
|
320
|
+
progress: activeTransitionProgress,
|
|
321
|
+
sourceBounds,
|
|
322
|
+
destinationBounds: trackingContentTarget,
|
|
323
|
+
screenLayout,
|
|
324
|
+
}).scale;
|
|
325
|
+
|
|
326
|
+
return drag.dismissContentScale / trackedContentBaseScale;
|
|
327
|
+
}
|
|
@@ -1,212 +1,150 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MeasuredDimensions } from "react-native-reanimated";
|
|
2
2
|
import { EPSILON } from "../../../../constants";
|
|
3
|
-
import type { BoundsLink } from "../../../../types/bounds.types";
|
|
4
|
-
import type {
|
|
5
|
-
ActiveGesture,
|
|
6
|
-
ResolvedPanGestureDirection,
|
|
7
|
-
} from "../../../../types/gesture.types";
|
|
8
3
|
import type { Layout } from "../../../../types/screen.types";
|
|
9
|
-
import type { BoundsOptions } from "../../types/options";
|
|
10
4
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export function getZoomContentTarget({
|
|
21
|
-
explicitTarget,
|
|
22
|
-
screenLayout,
|
|
23
|
-
anchor,
|
|
24
|
-
link,
|
|
5
|
+
resolveRevealContentBaseTransform,
|
|
6
|
+
resolveTrackedSourceElementTransform,
|
|
7
|
+
} from "../reveal/math";
|
|
8
|
+
|
|
9
|
+
export function resolveZoomBackdropOpacity({
|
|
10
|
+
transitionProgress,
|
|
11
|
+
dismissalDrag,
|
|
12
|
+
fadeEnd,
|
|
13
|
+
maxOpacity,
|
|
25
14
|
}: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
transitionProgress: number;
|
|
16
|
+
dismissalDrag: number;
|
|
17
|
+
fadeEnd: number;
|
|
18
|
+
maxOpacity: number;
|
|
30
19
|
}) {
|
|
31
20
|
"worklet";
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
if (!sourceBounds || sourceBounds.width <= 0 || screenWidth <= 0) {
|
|
39
|
-
return "fullscreen" as const;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const height = (sourceBounds.height / sourceBounds.width) * screenWidth;
|
|
43
|
-
const verticalAnchor =
|
|
44
|
-
anchor === "bottomLeading" ||
|
|
45
|
-
anchor === "bottom" ||
|
|
46
|
-
anchor === "bottomTrailing"
|
|
47
|
-
? "bottom"
|
|
48
|
-
: anchor === "center" || anchor === "leading" || anchor === "trailing"
|
|
49
|
-
? "center"
|
|
50
|
-
: "top";
|
|
51
|
-
const y =
|
|
52
|
-
verticalAnchor === "top"
|
|
53
|
-
? 0
|
|
54
|
-
: verticalAnchor === "bottom"
|
|
55
|
-
? screenLayout.height - height
|
|
56
|
-
: (screenLayout.height - height) / 2;
|
|
22
|
+
const clampedProgress = Math.min(1, Math.max(0, transitionProgress));
|
|
23
|
+
const clampedDrag = Math.min(1, Math.max(0, dismissalDrag));
|
|
24
|
+
const safeFadeEnd = Math.max(EPSILON, fadeEnd);
|
|
25
|
+
const transitionOpacity = Math.min(1, clampedProgress / safeFadeEnd);
|
|
26
|
+
const clampedMaxOpacity = Math.min(1, Math.max(0, maxOpacity));
|
|
57
27
|
|
|
58
|
-
return
|
|
59
|
-
x: 0,
|
|
60
|
-
y,
|
|
61
|
-
pageX: 0,
|
|
62
|
-
pageY: y,
|
|
63
|
-
width: screenWidth,
|
|
64
|
-
height,
|
|
65
|
-
};
|
|
28
|
+
return clampedMaxOpacity * transitionOpacity * (1 - clampedDrag);
|
|
66
29
|
}
|
|
67
30
|
|
|
68
|
-
export function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
31
|
+
export function resolveZoomPinchFocalOffset({
|
|
32
|
+
gestureScale,
|
|
33
|
+
pinchOriginX,
|
|
34
|
+
pinchOriginY,
|
|
35
|
+
progress,
|
|
36
|
+
rotation,
|
|
37
|
+
screenLayout,
|
|
38
|
+
}: {
|
|
39
|
+
gestureScale: number;
|
|
40
|
+
pinchOriginX: number;
|
|
41
|
+
pinchOriginY: number;
|
|
42
|
+
progress: number;
|
|
43
|
+
rotation: number;
|
|
44
|
+
screenLayout: Layout;
|
|
45
|
+
}) {
|
|
73
46
|
"worklet";
|
|
74
47
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
exponent: value?.[2] ?? ZOOM_DRAG_DIRECTIONAL_SCALE_EXPONENT,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
48
|
+
if (Math.abs(gestureScale - 1) <= EPSILON && Math.abs(rotation) <= EPSILON) {
|
|
49
|
+
return { x: 0, y: 0 };
|
|
50
|
+
}
|
|
81
51
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
|
|
52
|
+
const offsetX = pinchOriginX - screenLayout.width / 2;
|
|
53
|
+
const offsetY = pinchOriginY - screenLayout.height / 2;
|
|
54
|
+
const cosine = Math.cos(rotation);
|
|
55
|
+
const sine = Math.sin(rotation);
|
|
56
|
+
const transformedOffsetX = gestureScale * (offsetX * cosine - offsetY * sine);
|
|
57
|
+
const transformedOffsetY = gestureScale * (offsetX * sine + offsetY * cosine);
|
|
58
|
+
const clampedProgress = Math.min(1, Math.max(0, progress));
|
|
88
59
|
|
|
89
60
|
return {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
exponent: value?.[2] ?? ZOOM_DRAG_TRANSLATION_EXPONENT,
|
|
61
|
+
x: (offsetX - transformedOffsetX) * clampedProgress,
|
|
62
|
+
y: (offsetY - transformedOffsetY) * clampedProgress,
|
|
93
63
|
};
|
|
94
64
|
}
|
|
95
65
|
|
|
96
|
-
export function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
direction === "horizontal" ||
|
|
108
|
-
direction === "horizontal-inverted" ||
|
|
109
|
-
direction === "vertical" ||
|
|
110
|
-
direction === "vertical-inverted"
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const resolveMotionDirection = ({
|
|
115
|
-
normX,
|
|
116
|
-
normY,
|
|
117
|
-
rawNormX,
|
|
118
|
-
rawNormY,
|
|
66
|
+
export function resolveZoomTrackedSourceTransform({
|
|
67
|
+
progress,
|
|
68
|
+
sourceBounds,
|
|
69
|
+
destinationBounds,
|
|
70
|
+
screenLayout,
|
|
71
|
+
dragX,
|
|
72
|
+
dragY,
|
|
73
|
+
gestureScale,
|
|
74
|
+
parentScale,
|
|
75
|
+
rotation = 0,
|
|
119
76
|
}: {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
77
|
+
progress: number;
|
|
78
|
+
sourceBounds: MeasuredDimensions;
|
|
79
|
+
destinationBounds: MeasuredDimensions;
|
|
80
|
+
screenLayout: Layout;
|
|
81
|
+
dragX: number;
|
|
82
|
+
dragY: number;
|
|
83
|
+
gestureScale: number;
|
|
84
|
+
parentScale: number;
|
|
85
|
+
rotation?: number;
|
|
86
|
+
}) {
|
|
125
87
|
"worklet";
|
|
126
|
-
const motionX = Math.max(Math.abs(normX), Math.abs(rawNormX));
|
|
127
|
-
const motionY = Math.max(Math.abs(normY), Math.abs(rawNormY));
|
|
128
|
-
|
|
129
|
-
if (motionX <= EPSILON && motionY <= EPSILON) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (motionY > motionX + EPSILON) {
|
|
134
|
-
return normY < 0 || rawNormY < 0 ? "vertical-inverted" : "vertical";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (motionX > motionY + EPSILON) {
|
|
138
|
-
return normX < 0 || rawNormX < 0 ? "horizontal-inverted" : "horizontal";
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return null;
|
|
142
|
-
};
|
|
143
88
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
rawNormX,
|
|
150
|
-
rawNormY,
|
|
151
|
-
}: {
|
|
152
|
-
active: ActiveGesture | null | undefined;
|
|
153
|
-
direction: ActiveGesture | null | undefined;
|
|
154
|
-
normX: number;
|
|
155
|
-
normY: number;
|
|
156
|
-
rawNormX: number;
|
|
157
|
-
rawNormY: number;
|
|
158
|
-
}): ResolvedPanGestureDirection | null {
|
|
159
|
-
"worklet";
|
|
160
|
-
const storedDirection = active ?? direction;
|
|
161
|
-
const motionDirection = resolveMotionDirection({
|
|
162
|
-
normX,
|
|
163
|
-
normY,
|
|
164
|
-
rawNormX,
|
|
165
|
-
rawNormY,
|
|
89
|
+
const contentBaseTransform = resolveRevealContentBaseTransform({
|
|
90
|
+
progress,
|
|
91
|
+
sourceBounds,
|
|
92
|
+
destinationBounds,
|
|
93
|
+
screenLayout,
|
|
166
94
|
});
|
|
95
|
+
const collapsedContentScale = resolveRevealContentBaseTransform({
|
|
96
|
+
progress: 0,
|
|
97
|
+
sourceBounds,
|
|
98
|
+
destinationBounds,
|
|
99
|
+
screenLayout,
|
|
100
|
+
}).scale;
|
|
101
|
+
const contentScale = contentBaseTransform.scale * gestureScale;
|
|
102
|
+
const safeCollapsedContentScale = Math.max(
|
|
103
|
+
Math.abs(collapsedContentScale),
|
|
104
|
+
EPSILON,
|
|
105
|
+
);
|
|
106
|
+
const safeParentScale = Math.max(Math.abs(parentScale), EPSILON);
|
|
107
|
+
const uniformSourceScale =
|
|
108
|
+
contentScale / (safeCollapsedContentScale * safeParentScale);
|
|
109
|
+
const trackedTransform = {
|
|
110
|
+
...resolveTrackedSourceElementTransform({
|
|
111
|
+
sourceBounds,
|
|
112
|
+
destinationBounds,
|
|
113
|
+
contentTranslateX: contentBaseTransform.translateX + dragX,
|
|
114
|
+
contentTranslateY: contentBaseTransform.translateY + dragY,
|
|
115
|
+
contentScale,
|
|
116
|
+
parentScale,
|
|
117
|
+
screenWidth: screenLayout.width,
|
|
118
|
+
screenHeight: screenLayout.height,
|
|
119
|
+
}),
|
|
120
|
+
scaleX: uniformSourceScale,
|
|
121
|
+
scaleY: uniformSourceScale,
|
|
122
|
+
};
|
|
167
123
|
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (!motionDirection) {
|
|
173
|
-
return storedDirection;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const storedIsHorizontal =
|
|
177
|
-
storedDirection === "horizontal" ||
|
|
178
|
-
storedDirection === "horizontal-inverted";
|
|
179
|
-
const storedMotion = storedIsHorizontal
|
|
180
|
-
? Math.max(Math.abs(normX), Math.abs(rawNormX))
|
|
181
|
-
: Math.max(Math.abs(normY), Math.abs(rawNormY));
|
|
182
|
-
const oppositeMotion = storedIsHorizontal
|
|
183
|
-
? Math.max(Math.abs(normY), Math.abs(rawNormY))
|
|
184
|
-
: Math.max(Math.abs(normX), Math.abs(rawNormX));
|
|
185
|
-
|
|
186
|
-
if (oppositeMotion > storedMotion + EPSILON) {
|
|
187
|
-
return motionDirection;
|
|
124
|
+
if (Math.abs(rotation) <= EPSILON) {
|
|
125
|
+
return trackedTransform;
|
|
188
126
|
}
|
|
189
127
|
|
|
190
|
-
|
|
191
|
-
|
|
128
|
+
const screenCenterX = screenLayout.width / 2;
|
|
129
|
+
const screenCenterY = screenLayout.height / 2;
|
|
130
|
+
const destinationCenterX =
|
|
131
|
+
destinationBounds.pageX + destinationBounds.width / 2;
|
|
132
|
+
const destinationCenterY =
|
|
133
|
+
destinationBounds.pageY + destinationBounds.height / 2;
|
|
134
|
+
const scaledOffsetX = (destinationCenterX - screenCenterX) * contentScale;
|
|
135
|
+
const scaledOffsetY = (destinationCenterY - screenCenterY) * contentScale;
|
|
136
|
+
const cosine = Math.cos(rotation);
|
|
137
|
+
const sine = Math.sin(rotation);
|
|
138
|
+
const rotatedOffsetX = scaledOffsetX * cosine - scaledOffsetY * sine;
|
|
139
|
+
const rotatedOffsetY = scaledOffsetX * sine + scaledOffsetY * cosine;
|
|
192
140
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
141
|
+
return {
|
|
142
|
+
...trackedTransform,
|
|
143
|
+
translateX:
|
|
144
|
+
trackedTransform.translateX +
|
|
145
|
+
(rotatedOffsetX - scaledOffsetX) / safeParentScale,
|
|
146
|
+
translateY:
|
|
147
|
+
trackedTransform.translateY +
|
|
148
|
+
(rotatedOffsetY - scaledOffsetY) / safeParentScale,
|
|
200
149
|
};
|
|
201
|
-
}) {
|
|
202
|
-
"worklet";
|
|
203
|
-
|
|
204
|
-
const { progress, range } = params;
|
|
205
|
-
|
|
206
|
-
return interpolate(
|
|
207
|
-
progress,
|
|
208
|
-
[range.inputStart, range.inputEnd],
|
|
209
|
-
[range.outputStart, range.outputEnd],
|
|
210
|
-
"clamp",
|
|
211
|
-
);
|
|
212
150
|
}
|