添加地图监听事件
使用方法 map.on
map.on(type, layerIds, listener)
例如
map.on('mouseup', onMouseup);function onMouseup(e) {// mouseupconsole.log(e.type);
}
取消地图监听事件
使用方法 map.off
map.off(type, layerIds, listener)
例如:
map.off('mouseup', onMouseup);
事件类型
map-events
resize
remove
交互事件
events-interaction
mousedown
mouseup
mouseover
mousemove
preclick
click
dblclick
mouseenter
mouseleave
mouseout
contextmenu
wheel
touchstart
touchend
touchmove
touchcancel
移动事件
events-movement
movestart
move
moveend
dragstart
drag
dragend
zoomstart
zoom
zoomend
rotatestart
rotate
rotateend
pitchstart
pitch
pitchend
boxzoomstart
boxzoomend
boxzoomcancel
生命周期事件
events-lifecycle
load
render
idle
error
webglcontextlost
webglcontextrestored
数据加载事件
events-data-loading
data
styledata
sourcedata
dataloading
styledataloading
sourcedataloading
styleimagemissing
style.load