mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 00:08:12 +08:00
Add Pen Tool (#536)
* First steps toward pen tool, similar to spline tool currently. * Broken WIP * Progress, but still glitchy * Improvements, a little farther * Pen tool functioning as expected * Merged master * Fixed commit bug and overlay flashing * Reordered import statements TODO: Resolve issue with last segment losing its handle position on confirm
This commit is contained in:
committed by
Keavon Chambers
parent
6ff7c22d1d
commit
45d41b1bd7
@@ -94,6 +94,8 @@ impl Default for PathToolFsmState {
|
||||
struct PathToolData {
|
||||
shape_editor: ShapeEditor,
|
||||
snap_handler: SnapHandler,
|
||||
|
||||
drag_start_pos: DVec2,
|
||||
alt_debounce: bool,
|
||||
shift_debounce: bool,
|
||||
}
|
||||
@@ -151,6 +153,7 @@ impl Fsm for PathToolFsmState {
|
||||
.map(|point| point.position)
|
||||
.collect();
|
||||
data.snap_handler.add_snap_points(document, snap_points);
|
||||
data.drag_start_pos = input.mouse.position;
|
||||
Dragging
|
||||
}
|
||||
// We didn't find a point nearby, so consider selecting the nearest shape instead
|
||||
@@ -207,7 +210,7 @@ impl Fsm for PathToolFsmState {
|
||||
|
||||
// Move the selected points by the mouse position
|
||||
let snapped_position = data.snap_handler.snap_position(responses, input.viewport_bounds.size(), document, input.mouse.position);
|
||||
data.shape_editor.move_selected_points(snapped_position, responses);
|
||||
data.shape_editor.move_selected_points(snapped_position - data.drag_start_pos, true, responses);
|
||||
Dragging
|
||||
}
|
||||
// Mouse up
|
||||
|
||||
Reference in New Issue
Block a user