Search
MapView.click Event
See Also
 






Raised when the user clicks on the map surface.

Namespace: MindFusion.Mapping
File: MapView.js

 Syntax

JavaScript  Copy Code

EventDispatcher click

 Event Data

The event handler method receives the following arguments:
sender
A MapView instance, which is the source of the event. This object will be passed to the handler function as the first argument.
args
A MapEventArgs instance, which contains event data. This object will be passed to the handler function as the second argument.

 Example

The following code handles the click event of a MapView and checks if the user has clicked on a Marker. If yes - renders it:

JavaScript  Copy Code


var m = MindFusion.Mapping;

// create a new instance of the mapView
var view = new m.MapView(document.getElementById("mapView"));
view.theme = "light";

var markers = new m.DecorationLayer("Images");

// create some markers with images
var mark = new m.Marker(new m.LatLong(-22.951916, -43.210487));
mark.imageSrc = "./images/christ_redeemer.png";
mark.text = "Christ the Redeemer";
mark.visible = false;
markers.decorations.add(mark);

view.layers.add(markers);

view.click.addEventListener(mapViewClickHandler);

function mapViewClickHandler( sender, args )
{
     
      if(mark.location == args.location)
          mark.visible = true;
}

 See Also