Constrain segment molding to the X or Y axis while holding Shift

JA
5h ago
+42-3

feat : snapping bezier segment to x or y axis with with center at t =0.5

This pr is the implementation of the feature requested in issue https://github.com/GraphiteEditor/Graphite/issues/3760

Logic used :

IF snap_key_pressed:
mid = to_viewport(bezier.eval(0.5))
molding_snap_origin = mid
delta = mouse - mid
axis = X if |delta.x| >= |delta.y| else Y
mouse = (mouse.x, mid.y) if axis == X else (mid.x, mouse.y)
ELSE:
axis = None
molding_snap_origin = None
mouse = mouse

IF axis != None:
origin = molding_snap_origin ?? drag_start
draw X-line / Y-line through origin

https://github.com/user-attachments/assets/6528553e-1f59-4df2-bfee-be875914a408