Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
leaflet-snap
Advanced tools
Enables snapping of draggable markers to polylines and other layers !
Check out the demo !
It depends on Leaflet.GeometryUtil.
For snapping on shape drawing or edition snapping, it also depends on Leaflet.draw.
If your guide layer contains several thousands for features, adding the LayerIndex is recommended, this plugin takes advantage of the spatial index if it is available.
leaflet.snap.js
and leaflet.geometryutil.js
(optionally leaflet.draw.js
)
var guideLayer = ...;
var marker = L.marker([48.488, 1.395]).addTo(map);
marker.snapediting = new L.Handler.MarkerSnap(map, marker);
marker.snapediting.addGuideLayer(guideLayer);
marker.snapediting.enable();
var guideLayers = [guides, road];
map.drawControl.setDrawingOptions({
polyline: { guideLayers: guideLayers },
polygon: { guideLayers: guideLayers, snapDistance: 5 },
});
var polyline = L.polyline(...).addTo(map);
polyline.snapediting = new L.Handler.PolylineSnap(map, polyline);
polyline.snapediting.addGuideLayer(guideLayer);
polyline.snapediting.enable();
Both L.Handler.MarkerSnap
and L.Handler.PolylineSnap
accept options as a third
argument.
L.EditToolbar.SnapEdit is an extension of L.EditToolbar.Edit in Leaflet.draw.
var polyline = L.polyline(...).addTo(map);
var editToolbar = new L.EditToolbar.SnapEdit(map, {
featureGroup: L.featureGroup([polyline]),
snapOptions: {
guideLayers: [guideLayer]
}
});
editToolbar.enable();
L.EditToolbar.SnapEdit
accepts options and initial guide layers.
snapDistance : (default 15) distance in pixels where snapping occurs
snapVertices : (default true) whether layers vertices add additional snap attraction
snap ( layer, latlng ) : fired when snapped to layer
at latlng
unsnap ( layer ) : fired when unsnapped from layer
FAQs
Enable snapping between layers
The npm package leaflet-snap receives a total of 621 weekly downloads. As such, leaflet-snap popularity was classified as not popular.
We found that leaflet-snap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.