The mapping library raises many events that let you know the actions the user has performed on the map or the state of the map. The MapView control raises events that notify that all its layers are loaded - layerLoad or that the component itself is loaded and ready for interaction - viewLoad.
You handle any event by wiring a delegate using the addEventListener method this way:
JavaScript Copy Code |
---|
var m = MindFusion.Mapping; // create a new instance of the mapView var l = new m.MapLayer("Streets"); |
The decorationClick event lets you know when the user has clicked on a Decoration while decorationHover is raised when they move the mouse over a Decoration. The click event is raised when the user clicks enywhere on a MapView, not just over a Decoration.
The decorations and layers properties of the MapView are of type ObservableCollection. Each ObservableCollection raises events when it's been changing or has changed. These are collectionChanging and collectionChanged. The collectionChanging event lets you cancel the action:
JavaScript Copy Code |
---|
var m = MindFusion.Mapping; var markers = new m.DecorationLayer("Images"); |