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 selection of map layer areas on click map.setUseSelectOnClick(true); // Handle the ItemSelecting event map.ItemSelecting.add(function (sender, args) { console.log("Identifier of selected area: " + args.ItemId); }); // Handle the ItemSelecting event map.ItemSelected.add(function (sender, args) { // Get map layer area by identifier 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: