55 lines
2.9 KiB
TypeScript
55 lines
2.9 KiB
TypeScript
// Metro module 15846 (f15847).
|
|
import { OrientationLockState } from "../../../Constants";
|
|
import { LANDSCAPE_ACTIVITY_ASPECT_RATIO } from "../../ActivityPanelConstants";
|
|
import roundToNearestPixel from "../../../../voice_panel/native/utils/roundToNearestPixel";
|
|
const t = function t(a0) {
|
|
let marginLeft, marginTop, shouldHorizontallyCenter, shouldVerticallyCenter, width;
|
|
const pipWidth = a0.pipWidth;
|
|
let pipHeight = a0.pipHeight;
|
|
let pipOrientationLockState = a0.pipOrientationLockState;
|
|
const isLandscape = a0.isLandscape;
|
|
if (pipOrientationLockState == null) {
|
|
pipOrientationLockState = OrientationLockState.UNLOCKED;
|
|
}
|
|
L7: {
|
|
L6: {
|
|
if (pipOrientationLockState !== OrientationLockState.PORTRAIT) {
|
|
if (pipOrientationLockState === OrientationLockState.UNLOCKED && !isLandscape) {
|
|
break L6;
|
|
}
|
|
width = pipHeight * LANDSCAPE_ACTIVITY_ASPECT_RATIO;
|
|
marginLeft = -1 * roundToNearestPixel(width / 2);
|
|
marginTop = 0;
|
|
shouldVerticallyCenter = false;
|
|
shouldHorizontallyCenter = true;
|
|
break L7;
|
|
}
|
|
}
|
|
const r31 = pipWidth * LANDSCAPE_ACTIVITY_ASPECT_RATIO;
|
|
marginTop = -1 * roundToNearestPixel(r31 / 2);
|
|
marginLeft = 0;
|
|
shouldVerticallyCenter = true;
|
|
shouldHorizontallyCenter = false;
|
|
pipHeight = r31;
|
|
width = pipWidth;
|
|
}
|
|
return {
|
|
width,
|
|
height: pipHeight,
|
|
shouldHorizontallyCenter,
|
|
shouldVerticallyCenter,
|
|
marginLeft,
|
|
marginTop
|
|
};
|
|
};
|
|
t.__closure = {
|
|
OrientationLockState,
|
|
LANDSCAPE_ACTIVITY_ASPECT_RATIO,
|
|
roundToNearestPixel
|
|
};
|
|
t.__workletHash = 7141745103186;
|
|
t.__initData = {
|
|
code: "function getActivityContainerPipStylesSpec_getActivityContainerPIPStylesSpecTsx1({pipWidth:pipWidth,pipHeight:pipHeight,pipOrientationLockState:pipOrientationLockState,isLandscape:isLandscape}){const{OrientationLockState,LANDSCAPE_ACTIVITY_ASPECT_RATIO,roundToNearestPixel}=this.__closure;const nonNullPipOrientationLockState=pipOrientationLockState!==null&&pipOrientationLockState!==void 0?pipOrientationLockState:OrientationLockState.UNLOCKED;const shouldUsePortraitAspectRatio=nonNullPipOrientationLockState===OrientationLockState.PORTRAIT||nonNullPipOrientationLockState===OrientationLockState.UNLOCKED&&!isLandscape;let width=pipWidth;let height=pipHeight;let shouldHorizontallyCenter=false;let shouldVerticallyCenter=false;let marginLeft=0;let marginTop=0;if(shouldUsePortraitAspectRatio){width=pipWidth;height=width*LANDSCAPE_ACTIVITY_ASPECT_RATIO;shouldVerticallyCenter=true;marginTop=roundToNearestPixel(height/2)*-1;}else{height=pipHeight;width=height*LANDSCAPE_ACTIVITY_ASPECT_RATIO;shouldHorizontallyCenter=true;marginLeft=roundToNearestPixel(width/2)*-1;}return{width:width,height:height,shouldHorizontallyCenter:shouldHorizontallyCenter,shouldVerticallyCenter:shouldVerticallyCenter,marginLeft:marginLeft,marginTop:marginTop};}"
|
|
};
|
|
export default t;
|