Skip to content

Commit 41ee1cf

Browse files
0SlowPoke0Keavon
andauthored
Improve the Pen tool's colinearity and equidistance controls (#2242)
* basic implementation done now refactor * fixed overlays refactoring need to fix colinear(update it) * more_refactoring ,only toggle C for grs to be done(if required) * cleanup * cleanup * more formatting checks * refactoring alt fixed hints fixed * code-review-changes * path-tool-tab-fix * fixed bugs * some refactor * fixed ctrl_snap * added lock-overlays and fixed grs bug * Code review --------- Co-authored-by: Keavon Chambers <[email protected]>
1 parent 133d872 commit 41ee1cf

File tree

3 files changed

+353
-77
lines changed

3 files changed

+353
-77
lines changed

editor/src/messages/input_mapper/input_mappings.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub fn input_mappings() -> Mapping {
212212
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=PathToolMessage::DeleteAndBreakPath),
213213
entry!(KeyDown(Delete); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
214214
entry!(KeyDown(Backspace); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
215-
entry!(KeyDown(Tab); action_dispatch=PathToolMessage::SwapSelectedHandles),
215+
entry!(KeyDownNoRepeat(Tab); action_dispatch=PathToolMessage::SwapSelectedHandles),
216216
entry!(KeyDown(MouseLeft); action_dispatch=PathToolMessage::MouseDown { direct_insert_without_sliding: Control, extend_selection: Shift, lasso_select: Control }),
217217
entry!(KeyDown(MouseRight); action_dispatch=PathToolMessage::RightClick),
218218
entry!(KeyDown(Escape); action_dispatch=PathToolMessage::Escape),
@@ -254,7 +254,7 @@ pub fn input_mappings() -> Mapping {
254254
entry!(KeyDown(KeyJ); modifiers=[Accel], action_dispatch=ToolMessage::Path(PathToolMessage::ClosePath)),
255255
//
256256
// PenToolMessage
257-
entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=PenToolMessage::PointerMove { snap_angle: Shift, break_handle: Alt, lock_angle: Control}),
257+
entry!(PointerMove; refresh_keys=[Control, Alt, Shift, KeyC], action_dispatch=PenToolMessage::PointerMove { snap_angle: Shift, break_handle: Alt, lock_angle: Control, colinear: KeyC }),
258258
entry!(KeyDown(MouseLeft); action_dispatch=PenToolMessage::DragStart { append_to_selected: Shift }),
259259
entry!(KeyUp(MouseLeft); action_dispatch=PenToolMessage::DragStop),
260260
entry!(KeyDown(MouseRight); action_dispatch=PenToolMessage::Confirm),

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

+27-12
Original file line numberDiff line numberDiff line change
@@ -1185,16 +1185,9 @@ impl Fsm for PathToolFsmState {
11851185
.push(HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]));
11861186

11871187
let drag_anchor = HintInfo::keys([Key::Space], "Drag Anchor");
1188-
let point_select_state_hint_group = match dragging_state.point_select_state {
1189-
PointSelectState::HandleNoPair => {
1190-
let mut hints = vec![drag_anchor];
1191-
hints.push(HintInfo::keys([Key::Shift], "Snap 15°"));
1192-
hints.push(HintInfo::keys([Key::Control], "Lock Angle"));
1193-
hints
1194-
}
1195-
PointSelectState::HandleWithPair => {
1196-
let mut hints = vec![drag_anchor];
1197-
hints.push(HintInfo::keys([Key::Tab], "Swap Selected Handles"));
1188+
let toggle_group = match dragging_state.point_select_state {
1189+
PointSelectState::HandleNoPair | PointSelectState::HandleWithPair => {
1190+
let mut hints = vec![HintInfo::keys([Key::Tab], "Swap Selected Handles")];
11981191
hints.push(HintInfo::keys(
11991192
[Key::KeyC],
12001193
if colinear == ManipulatorAngle::Colinear {
@@ -1203,18 +1196,40 @@ impl Fsm for PathToolFsmState {
12031196
"Make Handles Colinear"
12041197
},
12051198
));
1199+
hints
1200+
}
1201+
PointSelectState::Anchor => Vec::new(),
1202+
};
1203+
let hold_group = match dragging_state.point_select_state {
1204+
PointSelectState::HandleNoPair => {
1205+
let mut hints = vec![];
12061206
if colinear != ManipulatorAngle::Free {
12071207
hints.push(HintInfo::keys([Key::Alt], "Equidistant Handles"));
12081208
}
12091209
hints.push(HintInfo::keys([Key::Shift], "Snap 15°"));
12101210
hints.push(HintInfo::keys([Key::Control], "Lock Angle"));
1211+
hints.push(drag_anchor);
1212+
hints
1213+
}
1214+
PointSelectState::HandleWithPair => {
1215+
let mut hints = vec![];
1216+
if colinear != ManipulatorAngle::Free {
1217+
hints.push(HintInfo::keys([Key::Alt], "Equidistant Handles"));
1218+
}
1219+
hints.push(HintInfo::keys([Key::Shift], "Snap 15°"));
1220+
hints.push(HintInfo::keys([Key::Control], "Lock Angle"));
1221+
hints.push(drag_anchor);
12111222
hints
12121223
}
12131224
PointSelectState::Anchor => Vec::new(),
12141225
};
12151226

1216-
if !point_select_state_hint_group.is_empty() {
1217-
dragging_hint_data.0.push(HintGroup(point_select_state_hint_group));
1227+
if !toggle_group.is_empty() {
1228+
dragging_hint_data.0.push(HintGroup(toggle_group));
1229+
}
1230+
1231+
if !hold_group.is_empty() {
1232+
dragging_hint_data.0.push(HintGroup(hold_group));
12181233
}
12191234

12201235
dragging_hint_data

0 commit comments

Comments
 (0)