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

156 lines
7.6 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 12255
// Function ID: 95701
2026-07-20 16:05:17 +00:00
// Name: useMediaViewerPanGestureConfig
2026-07-25 08:10:48 +00:00
// Dependencies: [31, 3992, 8061, 8057, 4543, 8193, 5217, 2]
2026-07-20 16:05:17 +00:00
// Exports: useMediaViewerPanGesture, useMediaViewerPanGestureConfig
2026-07-27 11:26:19 +00:00
// Module 12255 (useMediaViewerPanGestureConfig)
2026-07-23 10:11:24 +00:00
import result from "result";
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-07-23 10:11:24 +00:00
let result = require("useVideoControls").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;
let closure_1 = swipeVelocityThreshold;
2026-07-20 16:05:17 +00:00
const dependencyMap = onClose;
2026-07-25 08:10:48 +00:00
const sharedValue = _require(3992).useSharedValue(false);
let obj = _require(3992);
const sharedValue1 = _require(3992).useSharedValue(false);
const obj2 = _require(3992);
const sharedValue2 = _require(3992).useSharedValue(0);
const obj3 = _require(3992);
const sharedValue3 = _require(3992).useSharedValue(0);
const obj4 = _require(3992);
const sharedValue4 = _require(3992).useSharedValue({ y: 0, x: 0 });
const obj5 = _require(3992);
const sharedValue5 = _require(3992).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();
if (null != onClose) {
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);
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-23 10:11:24 +00:00
let obj = callback(onClose[4]);
2026-07-20 16:05:17 +00:00
obj = { velocity: sharedValue3.get() };
const merged = Object.assign(sharedValue1);
const fn = function t() {
2026-07-23 10:11:24 +00:00
callback(table[1]).runOnJS(outer1_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;
const result1 = sharedValue2.set(obj.withSpring(tmp2, obj, "respect-motion-settings", fn));
}, 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;
let closure_5 = derivedValue;
2026-07-23 10:11:24 +00:00
const tmp = velocity(isInteracting[5])(panGestureConfig.dismiss);
2026-07-20 16:05:17 +00:00
let closure_6 = tmp;
2026-07-23 10:11:24 +00:00
let items = [tmp, derivedValue, isInteracting, start, swipeVelocityThreshold, translatePos, velocity];
const callback = translatePos.useCallback(() => {
2026-07-20 16:05:17 +00:00
const Gesture = swipeVelocityThreshold(isInteracting[6]).Gesture;
const PanResult = Gesture.Pan();
const items = [-10, 10];
const maxPointersResult = Gesture.Pan().maxPointers(1);
const items1 = [-10, 10];
const activeOffsetYResult = Gesture.Pan().maxPointers(1).activeOffsetY(items);
class V {
constructor() {
2026-07-23 10:11:24 +00:00
obj = { x: 0, y: outer1_3.get() };
result = outer1_4.set(obj);
result1 = outer1_2.set(true);
2026-07-20 16:05:17 +00:00
return;
}
}
let obj = { start, translatePos, isInteracting };
V.__closure = obj;
V.__workletHash = 12024094550213;
2026-07-23 10:11:24 +00:00
V.__initData = outer1_9;
2026-07-20 16:05:17 +00:00
const failOffsetXResult = Gesture.Pan().maxPointers(1).activeOffsetY(items).failOffsetX(items1);
class S {
constructor(arg0) {
({ velocityY, translationY } = arg0);
2026-07-23 10:11:24 +00:00
result = outer1_3.set(translationY + outer1_4.get().y);
result1 = outer1_1.set(velocityY);
2026-07-20 16:05:17 +00:00
return;
}
}
obj = { translatePos, start, velocity };
S.__closure = obj;
S.__workletHash = 9790035695747;
2026-07-23 10:11:24 +00:00
S.__initData = outer1_8;
2026-07-20 16:05:17 +00:00
const onStartResult = Gesture.Pan().maxPointers(1).activeOffsetY(items).failOffsetX(items1).onStart(V);
const fn = function w(arg0, fail) {
2026-07-23 10:11:24 +00:00
if (!outer1_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-07-23 10:11:24 +00:00
const obj1 = { enabled: closure_5 };
2026-07-20 16:05:17 +00:00
const onUpdateResult = Gesture.Pan().maxPointers(1).activeOffsetY(items).failOffsetX(items1).onStart(V).onUpdate(S);
const fn2 = function t() {
2026-07-23 10:11:24 +00:00
const result = outer1_2.set(false);
if (Math.abs(outer1_1.get()) > outer1_0) {
let obj = swipeVelocityThreshold(isInteracting[1]);
obj.runOnJS(outer1_6)();
} else if (0 !== outer1_3.get()) {
obj = { velocity: outer1_1.get() };
const merged = Object.assign(start);
const result1 = outer1_3.set(swipeVelocityThreshold(isInteracting[4]).withSpring(0, obj));
const obj2 = swipeVelocityThreshold(isInteracting[4]);
2026-07-20 16:05:17 +00:00
}
};
const onTouchesDownResult = Gesture.Pan().maxPointers(1).activeOffsetY(items).failOffsetX(items1).onStart(V).onUpdate(S).onTouchesDown(fn);
2026-07-23 10:11:24 +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-07-23 10:11:24 +00:00
fn2.__initData = closure_6;
2026-07-20 16:05:17 +00:00
return onTouchesDownResult.onEnd(fn2);
}, items);
2026-07-23 10:11:24 +00:00
let items1 = [callback];
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-07-20 16:05:17 +00:00
let closure_1 = [];
return {
panGestureGenerator(index) {
2026-07-23 10:11:24 +00:00
if (null != dependencyMap[index]) {
return dependencyMap[index];
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
dependencyMap[index] = outer1_7().blocksExternalGesture(closure_0);
return dependencyMap[index];
2026-07-20 16:05:17 +00:00
}
},
nativeGesture: NativeResult
};
}, items1);
};