mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-27 20:06:53 -06:00
fix(pages): a second Delete after deleting layers keeps the page
After a click in the Pages list, layers selected since (Select all, say) took the first Delete, which left nothing selected, so a second Delete deleted the page. Delete that doesn't take the page now ends the Pages list's hold on the keyboard.
This commit is contained in:
@@ -175,7 +175,14 @@ fn selected_layers_or_a_canvas_press_take_delete_back_from_the_pages_list() {
|
||||
key(&mut u, Key::Delete, false);
|
||||
assert_eq!(pages(&u), 2);
|
||||
assert!(u.app.session.doc().unwrap().node(a).is_none());
|
||||
// Nothing is selected now, but the list gave up the keyboard: a second Delete keeps the page.
|
||||
assert!(u.app.ui.pages_focus.is_none());
|
||||
key(&mut u, Key::Delete, false);
|
||||
assert_eq!(pages(&u), 2, "a second Delete keeps the page");
|
||||
// A press on the canvas gives Delete back to it.
|
||||
u.button(row, true);
|
||||
u.button(row, false);
|
||||
assert!(u.app.ui.pages_focus.is_some());
|
||||
let p = pos2(900.0, 700.0);
|
||||
u.button(p, true);
|
||||
u.button(p, false);
|
||||
|
||||
@@ -124,6 +124,12 @@ pub fn invoke(app: &mut FigApp, id: &str) {
|
||||
crate::layers::delete_page(app, page);
|
||||
}
|
||||
}
|
||||
// Otherwise the list gives up the keyboard: once Delete has taken layers selected since the
|
||||
// click (Select all, say), a second Delete must not take the page.
|
||||
"edit.delete" if app.ui.pages_focus.is_some() => {
|
||||
app.ui.pages_focus = None;
|
||||
app.run(id, json!({}));
|
||||
}
|
||||
"file.open" => app.open_dialog(),
|
||||
"plugin.import" => crate::plugins_ui::import_dialog(app),
|
||||
"file.import" => app.import_dialog(false),
|
||||
|
||||
Reference in New Issue
Block a user