美文网首页
Map 属性、方法、事件、其他

Map 属性、方法、事件、其他

作者: Look_a_Look | 来源:发表于2017-08-09 09:16 被阅读21次
属性 Option
preferCanvas:是否把Path渲染为canvas,默认是false,为SVG方式

attributionControl:是否显示右下角地图属性信息
zoomControl:是否显示缩放控件,默认显示

closePopupOnClick:点击地图空白区域是否自动关闭popup,默认是
zoomSnap:自由缩放后地图级别捕捉比例,默认1
zoomDelta:每次缩放级别间隔,默认是1
trackResize:地图大小是否自适应,默认是
boxZoom:是否可以按 shift和鼠标左键画矩形放大地图,默认可以
doubleClickZoom:是否可以双击放大地图,默认可以
dragging:是否可以拖动平移地图,默认可以

minZoom:最小缩放级别
maxZoom:最大缩放级别
renderer:矢量图层渲染方式,默认根据浏览器自动选择 L.canvas() 或 L.SVG()

worldCopyJump:无缝平移跳转,默认启用
方法 Method
addLayer:Adds the given layer to the map
removeLayer:Removes the given layer from the map.
project:Projects a geographical coordinate according to the projection of the map's CRS, then scales it according to zoom and the CRS's Transformation. The result is pixel coordinate relative to the CRS origin.
distance:Returns the distance between two geographical coordinates according to the map's CRS. By default this measures distance in meters.
remove:Destroys the map and clears all related event listeners.
事件 Event
load:Fired when the map is initialized (when its center and zoom are set for the first time).
click:Fired when the user clicks (or taps) the map.
mousemove:Fired while the mouse moves over the map.

addLayer:Adds the given layer to the map
其他 Misc

容器 panes
用来管理DOM元素在Map上的层级高度。可以通过map.getPane or map.getPanes获取。通过map.createPane创建新的pane。默认pane的z-index级别如下。

Pane           Type           Z-index           Description
mapPane     HTMLElement        'auto'   Pane that contains all other map panes
tilePane    HTMLElement         200     Pane for GridLayers and TileLayers
overlayPane HTMLElement         400     Pane for vector overlays (Paths), like Polylines and Polygons
shadowPane  HTMLElement         500     Pane for overlay shadows (e.g. Marker shadows)
markerPane  HTMLElement         600     Pane for Icons of Markers
tooltipPane HTMLElement         650     Pane for tooltip.
popupPane   HTMLElement         700     Pane for Popups.

相关文章

网友评论

      本文标题:Map 属性、方法、事件、其他

      本文链接:https://www.haomeiwen.com/subject/wtxjlxtx.html