ViewAreaChanged: function(sender, args);
sender. Event source.
args. Event information. Available arguments: ViewArea - map view area, IsEnd - indicates if the operation on view area change is canceled.
The ViewAreaChanged event occurs after changing the map view area.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Show the panel to change the scale on the map and process the event:
var miniMap = map.getMiniMap(); // Determine labels in the panel button corresponding to button functionality miniMap.getZoomInButton().setContent("+"); miniMap.getZoomOutButton().setContent("-"); miniMap.getResetButton().setContent("100%"); // Process the ViewAreaChanged event map.ViewAreaChanged.add(function (sender, args) { if (args.IsEnd) { var rect = args.ViewArea; console.log("Width coefficient: " + rect.getWidth()); console.log("Height coefficient: " + rect.getHeight()); }; });
After executing the example the panel used to change its scale is shown on the map. Labels corresponding to button functionality are shown in the panel buttons:
On map scaling with mouse wheel, the browser console displays the current map width and height coefficients:
Width coefficient: 3.575117818397847
Height coefficient: 1.707202993451824
See also: