MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / shellSize

Function shellSize

packages/client/src/features/viewport/viewportMath.ts:23–46  ·  view source on GitHub ↗
(
  deviceNaturalSize: Size | null,
  chromeProfile: ChromeProfile | null,
  rotationQuarterTurns = 0,
)

Source from the content-addressed store, hash-verified

21}
22
23export function shellSize(
24 deviceNaturalSize: Size | null,
25 chromeProfile: ChromeProfile | null,
26 rotationQuarterTurns = 0,
27): Size {
28 const naturalSize =
29 chromeProfile?.totalWidth && chromeProfile?.totalHeight
30 ? {
31 height: chromeProfile.totalHeight,
32 width: chromeProfile.totalWidth,
33 }
34 : (() => {
35 const aspectRatio = deviceNaturalSize
36 ? deviceNaturalSize.height / deviceNaturalSize.width
37 : 2.16;
38 const screenHeight = DEVICE_SCREEN_WIDTH * aspectRatio;
39 return {
40 height: screenHeight,
41 width: DEVICE_SCREEN_WIDTH,
42 };
43 })();
44
45 return rotateSize(naturalSize, rotationQuarterTurns);
46}
47
48export function buildShellRotationTransform(
49 deviceNaturalSize: Size | null,

Callers 5

AppShellFunction · 0.90
computeScaleFunction · 0.85
clampPanFunction · 0.85

Calls 1

rotateSizeFunction · 0.85

Tested by

no test coverage detected