decord/source/modules/media_viewer/native/useMediaViewerPanGesture.tsx

161 lines
7.7 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 12129
// Function ID: 12130
2026-07-20 16:05:17 +00:00
// Name: useMediaViewerPanGestureConfig
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 4119, 9037, 9033, 4749, 8638, 6408, 2]
2026-07-20 16:05:17 +00:00
// Exports: useMediaViewerPanGesture, useMediaViewerPanGestureConfig
2026-08-24 06:08:38 +00:00
// Module 12129 (useMediaViewerPanGestureConfig)
import closure_3 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
let closure_4 = { damping: 15, mass: 1, stiffness: 250, overshootClamping: true, restSpeedThreshold: 0.001, restDisplacementThreshold: 0.001 };
2026-07-20 16:05:17 +00:00
let closure_5 = { code: "function useMediaViewerPanGestureTsx1(){const{runOnJS,handleClose}=this.__closure;runOnJS(handleClose)();}" };
let closure_6 = { code: "function useMediaViewerPanGestureTsx2(){const{isInteracting,velocity,swipeVelocityThreshold,runOnJS,dismiss,translatePos,withSpring,SPRING_CONFIG}=this.__closure;isInteracting.set(false);const willClose=Math.abs(velocity.get())>swipeVelocityThreshold;if(willClose){runOnJS(dismiss)();}else if(translatePos.get()!==0){translatePos.set(withSpring(0,{velocity:velocity.get(),...SPRING_CONFIG}));}}" };
let closure_7 = { code: "function useMediaViewerPanGestureTsx3(_,manager){const{enabled}=this.__closure;if(!enabled.get()){manager.fail();}}" };
let closure_8 = { code: "function useMediaViewerPanGestureTsx4({velocityY:velocityY,translationY:translationY}){const{translatePos,start,velocity}=this.__closure;translatePos.set(translationY+start.get().y);velocity.set(velocityY);}" };
let closure_9 = { code: "function useMediaViewerPanGestureTsx5(){const{start,translatePos,isInteracting}=this.__closure;start.set({x:0,y:translatePos.get()});isInteracting.set(true);}" };
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/media_viewer/native/useMediaViewerPanGesture.tsx");
2026-07-20 16:05:17 +00:00
export const useMediaViewerPanGestureConfig = function useMediaViewerPanGestureConfig(arg0, swipeVelocityThreshold, onClose) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = swipeVelocityThreshold;
dependencyMap = onClose;
const sharedValue = _require(4119).useSharedValue(false);
let obj = _require(4119);
const sharedValue1 = _require(4119).useSharedValue(false);
const obj2 = _require(4119);
const sharedValue2 = _require(4119).useSharedValue(0);
const obj3 = _require(4119);
const sharedValue3 = _require(4119).useSharedValue(0);
const obj4 = _require(4119);
const sharedValue4 = _require(4119).useSharedValue({ y: 0, x: 0 });
const obj5 = _require(4119);
const sharedValue5 = _require(4119).useSharedValue(true);
2026-07-20 16:05:17 +00:00
const items = [onClose];
2026-07-23 10:11:24 +00:00
const callback = sharedValue.useCallback(() => {
callback(onClose[2]).tryPauseCurrentVideo();
2026-07-29 08:29:29 +00:00
if (onClose != null) {
2026-07-23 10:11:24 +00:00
onClose();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const MediaViewerAnalytics = callback(onClose[3]).MediaViewerAnalytics;
2026-07-20 16:05:17 +00:00
MediaViewerAnalytics.markSessionCompleted();
}, items);
const items1 = [arg0, callback, sharedValue, sharedValue2, sharedValue3];
2026-07-23 10:11:24 +00:00
const callback1 = sharedValue.useCallback(() => {
2026-07-20 16:05:17 +00:00
const result = sharedValue.set(true);
2026-07-29 08:29:29 +00:00
let obj = sharedValue3;
2026-07-20 16:05:17 +00:00
if (sharedValue3.get() < 0) {
2026-07-23 10:11:24 +00:00
let tmp2 = -callback;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
tmp2 = callback;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { velocity: obj.get() };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(sharedValue1);
const fn = function t() {
2026-08-24 06:08:38 +00:00
closure_1_0(closure_1_2[1]).runOnJS(closure_9)();
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
obj = { runOnJS: callback(onClose[1]).runOnJS, handleClose: callback };
2026-07-20 16:05:17 +00:00
fn.__closure = obj;
fn.__workletHash = 7033730772994;
fn.__initData = sharedValue2;
2026-07-29 08:29:29 +00:00
const result1 = sharedValue2.set(callback(onClose[4]).withSpring(tmp2, obj, "respect-motion-settings", fn));
2026-07-20 16:05:17 +00:00
}, items1);
const items2 = [sharedValue3, sharedValue, sharedValue1, sharedValue2, swipeVelocityThreshold, callback1, sharedValue4, sharedValue5];
2026-07-23 10:11:24 +00:00
return sharedValue.useMemo(() => ({ velocity: sharedValue3, isClosing: sharedValue, isInteracting: sharedValue1, overlayEnabled: sharedValue5, translatePos: sharedValue2, swipeVelocityThreshold: closure_1, dismiss: callback1, start: sharedValue4 }), items2);
2026-07-20 16:05:17 +00:00
};
export const useMediaViewerPanGesture = function useMediaViewerPanGesture(panGestureConfig, derivedValue) {
2026-07-23 10:11:24 +00:00
let swipeVelocityThreshold = panGestureConfig.swipeVelocityThreshold;
2026-07-20 16:05:17 +00:00
const velocity = panGestureConfig.velocity;
const isInteracting = panGestureConfig.isInteracting;
const translatePos = panGestureConfig.translatePos;
const start = panGestureConfig.start;
2026-08-24 06:08:38 +00:00
closure_5 = derivedValue;
closure_6 = undefined;
2026-07-29 08:29:29 +00:00
let callback;
2026-07-23 10:11:24 +00:00
const tmp = velocity(isInteracting[5])(panGestureConfig.dismiss);
2026-08-24 06:08:38 +00:00
closure_6 = tmp;
2026-07-29 08:29:29 +00:00
const items = [tmp, derivedValue, isInteracting, start, swipeVelocityThreshold, translatePos, velocity];
callback = translatePos.useCallback(() => {
2026-07-20 16:05:17 +00:00
const Gesture = swipeVelocityThreshold(isInteracting[6]).Gesture;
const PanResult = Gesture.Pan();
const maxPointersResult = Gesture.Pan().maxPointers(1);
2026-07-29 08:29:29 +00:00
const activeOffsetYResult = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]);
2026-07-20 16:05:17 +00:00
class V {
constructor() {
2026-08-24 06:08:38 +00:00
obj = { x: 0, y: closure_3.get() };
2026-07-29 08:29:29 +00:00
result = closure_4.set(obj);
result1 = closure_2.set(true);
2026-07-20 16:05:17 +00:00
return;
}
}
let obj = { start, translatePos, isInteracting };
V.__closure = obj;
V.__workletHash = 12024094550213;
2026-08-24 06:08:38 +00:00
V.__initData = closure_1_9;
2026-07-29 08:29:29 +00:00
const failOffsetXResult = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]).failOffsetX([-10, 10]);
2026-07-20 16:05:17 +00:00
class S {
constructor(arg0) {
({ velocityY, translationY } = arg0);
2026-08-24 06:08:38 +00:00
result = closure_3.set(translationY + closure_4.get().y);
2026-07-29 08:29:29 +00:00
result1 = closure_1.set(velocityY);
2026-07-20 16:05:17 +00:00
return;
}
}
obj = { translatePos, start, velocity };
S.__closure = obj;
S.__workletHash = 9790035695747;
2026-08-24 06:08:38 +00:00
S.__initData = closure_1_8;
2026-07-29 08:29:29 +00:00
const onStartResult = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]).failOffsetX([-10, 10]).onStart(V);
2026-07-20 16:05:17 +00:00
const fn = function w(arg0, fail) {
2026-07-29 08:29:29 +00:00
if (!closure_5.get()) {
2026-07-20 16:05:17 +00:00
fail.fail();
}
};
2026-07-23 10:11:24 +00:00
fn.__closure = { enabled: closure_5 };
2026-07-20 16:05:17 +00:00
fn.__workletHash = 10675684732258;
fn.__initData = callback;
2026-08-24 06:08:38 +00:00
obj1 = { enabled: closure_5 };
2026-07-29 08:29:29 +00:00
const onUpdateResult = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]).failOffsetX([-10, 10]).onStart(V).onUpdate(S);
2026-07-20 16:05:17 +00:00
const fn2 = function t() {
2026-07-29 08:29:29 +00:00
const result = store2.set(false);
let obj = store;
if (Math.abs(store.get()) > closure_0) {
2026-08-24 06:08:38 +00:00
closure_1_0(closure_1_2[1]).runOnJS(closure_6)();
const obj5 = closure_1_0(closure_1_2[1]);
2026-07-29 08:29:29 +00:00
} else {
if (0 !== store3.get()) {
obj = { velocity: null };
obj[0] = obj.get();
2026-08-24 06:08:38 +00:00
const merged = Object.assign(closure_1_4);
const result1 = obj2.set(closure_1_0(closure_1_2[4]).withSpring(0, obj));
const obj3 = closure_1_0(closure_1_2[4]);
2026-07-29 08:29:29 +00:00
}
obj2 = store3;
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
const onTouchesDownResult = Gesture.Pan().maxPointers(1).activeOffsetY([-10, 10]).failOffsetX([-10, 10]).onStart(V).onUpdate(S).onTouchesDown(fn);
2026-08-24 06:08:38 +00:00
fn2.__closure = { isInteracting, velocity, swipeVelocityThreshold, runOnJS: swipeVelocityThreshold(isInteracting[1]).runOnJS, dismiss: closure_6, translatePos, withSpring: swipeVelocityThreshold(isInteracting[4]).withSpring, SPRING_CONFIG: start };
2026-07-20 16:05:17 +00:00
fn2.__workletHash = 3185523772752;
2026-08-24 06:08:38 +00:00
fn2.__initData = closure_6;
2026-07-20 16:05:17 +00:00
return onTouchesDownResult.onEnd(fn2);
}, items);
2026-07-29 08:29:29 +00:00
const items1 = [callback];
2026-07-23 10:11:24 +00:00
return translatePos.useMemo(() => {
2026-07-20 16:05:17 +00:00
const Gesture = swipeVelocityThreshold(isInteracting[6]).Gesture;
const NativeResult = Gesture.Native();
2026-07-23 10:11:24 +00:00
swipeVelocityThreshold = NativeResult;
2026-08-24 06:08:38 +00:00
closure_1 = [];
2026-07-20 16:05:17 +00:00
return {
panGestureGenerator(index) {
2026-07-29 08:29:29 +00:00
if (null != table[index]) {
return tmp[index];
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
tmp[index] = closure_1_7().blocksExternalGesture(closure_0);
2026-07-29 08:29:29 +00:00
return tmp[index];
2026-07-20 16:05:17 +00:00
}
},
nativeGesture: NativeResult
};
}, items1);
};