biigle / core

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

Implement snap interaction #793

Closed lehecht closed 1 month ago

lehecht commented 3 months ago

Implements snap interaction to enable creating shapes in different 45° angles.

To activate snapping during drawing, the control key needs to be pressed.

mzur commented 3 months ago

Resolves #252

lehecht commented 3 months ago

@mzur I noticed that the snapping not only occurs for the guidlines but also for other annotations. Is this a problem that needs to be fixed?

mzur commented 3 months ago

I noticed that the snapping not only occurs for the guidlines but also for other annotations. Is this a problem that needs to be fixed?

Yes. You can use the source option of the snap interaction to control this.

lehecht commented 3 months ago

@mzur Is there a reason why you declared this function not as vue-method? I'm currently fixing a bug and the solution could be either to make this function a vue-method, in order to change a data property there, or to use a separate shift-key-event listener in the created method.

mzur commented 3 months ago

Is there a reason why you declared this function not as vue-method?

Only that there was no need for it before. You can implement it as a Vue method, too.

lehecht commented 3 months ago

Note: My last bug fix only works when biigle/openlayers#5 is merged.

lehecht commented 1 month ago

@mzur

It seems like I have to press Ctrl before drawing the first point of the annotation to enable this feature. Can you change this so I can press the key anytime (even after the first point) and the feature is enabled?

I don't know exactly what you mean. When I create the first point and press Ctrl afterwards, I can use the tool without problems. But I need to say that the old and smaller pixelTolerance made it a bit more difficult to distinguish if that tool was active or not.

mzur commented 1 month ago

When I create the first point and press Ctrl afterwards, I can use the tool without problems.

You are right. Maybe I didn't notice the snapping for some reason...

Can you please also add something to the keyboard shortcuts manual articles (image and video)? Then I'll do my final review but everything looks good so far!

mzur commented 1 month ago

Here is also a follow-up issue: https://github.com/biigle/core/issues/836