UseSelectOnClick: Boolean;
The UseSelectOnClick property determines if map layer area can be selected when it is chosen with mouse cursor.
Property value can be set from JSON or using the setUseSelectOnClick method.
The property is set to True if map layer area can be selected when it is chosen with mouse cursor, otherwise the property is False.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Process the ItemSelecting and ItemSelected events, displaying into the browser console the identifier of selecting map layer area and name of selected map layer area correspondingly:
// Enable to chose map layer areas on clicking by mouse pointer map.setUseSelectOnClick(true); // Process the ItemSelecting event map.ItemSelecting.add(function (sender, args) { console.log("ID of selecting area: " + args.ItemId); }); // Process the ItemSelecting event map.ItemSelected.add(function (sender, args) { //Get map layer area by ID var shape = map.getShape(args.ItemId); console.log("Name of selected area: " + shape.getValue()); });
Select the following regions in the map of Russia using mouse pointer: Krasnoyarsk region and Sakha. After that the browser console displays identifiers of the map layer areas being selected and names of selected map layer areas:
Identifier of the area to select: RU-KYA
Name of the selected area: Krasnoyarsk region
Identifier of the area to select: RU-SA
Name of selected area: Sakha
See also: