MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getTouchScreen

Function getTouchScreen

packages/react-aria/src/utils/keyboard.tsx:124–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122}
123
124function getTouchScreen(): TouchScreen {
125 // Normalize the screen by any scaling to get the layout coordinate space.
126 let screenWidth = Number(window.visualViewport?.width ?? window.innerWidth);
127 let screenHeight = Number(window.visualViewport?.height ?? window.innerHeight);
128 let visualScale = Number(window.visualViewport?.scale ?? 1);
129
130 return {
131 width: screenWidth * visualScale,
132 height: screenHeight * visualScale,
133 angle: window.screen.orientation?.angle ?? 0
134 };
135}
136
137function onResizeStart(e: Event): void {
138 // So we don't constantly call clearTimeout and setTimeout, keep track of the

Callers 4

onResizeEndFunction · 0.85
onOrientationChangeFunction · 0.85
onFocusFunction · 0.85
setupGlobalEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected