Make Leaflet's L.Popup movable(draggable) and draw leadline.
screen-recording-_1_.mov
- include the plugin file.
<script src="Leaflet.PopupMovable.js"></script>
- When create L.map object, add 'popupMovable' option and set true.
<script>
const map = new L.map('MapContainer', {
//set 'popupMovable' option true for enable this plugin.
popupMovable: true,
//(Recommended) this option make set false.
closePopupOnClick: false,
});
</script>
- (Required for Printing)
Add below CSSes for body or etc.
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
if not add, leads will draw for square.
- (Recommended)Disable autoclose option of L.Popup.
var popup = L.popup({
autoClose:false
});
- (Optional)Disable this plugin per popup.
var popup = L.popup({
popupmovable:false
});
- Method Disperses popups that are being displayed(only Marker binded Popup).
const pm = new L.Map.PopupMovable(Lmap);
pm.popupDispersion();
This code is provided under the MIT license.
This code uses "const declaration", "arrow function", "template literals" and "SVG". This Plugin dose not work in IE.