Skip to content

Commit e0b9058

Browse files
committed
Fixes the Path tool snapping to the X or Y axis with Shift held for handles (#2969)
1 parent 57055e3 commit e0b9058

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

editor/src/messages/tool/tool_messages/path_tool.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,6 @@ impl PathToolData {
11491149
let drag_start = self.drag_start_pos;
11501150
let opposite_delta = drag_start - current_mouse;
11511151

1152-
shape_editor.move_selected_points_and_segments(None, document, opposite_delta, false, true, false, None, false, responses);
1153-
11541152
// Calculate the projected delta and shift the points along that delta
11551153
let delta = current_mouse - drag_start;
11561154
let axis = if delta.x.abs() >= delta.y.abs() { Axis::X } else { Axis::Y };
@@ -1161,7 +1159,8 @@ impl PathToolData {
11611159
_ => DVec2::new(delta.x, 0.),
11621160
};
11631161

1164-
shape_editor.move_selected_points_and_segments(None, document, projected_delta, false, true, false, None, false, responses);
1162+
// Apply the two deltas combined
1163+
shape_editor.move_selected_points_and_segments(None, document, opposite_delta + projected_delta, false, true, false, None, false, responses);
11651164
}
11661165

11671166
fn stop_snap_along_axis(&mut self, shape_editor: &mut ShapeState, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler, responses: &mut VecDeque<Message>) {
@@ -1177,12 +1176,11 @@ impl PathToolData {
11771176
_ => DVec2::new(opposite_delta.x, 0.),
11781177
};
11791178

1180-
shape_editor.move_selected_points_and_segments(None, document, opposite_projected_delta, false, true, false, None, false, responses);
1181-
11821179
// Calculate what actually would have been the original delta for the point, and apply that
11831180
let delta = current_mouse - drag_start;
11841181

1185-
shape_editor.move_selected_points_and_segments(None, document, delta, false, true, false, None, false, responses);
1182+
// Apply the two deltas combined
1183+
shape_editor.move_selected_points_and_segments(None, document, opposite_projected_delta + delta, false, true, false, None, false, responses);
11861184

11871185
self.snapping_axis = None;
11881186
}

0 commit comments

Comments
 (0)