Skip to content

Commit 3f3ffbc

Browse files
leonardpauliKeavoncaleb-adotdaviesTrueDoctor
committed
Path Tool: Implement anchor point dragging (#451)
* #82 path-tool: WIP selecting control point working * Fix bug where duplication with Ctrl+D doesn't properly duplicate (#423) * bug fix: duplication didn't properly duplicate * cargo fmt * changed the formatting slightly for readability * Small cleanups, changed color of handles upon selection * Fix changes from merge * Remove duplicate anchor points on top of one another * Fix possible issues with thumbnails not being updated from Graphene operations * path-tool: attempt to move control points on click * Add dragging for control points * Editing shape anchors functional. Handles next. * Comment cleanup & slight cleanup of closest_anchor(..) * Removing conflict with master * Tiny code tweaks Co-authored-by: Keavon Chambers <[email protected]> Co-authored-by: caleb <[email protected]> Co-authored-by: otdavies <[email protected]> Co-authored-by: Dennis <[email protected]>
1 parent ddebadd commit 3f3ffbc

File tree

6 files changed

+351
-71
lines changed

6 files changed

+351
-71
lines changed

editor/src/document/document_file.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,15 @@ pub enum VectorManipulatorSegment {
5555

5656
#[derive(PartialEq, Clone, Debug)]
5757
pub struct VectorManipulatorShape {
58+
/// The path to the layer
59+
pub layer_path: Vec<LayerId>,
60+
/// The outline of the shape
5861
pub path: kurbo::BezPath,
62+
/// The control points / manipulator handles
5963
pub segments: Vec<VectorManipulatorSegment>,
64+
/// The compound Bezier curve is closed
65+
pub closed: bool,
66+
/// The transformation matrix to apply
6067
pub transform: DAffine2,
6168
}
6269

@@ -266,9 +273,11 @@ impl DocumentMessageHandler {
266273
.collect::<Vec<VectorManipulatorSegment>>();
267274

268275
Some(VectorManipulatorShape {
276+
layer_path: path_to_shape.to_vec(),
269277
path,
270278
segments,
271279
transform: viewport_transform,
280+
closed: shape.closed,
272281
})
273282
});
274283

editor/src/input/input_mapper.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ impl Default for Mapping {
186186
entry! {action=LineMessage::Abort, key_down=Rmb},
187187
entry! {action=LineMessage::Abort, key_down=KeyEscape},
188188
entry! {action=LineMessage::Redraw{center: KeyAlt, lock_angle: KeyControl, snap_angle: KeyShift}, triggers=[KeyAlt, KeyShift, KeyControl]},
189+
// Path
190+
entry! {action=PathMessage::DragStart, key_down=Lmb},
191+
entry! {action=PathMessage::PointerMove, message=InputMapperMessage::PointerMove},
192+
entry! {action=PathMessage::DragStop, key_up=Lmb},
189193
// Pen
190194
entry! {action=PenMessage::PointerMove, message=InputMapperMessage::PointerMove},
191195
entry! {action=PenMessage::DragStart, key_down=Lmb},

0 commit comments

Comments
 (0)