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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?