Reproduction
New document
Draw rectangle
Use the gradient tool to draw a gradient
Press Ctrl or Shift to lock the angle
Observe how the snapping to the rectangle no longer occurs and any old overlays get stuck until finishing the drag
Video
gradient_no_constrained_snapping.mp4
Relevant code
The line tool uses SnapConstraint::Line to snap when constrained to an angle:
if constrained {
let constraint = SnapConstraint :: Line {
origin : document_points[ 0 ] ,
direction : document_points[ 1 ] - document_points[ 0 ] ,
} ;
if center {
let snapped = snap. constrained_snap ( & snap_data, & near_point, constraint, config) ;
let snapped_far = snap. constrained_snap ( & snap_data, & far_point, constraint, config) ;
The gradient tool completely ignores snapping when an angle constraint exists:
pub fn update_gradient (
& mut self ,
mut mouse : DVec2 ,
responses : & mut VecDeque < Message > ,
snap_rotate : bool ,
lock_angle : bool ,
gradient_form : GradientForm ,
drag_start : DVec2 ,
snap_data : SnapData ,
snap_manager : & mut SnapManager ,
gradient_angle : & mut f64 ,
) {
if ( lock_angle || snap_rotate) && matches ! ( self . dragging, GradientDragTarget :: End | GradientDragTarget :: Start | GradientDragTarget :: New ) {
Reproduction
Video
gradient_no_constrained_snapping.mp4
Relevant code
The line tool uses
SnapConstraint::Lineto snap when constrained to an angle:Graphite/editor/src/messages/tool/common_functionality/shapes/line_shape.rs
Lines 157 to 164 in f7562b6
The gradient tool completely ignores snapping when an angle constraint exists:
Graphite/editor/src/messages/tool/tool_messages/gradient_tool.rs
Lines 599 to 610 in f7562b6
Graphite/editor/src/messages/tool/tool_messages/gradient_tool.rs
Line 631 in f7562b6