googlefonts / fontra

A browser-based font editor
https://fontra.xyz
GNU General Public License v3.0
425 stars 19 forks source link

Fixing winding direction of shape tool contour #1472

Closed ollimeier closed 2 weeks ago

ollimeier commented 2 weeks ago

Fixes #1455

I tested it with the rectangle as well as with the circle + ctrlKey. The 'default' winding direction is counter clockwise.

justvanrossum commented 2 weeks ago

An better solution would be to do

    mouseRect = rectangle.normalizeRect(rectangle.roundRect({ ... }))`

At line 53. This fixes the problem right at the source, and avoids having to possibly reverse twice in the case of ctrlKey.

It could be that this makes the default winding direction the opposite to what it is now. But that could be fixed by inverting the ctrlKey reverse logic.

ollimeier commented 2 weeks ago

An better solution would be to do

    mouseRect = rectangle.normalizeRect(rectangle.roundRect({ ... }))`

At line 53. This fixes the problem right at the source, and avoids having to possibly reverse twice in the case of ctrlKey.

It could be that this makes the default winding direction the opposite to what it is now. But that could be fixed by inverting the ctrlKey reverse logic.

OK, works well. But in that case, the starting point is always at the same position (left bottom corner). I liked that you can have control over the starting point depending where you start dragging. But that's probably just me???

ollimeier commented 2 weeks ago

@justvanrossum The proposed change causes some negative side effects to other functionalities like 'from center' or 'square'. Is there something I do wrong? Or should I rework other parts as well? Please see the following screen recording:

https://github.com/googlefonts/fontra/assets/21055547/6633c39a-baca-4e61-8680-cc91c7fe2e73

justvanrossum commented 2 weeks ago

I liked that you can have control over the starting point depending where you start dragging.

You are entirely right, I didn't think of that. Forget my suggestion: your solution is good as it is.

ollimeier commented 2 weeks ago

I liked that you can have control over the starting point depending where you start dragging.

You are entirely right, I didn't think of that. Forget my suggestion: your solution is good as it is.

Is this an approval? May I merge it?