LastHoveredItem: PP.MapArrowBase | PP.MapShape | PP.MapVisualItem;
The LastHoveredItem property determines an arrow, a map layer area or a factor under the mouse pointer.
Use JSON or the setLastHoveredItem method to set the property value and the getLastHoveredItem method to get the property value.
The property is read-only.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Process clicking of the mouse pointer over the map, by showing the name of map layer area to the browser console or the message about its absence under the pointer:
map.MouseDown.add(function(sender, args) { if(map.getLastHoveredItem()) { console.log("Name of the map layer area under mouse pointer: %s", map.getLastHoveredItem().getValue()); } else { console.log("Map layer area is absent under the mouse pointer"); } });
After executing the example after clicking on the map layer area, the name of it is shown:
Name of the map layer area under the mouse pointer: Krasnoyarsk region
After clicking on the empty area of the map layer area, corresponding message is displayed:
There is no map layer area under mouse pointer
Now add the following string before the first string of the MouseDown event handler:
map.clearLastHoveredItem();
After executing the example after clicking on the map layer area, information about the area will be deleted:
The map layer area is absent under the mouse pointer
See also: