function handleClick() {
map.zoomIn();
}
map.on('click', handleClick);map.onCenterChanged(centerChangePost);
function centerChangePost() {
var center = map.getCenter();
alert( 'Lng:'+map.getCenter().lng+'\n'+'Lat:'+map.getCenter().lat);
}map.onHeadingChanged(headingChangePost);
function headingChangePost() {
alert('Heading Changed!')
}map.onZoomChanged(zoomChangePost);
function zoomChangePost() {
alert('Zoom Changed!')
}The following table describes map events. For details, please refer to HWMap Events.
| Event | Description | Usage |
|---|---|---|
| click | Click on the left button of the mouse once or more. | map.on('click', callback), where callback is a callback function. |
| singleclick | Click on the left button of the mouse once. | map.on('singleclick', callback), where callback is a callback function. |
| dblclick | Double-click on the left button of the mouse. | map.on('dblclick', callback), where callback is a callback function. |
| contextmenu | Click on the right button of the mouse. | map.on('contextmenu', callback), where callback is a callback function. |
| pointermove | Moving of the mouse pointer. | map.on('pointermove', callback), where callback is a callback function. |
| pointerdown | Mouse button press. | map.on('pointerdown', callback), where callback is a callback function. |
| pointerup | Mouse button release. | map.on('pointerup', callback), where callback is a callback function. |
| pointerdrag | Map dragging. | map.on('pointerdrag', callback), where callback is a callback function. |
| movestart | Map moving start. | map.on('movestart', callback), where callback is a callback function. |
| moveend | Map moving stop. | map.on('moveend', callback), where callback is a callback function. |
| onCenterChanged | Map center change. | map.onCenterChanged(callback), where callback is a callback function. |
| onHeadingChanged | Map heading change. | map.onHeadingChanged(callback), where callback is a callback function. |
| onZoomChanged | Map zoom level change. | map.onZoomChanged(callback), where callback is a callback function. |