highlightHoveredMapLabel method
Highlights a map label at the specified screen coordinates.
Detects and highlights any map label (street name, landmark name, etc.) at the given screen position. This is useful for implementing hover effects or tooltips when the user interacts with map labels.
To disable the hover highlight, call this method with screen position (0, 0).
Recommended implementation pattern:
- Call with
selectMapObject = falseto check if a label is hovered (for cursor shape updates or preliminary checks) - If the cursor is stationary for a reasonable period (e.g., 500ms), call
again with
selectMapObject = trueto retrieve full map object data
Parameters
screenPosition: The screen coordinates in physical pixels to check for hovered labels, relative to the map view's top-left cornerselectMapObject: Iftrueand a label is hovered, map objects attached to the label are returned via GemMapController.registerOnHoveredMapLabelHighlightedLandmark. Iffalse, no callback is issued. Defaults tofalse
Returns
- GemError.success if a label was successfully highlighted
- GemError.notFound if no label was found at the screen position
- GemError.activation if the map is invalid or not initialized
- GemError.noMemory if memory allocation failed for the highlighted object
- GemError.inUse if another highlighting operation is in progress
- Other GemError codes for additional error conditions
See also:
- setCursorScreenPosition - Set cursor position for map selection
Implementation
GemError highlightHoveredMapLabel(
final Point<int> screenPosition, {
final bool selectMapObject = false,
}) {
final OperationResult resultString = objectMethod(
_pointerId,
'MapView',
'highlightHoveredMapLabel',
args: <String, Object>{
'pt': XyType<int>.fromPoint(screenPosition),
'selectMapObjects': selectMapObject,
},
);
return GemErrorExtension.fromCode(resultString['result']);
}