Files
discord-decomp/modules/quests/native/QuestDock/QuestDockUtils.tsx
T
2026-11-01 12:12:55 +02:00

90 lines
4.8 KiB
TypeScript

// Metro module 14121 (f14122).
import { PixelRatio } from "react-native";
import { QUEST_DOCK_COLLAPSED_HEIGHT, QUEST_DOCK_COLLAPSED_MAX_WIDTH, QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED, QUEST_DOCK_MODE_CHANGE_PHYSICS } from "./QuestDockConstants";
import Durations from "../../../../utils/Durations";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
let c9882_7;
let c9882_6 = PixelRatio.get();
export function roundToNearestPixel(a0) {
return Math.round(a0 * c9882_6) / c9882_6;
}
roundToNearestPixel.__closure = {
PIXEL_DENSITY: c9882_6
};
roundToNearestPixel.__workletHash = 9602449563120;
roundToNearestPixel.__initData = {
code: "function roundToNearestPixel_QuestDockUtilsTsx1(position){const{PIXEL_DENSITY}=this.__closure;return Math.round(position*PIXEL_DENSITY)/PIXEL_DENSITY;}"
};
export function getQuestDockExpandedHeightLimits(a0, a1, a2) {
return {
minHeight: QUEST_DOCK_COLLAPSED_HEIGHT,
maxHeight: Math.min(a2, a0 - a1)
};
}
getQuestDockExpandedHeightLimits.__closure = {
QUEST_DOCK_COLLAPSED_HEIGHT
};
getQuestDockExpandedHeightLimits.__workletHash = 880847803554;
getQuestDockExpandedHeightLimits.__initData = {
code: "function getQuestDockExpandedHeightLimits_QuestDockUtilsTsx2(windowHeight,safeAreaTop,minContentHeight){const{QUEST_DOCK_COLLAPSED_HEIGHT}=this.__closure;return{minHeight:QUEST_DOCK_COLLAPSED_HEIGHT,maxHeight:Math.min(minContentHeight,windowHeight-safeAreaTop)};}"
};
export function getQuestDockCollapsedWidth(a0, a1, a2) {
return Math.min(a0 - Math.max(a1, QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED) - Math.max(a2, QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED), QUEST_DOCK_COLLAPSED_MAX_WIDTH);
}
getQuestDockCollapsedWidth.__closure = {
QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED,
QUEST_DOCK_COLLAPSED_MAX_WIDTH
};
getQuestDockCollapsedWidth.__workletHash = 1119343760780;
getQuestDockCollapsedWidth.__initData = {
code: "function getQuestDockCollapsedWidth_QuestDockUtilsTsx3(windowWidth,safeAreaLeft,safeAreaRight){const{QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED,QUEST_DOCK_COLLAPSED_MAX_WIDTH}=this.__closure;safeAreaLeft=Math.max(safeAreaLeft,QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED);safeAreaRight=Math.max(safeAreaRight,QUEST_DOCK_HORIZONTAL_EDGE_GUTTER_COLLAPSED);return Math.min(windowWidth-safeAreaLeft-safeAreaRight,QUEST_DOCK_COLLAPSED_MAX_WIDTH);}"
};
export function getQuestDockExpandedWidth(a0, a1, a2) {
return Math.min(a0 - a1 - a2, QUEST_DOCK_COLLAPSED_MAX_WIDTH);
}
getQuestDockExpandedWidth.__closure = {
QUEST_DOCK_COLLAPSED_MAX_WIDTH
};
getQuestDockExpandedWidth.__workletHash = 6480418564130;
getQuestDockExpandedWidth.__initData = {
code: "function getQuestDockExpandedWidth_QuestDockUtilsTsx4(windowWidth,safeAreaLeft,safeAreaRight){const{QUEST_DOCK_COLLAPSED_MAX_WIDTH}=this.__closure;return Math.min(windowWidth-safeAreaLeft-safeAreaRight,QUEST_DOCK_COLLAPSED_MAX_WIDTH);}"
};
export function getQuestDockClosedWidth(a0, a1, a2) {
return Math.min(a0 - a1 - a2, QUEST_DOCK_COLLAPSED_MAX_WIDTH);
}
getQuestDockClosedWidth.__closure = {
QUEST_DOCK_COLLAPSED_MAX_WIDTH
};
getQuestDockClosedWidth.__workletHash = 14159592925974;
getQuestDockClosedWidth.__initData = {
code: "function getQuestDockClosedWidth_QuestDockUtilsTsx5(windowWidth,safeAreaLeft,safeAreaRight){const{QUEST_DOCK_COLLAPSED_MAX_WIDTH}=this.__closure;return Math.min(windowWidth-safeAreaLeft-safeAreaRight,QUEST_DOCK_COLLAPSED_MAX_WIDTH);}"
};
c9882_7 = 3 * Durations.Millis.HOUR;
export function dimensionsLayoutTransition(a0) {
return {
initialValues: {
originX: a0.currentOriginX,
originY: a0.currentOriginY,
width: a0.currentWidth,
height: a0.currentHeight
},
animations: {
originX: _spring.withSpring(a0.targetOriginX, QUEST_DOCK_MODE_CHANGE_PHYSICS),
originY: _spring.withSpring(a0.targetOriginY, QUEST_DOCK_MODE_CHANGE_PHYSICS),
height: _spring.withSpring(a0.targetHeight, QUEST_DOCK_MODE_CHANGE_PHYSICS),
width: _spring.withSpring(a0.targetWidth, QUEST_DOCK_MODE_CHANGE_PHYSICS)
}
};
}
dimensionsLayoutTransition.__closure = {
withSpring: _spring.withSpring,
QUEST_DOCK_MODE_CHANGE_PHYSICS
};
dimensionsLayoutTransition.__workletHash = 4497154070776;
dimensionsLayoutTransition.__initData = {
code: "function dimensionsLayoutTransition_QuestDockUtilsTsx6(values){const{withSpring,QUEST_DOCK_MODE_CHANGE_PHYSICS}=this.__closure;return{initialValues:{originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight},animations:{originX:withSpring(values.targetOriginX,QUEST_DOCK_MODE_CHANGE_PHYSICS),originY:withSpring(values.targetOriginY,QUEST_DOCK_MODE_CHANGE_PHYSICS),height:withSpring(values.targetHeight,QUEST_DOCK_MODE_CHANGE_PHYSICS),width:withSpring(values.targetWidth,QUEST_DOCK_MODE_CHANGE_PHYSICS)}};}"
};
export function isSoftDismissed(a0) {
return a0 != null && Date.now() - a0 < c9882_7;
}