This leaflet plugin adds subpixel positioning methods for leaflet objects.
Compatible with the latest stable Leaflet version leaflet-1.5.
This plugin useful in webkit-based browsers. It is compatible but useless in Firefox, because it does not support displaying things with subpixels.
Add this line to your HTML file after Leaflet:
<script type="text/javascript" src="https://unpkg.com/[email protected]/index.js"></script>
Or you can use npm and es6 modules:
npm i leaflet l-subpixel-position --save
import 'leaflet';
import 'l-subpixel-position';
Then add can call setLatLngPrecise
method of your L.Marker
instances:
const myMarker = L.Marker([48.8567, 2.3508]).addTo(map);
...
myMarker.setLatLngPrecise(latlng)
Plugin adds setLatLngPrecise
method to L.Marker
:
Method | Returns | Description |
---|---|---|
setLatLngPrecise(< LatLng> latlng) |
this | Changes the marker position to the given point with subpixel accuracy. |
This method has the same behaviour as standard setLatLng
.
MIT