checkObjectVisibility method
- MapSceneObject? mapSceneObject,
- Rectangle<
int> ? rect,
Checks if a map scene object is visible within a specified viewport rectangle.
Determines whether the given MapSceneObject appears within the bounds of the specified screen rectangle. This performs a geometric bounds check only and does not consider the object's visibility settings or whether it is actually rendered on screen.
If no rectangle is provided, checks visibility against the entire screen. If no scene object is provided, uses the default position tracker.
Parameters
mapSceneObject: The map scene object to test for visibility. Ifnull, uses the default position tracker. Defaults tonullrect: Viewport rectangle in physical pixels for visibility testing, relative to the map view's top-left corner. Ifnull, uses the entire screen. Defaults tonull
Returns
trueif the scene object's bounds intersect with the specified viewport,falseotherwise
See also:
- MapSceneObject - Map scene objects that can be tested for visibility
- viewport - Current viewport rectangle
Implementation
bool checkObjectVisibility({
MapSceneObject? mapSceneObject,
Rectangle<int>? rect,
}) {
rect ??= const Rectangle<int>(0, 0, 0, 0);
mapSceneObject ??= MapSceneObject.getDefPositionTracker();
final OperationResult resultString = objectMethod(
_pointerId,
'MapView',
'checkObjectVisibility',
args: <String, dynamic>{
'obj': mapSceneObject.pointerId,
'rc': RectType<int>.fromRectangle(rect),
},
);
return resultString['result'];
}