l-subpixel-position

This leaflet plugin adds subpixel positioning methods for leaflet objects.

Usage no npm install needed!

<script type="module">
  import lSubpixelPosition from 'https://cdn.skypack.dev/l-subpixel-position';
</script>

README

Leaflet Subpixel Position

This leaflet plugin adds subpixel positioning methods for leaflet objects.

Subpixel Demo

Demo

Compatibility with Leaflet Versions

Compatible with the latest stable Leaflet version leaflet-1.5.

Browser Compatibility

This plugin useful in webkit-based browsers. It is compatible but useless in Firefox, because it does not support displaying things with subpixels.

Usage

Add this line to your HTML file after Leaflet:

<script type="text/javascript" src="https://unpkg.com/l-subpixel-position@1.0.0/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)

API

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.

License

MIT