canZoom method
Checks if zooming to a specified level is possible.
Determines whether the map can be zoomed to the given zoomLevel
from its current state. This considers factors such as the current zoom
level, map constraints, and any active animations or gestures.
If a screenPosition is provided, checks if zooming while keeping that
screen point fixed is feasible. If no position is given, the check assumes
zooming centered on the current cursor position.
Parameters
zoomLevel: Target zoom level to checkscreenPosition: Screen coordinates in physical pixels to remain fixed during zoom, relative to the map view's top-left corner. Ifnull, uses the current cursor position. Defaults tonull
Returns
trueif zooming to the specified level is possible,falseotherwise
See also:
- setZoomLevel - Set the zoom level
zoomLevel- Get the current zoom level
Implementation
bool canZoom(int zoomLevel, {Point<int>? screenPosition}) {
final OperationResult resultString = objectMethod(
_pointerId,
'MapView',
'canZoom',
args: <String, Object>{
'zoomLevel': zoomLevel,
if (screenPosition != null) 'xy': XyType<int>.fromPoint(screenPosition),
},
);
return resultString['result'];
}