Leaflet.RotatedMarker

Leaflet plugin to enable the rotation of map marker icons

  • 所有者: bbecquet/Leaflet.RotatedMarker
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    1
      比较:

Github星跟踪图

Leaflet Rotated Marker

Enables rotation of marker icons in Leaflet. Demo

Compatible with versions 0.7.* and 1.* of Leaflet. Doesn't work on IE < 9.

npm install leaflet-rotatedmarker

Usage

L.marker([48.8631169, 2.3708919], {
    rotationAngle: 45
}).addTo(map);

API

It simply extends the L.Marker class with two new options:

Option, Type, Default, Description
-------, ------, ---------, ------------
rotationAngle, Number, Rotation angle, in degrees, clockwise.
rotationOrigin, String, 'bottom center', The rotation center, as a transform-origin CSS rule.

and two new methods:

Method, Returns, Description
-------, ---------, ------------
setRotationAngle(newAngle), this, Sets the rotation angle value.
setRotationOrigin(newOrigin), this, Sets the rotation origin value.

The default rotationOrigin value will rotate around the bottom center point, corresponding to the "tip" of the marker for most commonly used icons. If your marker icon has no tip, or you want to rotate around its center, use center center.

Note

On purpose, it doesn't rotate marker icon shadows. Mainly because there is no way to make it look good with the perspective of classic, pin type shadows (anyway, these shadows are so 2005, right?).

So just disable icon shadows, or use simple ones which will work for all marker angles.

主要指标

概览
名称与所有者bbecquet/Leaflet.RotatedMarker
主编程语言JavaScript
编程语言HTML (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2015-11-18 21:58:53
推送于2024-05-31 10:53:04
最后一次提交2018-05-21 17:59:51
发布数4
最新版本名称0.2.0 (发布于 )
第一版名称0.1.0 (发布于 )
用户参与
星数273
关注者数8
派生数104
提交数22
已启用问题?
问题数30
打开的问题数17
拉请求数4
打开的拉请求数7
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?