37 lines
943 B
TypeScript
37 lines
943 B
TypeScript
// Metro module 12322 (f12323).
|
|
import { flattenSource } from "./MediaSourceUtil";
|
|
export default function getMediaViewerStateForScreen(a0, a1, a2) {
|
|
const r20 = flattenSource(a2, true);
|
|
if (r20 == null) {
|
|
return {
|
|
maximumZoomScale: 1,
|
|
width: a0,
|
|
height: a1
|
|
};
|
|
}
|
|
const r22 = a0 / a1;
|
|
const r24 = r20.width / r20.height;
|
|
if (r20.width < a0 && r20.height < a1) {
|
|
const r59 = Math.min(0.5, (r24 > r22 ? r20.width / a0 : r20.height / a1) / 1.01);
|
|
return {
|
|
maximumZoomScale: r59 !== 0 ? 1 / r59 : 1,
|
|
width: r20.width,
|
|
height: r20.height
|
|
};
|
|
}
|
|
if (r24 > r22) {
|
|
const r36 = a0 / r20.width;
|
|
return {
|
|
maximumZoomScale: 1 / r36 + 1,
|
|
width: Math.floor(a0),
|
|
height: Math.floor(r20.height * r36)
|
|
};
|
|
}
|
|
const r14 = a1 / r20.height;
|
|
return {
|
|
maximumZoomScale: 1 / r14 + 1,
|
|
width: Math.floor(r20.width * r14),
|
|
height: Math.floor(a1)
|
|
};
|
|
};
|