LynxViewport
The page's size and the app window's, as signals that follow a phone folding or unfolding, a rotation and split screen. import { LynxViewport } from '@blotch/angular-lynx';
Usage
Lengths in %, vw, vh and rpx follow a new size without code: read these to change what's on the screen, not how big it is. See Adaptive layouts.
API
LynxViewport
Reads the sizes the host app sends in its global props, as Lynx's foldable guide describes. The apps ng build --platform makes send them, and send them again before Lynx lays the page out at a new size, so a template that reads them changes with the layout.
- A host that doesn't send them, such as Lynx Explorer, and the web preview still get a
widthandheightthat follow. They come from the window'sresizeevent, once Lynx has laid the page out at its new size.screenWidthandscreenHeightthen stay the screen's from when the page started. - All sizes are in CSS pixels: points on iOS, dp on Android.
LynxViewport.width and height
The page's size: the LynxView's. It's what 100vw, a page-wide 100% and an @media (width …) rule measure against.
- With
"edgeToEdge": falseinangular.json, it's the part of the window inside the safe area. - On Android, the height is shorter while the keyboard is open: the app makes room for it. On iOS the keyboard covers the page instead, and the height stays.
LynxViewport.screenWidth and screenHeight
The app window's size. 750rpx is its width.
- It's the window, not the display: an app sharing the screen in split screen gets its own part, and a folded phone gets its outer screen.
- A page in a dialog or a card of your own native app can be smaller than the window. Then the two pairs differ.
LynxViewport.orientation
'portrait' while the page is at least as tall as it's wide, otherwise 'landscape', as @media (orientation) decides. It's the page's shape, not the way the phone is held: an unfolded phone held upright, or an app in split screen, can be landscape.
Types
ViewportOrientation
Related
- Adaptive layouts
- System info: the screen's size when the page started
- Host data
