mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-30 18:24:11 +01:00
M7, #2512: Cmd/Ctrl+W closes a presentation tab
This commit is contained in:
1 parent
cce2e72d3e
commit
5e9c7f6ea4
3 files changed
+16
-3
No files matched your search
@@ -125,7 +125,9 @@ pub fn show(app: &mut FigApp, ui: &mut Ui) {
|
||||
choose_device(app, &mut pres, &device);
|
||||
}
|
||||
app.ui.present = Some(pres);
|
||||
if action == Some(BarAction::Close) || ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
|
||||
// Cmd/Ctrl+W closes the tab in front, a presentation tab as well as a file tab.
|
||||
let close_key = ctx.input_mut(|i| i.consume_key(egui::Modifiers::COMMAND, egui::Key::W));
|
||||
if action == Some(BarAction::Close) || close_key || ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
|
||||
if let Some(id) = app.ui.present_active {
|
||||
crate::tabs::close_present(app, id);
|
||||
} else {
|
||||
|
||||
@@ -191,3 +191,14 @@ fn renaming_the_file_or_the_page_renames_the_tab() {
|
||||
u.frame(vec![]);
|
||||
assert_eq!(tabs(&u)[0]["name"], "Playground - Calendar", "the names stay when the file closes");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmd_w_closes_the_presentation_tab_and_leaves_its_file_open() {
|
||||
let (mut u, a, ..) = setup();
|
||||
u.run("proto.present", json!({"start": a}));
|
||||
let k = |pressed| egui::Event::Key { key: Key::W, physical_key: None, pressed, repeat: false, modifiers: egui::Modifiers::COMMAND };
|
||||
u.frame(vec![egui::Event::PointerMoved(pos2(700.0, 500.0)), k(true), k(false)]);
|
||||
assert_eq!((presenting(&u), tabs(&u)), (false, json!([])));
|
||||
assert_eq!(u.app.session.docs.len(), 1, "the file stays open");
|
||||
assert!(!u.app.ui.home, "back to its file");
|
||||
}
|
||||
@@ -8,7 +8,7 @@ read from controllers on Windows and in the browser. Every rule of the public
|
||||
documentation on triggers, actions, overlays, animations, easing, scrolling and interactive
|
||||
components is a test case with what it implies (`crates/engine/src/proto_behaviour_tests.rs`, 7
|
||||
tests on the model, and `crates/ui-egui/src/present/behaviour_tests.rs`, 15 tests driving the
|
||||
player, 21 gestures among them; presentation tabs: `crates/ui-egui/src/present_tab_tests.rs`, 6
|
||||
player, 21 gestures among them; presentation tabs: `crates/ui-egui/src/present_tab_tests.rs`, 7
|
||||
tests; the tail: `crates/engine/src/proto_tail_tests.rs`, 4 tests, and
|
||||
`crates/ui-egui/src/present/tail_tests.rs`, 5 tests), and all pass. Not yet checked against
|
||||
larger real prototypes. Remaining: 2–5 h.
|
||||
@@ -58,7 +58,7 @@ tool; opt-in), **silent** (the documentation doesn't say; the case pins the curr
|
||||
| Change to: another variant of the instance, in place, with the interaction's animation | pass | `interactive_components_change_in_place` |
|
||||
| Interactive components: every instance plays the interactions of the variant it shows; an interaction on the instance with the same trigger wins | **fixed** | instances played only interactions copied onto them when they were placed: an instance placed before its main got interactions did nothing, and one placed after kept the first variant's interactions after changing (a toggle went on but never off). New instances no longer copy them, and copies in older files give way to the variant shown; `instances_play_their_variants_interactions` |
|
||||
| Drag a variant's (or a layer in it) connection onto a sibling variant: Change to, On click, Instant; the sibling is outlined | **fixed** | the drop only found top-level frames, and a variant's top-level frame is its set, so nothing happened. Dropped on the set's background or on its own variant it still adds nothing, also when the set sits in a group inside a section (the background used to give a Navigate to that section); on a frame outside the set it still navigates. Measured in Figma's web app, 2026-11-09; `a_variants_connection_dropped_on_a_sibling_variant_changes_to_it`, `the_reverse_connection_changes_back`, `a_layer_inside_a_variant_changes_its_set_to_the_sibling`, `dropped_on_the_sets_background_or_its_own_variant_it_adds_nothing`, `a_variant_dropped_on_a_frame_outside_the_set_still_navigates`, `in_a_grouped_set_the_background_adds_nothing_and_a_sibling_changes_to` |
|
||||
| Presentation tabs: one per page of a file, named "file - page" (renames follow). Play on a page that has a tab shows it as it was (from another start frame it starts again). Tabs keep their own copy of the prototype and play on after their file closes; a saved file opened again gets its tabs back. A tab never changes a file that isn't in front. Its X or Escape ends it and goes back to its file, or Home | **fixed** | one "Present" tab: a second presentation replaced the first, Play restarted it, and closing the file ended it; `present_tab_tests` |
|
||||
| Presentation tabs: one per page of a file, named "file - page" (renames follow). Play on a page that has a tab shows it as it was (from another start frame it starts again). Tabs keep their own copy of the prototype and play on after their file closes; a saved file opened again gets its tabs back. A tab never changes a file that isn't in front. Its X, Escape or Cmd/Ctrl+W ends it and goes back to its file, or Home (#2512) | **fixed** | one "Present" tab: a second presentation replaced the first, Play restarted it, and closing the file ended it; `present_tab_tests` |
|
||||
| Change to on a layer inside a nested instance changes the instance whose variant set holds the destination | **fixed** | the innermost instance (an icon inside a button) was changed instead |
|
||||
| Set variable, set variable mode, conditional | pass | `proto_run_tests`, `proto_conditional_tests`, `present_variables_tests` |
|
||||
| Change to, set variable and set variable mode lay out what they change as the canvas does: text sizes to what it shows, hugging frames around it | **fixed** | the player didn't lay out after them: an instance with a longer label changed to the main's width, and a bound text kept its old size; `change_to_lays_out_the_instance_around_its_own_content`, `set_variable_and_set_mode_lay_out_the_text_they_change` |
|
||||
|
||||
Reference in new issue
Block a user