mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Delete Anchor Point: Escape clears selected anchors, then the targeted path (#12773)
With the Delete Anchor Point tool, Escape with no running operation first clears anchors selected on the saved path targeted in the Paths panel, then deselects that path, so its outline and anchors go and a click deletes nothing. It waits while the path's name is typed in the Paths panel, where Escape cancels the rename. Full screen and a pixel selection still take Escape first; the Work Path and a layer's path keep today's Escape.
This commit is contained in:
1 parent
de9add28b2
commit
45b2b36433
3 files changed
+26
No files matched your search
@@ -913,6 +913,26 @@ fn handle_escape_and_view_keys(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Delete Anchor Point (#12773): Esc first clears anchors selected on the saved path targeted in
|
||||
// the Paths panel, then deselects that path, so clicks edit nothing. Not while its name is typed
|
||||
// in the panel: egui has already dropped the field's focus, and the panel cancels on Esc.
|
||||
if !esc_taken
|
||||
&& app.ui.tool == Tool::DeleteAnchorPoint
|
||||
&& !crate::vector_ui::path_renaming(app, ctx)
|
||||
&& let Some((index, _)) = crate::vector_ui::selected_saved_path_index(app)
|
||||
{
|
||||
let ds = &app.ui.direct_selection;
|
||||
let selected = ds.target == Some(crate::direct_select::PathRef::Saved(index)) && (!ds.anchors.is_empty() || ds.segment.is_some());
|
||||
if pressed(Key::Escape) {
|
||||
if selected {
|
||||
app.ui.direct_selection.anchors.clear();
|
||||
app.ui.direct_selection.segment = None;
|
||||
} else {
|
||||
app.ui.selected_path = None;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// + / − pick a Path Operation with the Pen tools and Path Selection (`path_components`)…
|
||||
crate::path_components::handle_keys(app, ctx);
|
||||
// … and otherwise ⇧+ / ⇧− step the blend mode and ⇧⌥ letters pick one (`blend_keys`). Before the
|
||||
|
||||
@@ -50,6 +50,7 @@ pub(crate) use path_ops::{
|
||||
};
|
||||
#[cfg(test)]
|
||||
use paths_panel::path_context_actions;
|
||||
pub(crate) use paths_panel::path_renaming;
|
||||
pub use paths_panel::{PathEntry, PathRow, path_rows, paths_footer, paths_panel};
|
||||
#[cfg(test)]
|
||||
pub(crate) use pen::over_first_anchor;
|
||||
|
||||
@@ -111,6 +111,11 @@ fn rename_id(doc: &Document) -> egui::Id {
|
||||
egui::Id::unique(("path-rename", doc.id.0))
|
||||
}
|
||||
|
||||
/// Is a path's name being typed in the active document's Paths panel? Esc belongs to its field.
|
||||
pub(crate) fn path_renaming(app: &PhotocraftApp, ctx: &egui::Context) -> bool {
|
||||
app.session.active().is_some_and(|st| ctx.data(|d| d.get_temp::<PathRename>(rename_id(&st.doc)).is_some()))
|
||||
}
|
||||
|
||||
/// Commands offered by a Paths row's context menu. The row's path is passed explicitly so a
|
||||
/// right-click acts on that row even when another path is selected in the panel. `layer` is the
|
||||
/// layer a `PathRow::Layer` row belongs to (the active layer).
|
||||
|
||||
Reference in new issue
Block a user