1.0.1 • Published 3 years ago

leaflet-scalemarker v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

leaflet-scalemarker

Enables scaling of the marker icons in Leaflet

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

npm install leaflet-scalemarker

Usage

L.marker([52.229833, 21.011723], {
    scalingVector: 1.5
}).addTo(map);

API

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

OptionTypeDefaultDescription
scalingVectorNumber or String1Scaling vector as a scale CSS rule.
scalingOriginString'center bottom'The scaling center, as a transform-origin CSS rule.

and two new methods:

MethodReturnsDescription
setScalingVector(vector)thisSets the scaling vector value.
setScalingOrigin(origin)thisSets the scaling origin value.

The default scalingOrigin 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.

Demo

https://tomi77.github.io/leaflet-scalemarker/example.html