biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
11 stars 16 forks source link

Snapping mode does not only snap #863

Open dlangenk opened 1 week ago

dlangenk commented 1 week ago

When activating snapping mode with Ctrl it would be great when it would only snap to 45° angles and wouldn't allow free annotation. If this is not possible a "harder" snap would also work.

mzur commented 1 week ago

Idea: Extend the OpenLayers Snap interaction and add a setPixelTolerance() method. Then dynamically set an increasing value based on the distance of the cursor to the reference point, so the temporary line always snaps to the reference lines.

dlangenk commented 1 week ago

You could also set the snapping to vertices to false and increase the tolerance. This works ... except for that the click interaction is not working as expected. You have to either double click or more or less exactly click on the endpoint of the LineString to be created. I guess this could be fixed by altering the method to create annotations by taking the lineString endpoint instead of the mousePoint as input. I pushed a branch ExclusiveSnap which implements vertices set to false.