[55]: Added snapping of drawing to other camps and fireroads#77
[55]: Added snapping of drawing to other camps and fireroads#77CarlWiren90 wants to merge 11 commits into
Conversation
I think this error causes something with saving not to fully work and when I try to delete the camp I get the delete bug you mentioned before.
|
Thanks for the checkup on these. I'll adress all of them and get back to you! I'll also adjust the rule to prevent a snap from reaching an overlap! |
|
@bobinush Hey! Fancy pulling down the latest changes and trying out the behaviour? Adressed the above issues where the first errors were caused by trying to access variables before initiation. To improve the snapping and overlapping towards both camps and fireroads there's added a small nudging to secure a small space to avoid overlaps. One can possibly still overlap a camp with the snapping, but it's harder to do so. |
This pull request introduces a comprehensive snapping feature for shape editing in the map editor, allowing points to snap to nearby targets (such as fireroads and other entities) within a configurable 2-meter distance. It also updates the user guide, improves internal handling of snap targets, and ensures fireroads are available as snap targets. The most important changes are grouped below:
Snapping Functionality and Configuration:
SNAP_DISTANCE_METERS(set to 2 meters) inSETTINGS.tsto control the snapping radius for editing shapes.metersToSnapPixelsinsrc/utils/snapDistance.tsto convert the snap distance from meters to screen pixels, ensuring consistent snapping behavior regardless of zoom level.src/editor/editor.tsto enable snapping when editing shapes, with options to snap to vertices and segments, and to exclude the entity being edited from snap targets.User Experience and Documentation:
public/drawers/guide-usage.html) to explain the new snapping behavior and how to disable it by holding ALT while drawing.Snap Target Management:
src/entities/entity.tsso that new entities and buffer layers are not ignored as snap targets by default, while buffer layers explicitly setsnapIgnore: true.Fireroads and GeoJSON Layers as Snap Targets:
src/loaders/loadGeoJsonFeatureCollections.tsandsrc/loaders/loadBaseLayers.tsto allow GeoJSON layers (specifically fireroads) to be exposed as snap targets using a newsnapTargetoption.