viewportF property
Retrieves the current viewport dimensions as ratios relative to the parent screen.
Returns a Rectangle<double> where values are expressed as ratios (0.0 to 1.0) relative to the parent screen dimensions. Unlike viewport which returns physical pixel measurements, this provides proportional measurements useful for responsive layouts and relative positioning.
For example, a Rectangle<double> with width 0.5 and height 0.5 indicates the map view occupies half the parent screen's width and height.
See also:
- viewport - Viewport in physical pixels
- viewportCenter - Center point in physical pixels
Implementation
Rectangle<double> get viewportF {
final OperationResult resultString = objectMethod(
_pointerId,
'MapView',
'getViewportF',
);
final Rectangle<double> rect = Rectangle<double>(
resultString['result']['x'] ?? 0,
resultString['result']['y'] ?? 0,
resultString['result']['width'] ?? 0,
resultString['result']['height'] ?? 0,
);
return rect;
}