Clicks and the pointer

The pointer is the mouse. All places below are Coordinates in the map’s native space: scene positions on a baked map, longitude and latitude on a real-world map.

React to a click

map.Clicked += at => agent.SetDestination(at.ToVector3());

Clicked fires on a left click anywhere on the map. A drag is not a click.

Where is the mouse

MapCoordinate? mouse = map.PointerPosition;        // null when the mouse is off the map
map.PointerMoved += at => cursorLabel.text = at.ToString();

Between the map and the screen

MapCoordinate? place = map.ScreenToMap(screenPosition);       // null if off the map
Vector2? pixel = map.MapToScreen(chest.position);              // to put a UI element on top

Screen positions are in pixels from the bottom-left corner. All these methods return null before the map is loaded. PointToMap(x, y) and MapToPoint(place) do the same in UI points from the top-left corner of the map, which is what layer events give you.

Click on a marker

Markers from Put a marker on the map are drawn in layers listed in MapView.AnnotationLayers. Listen to clicks on them:

using RustyAstroboy.Worldprint.Interaction;

map.On(LayerEventType.Click, MapView.AnnotationLayers, e =>
    Debug.Log("Marker " + System.Convert.ToInt32(e.Features[0].Id)));

The feature id is the id returned by AddPoint, AddLine or AddPolygon. A click on a marker also raises Clicked.

Other events (MouseEnter, MouseLeave, MouseMove) and reading what is drawn under a point are in Advanced: queries, styles and editing.