mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 16:33:22 -06:00
Auto-Collapse Iconic Panels: dialogs keep the panel, the dock doesn't (review of #488)
- A press inside a dialog the popped-out panel opened (Swatch Options from its menu, say), or on a modal dialog's backdrop, put the panel away under the dialog. The press now counts as away only when it lands on no foreground layer (the flyout itself, dialogs, palettes) and not on the modal backdrop (`dialogs::modal::backdrop`), as the popovers decide a click elsewhere. - A press in the expanded dock's panel group left the flyout open: only the icon column is spared now (its icons swap or close the flyout themselves), so a click in another docked panel puts it away, as a click anywhere else in the workspace does in the reference app. - The test covers a click in a dialog, on its backdrop and in the docked group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
948f696f52
commit
d728c47e6f
@@ -12,7 +12,8 @@ use crate::theme::{self, Tokens};
|
||||
/// should start with [`heading`] (or [`drag_band`]) so the window can be moved.
|
||||
pub(crate) fn show<R>(ctx: &egui::Context, title: &str, id: Id, nudge: f32, margin: i8, add: impl FnOnce(&mut egui::Ui) -> R) -> Option<R> {
|
||||
let t = Tokens::get(ctx);
|
||||
egui::Area::new(Id::new("modal-dim")).order(egui::Order::Middle).fixed_pos(egui::Pos2::ZERO).show(ctx, |ui| {
|
||||
let dim = backdrop();
|
||||
egui::Area::new(dim.id).order(dim.order).fixed_pos(egui::Pos2::ZERO).show(ctx, |ui| {
|
||||
// Modal, but the canvas isn't dimmed so previews stay readable (as in the reference app).
|
||||
ui.allocate_rect(ctx.content_rect(), egui::Sense::click());
|
||||
});
|
||||
@@ -28,6 +29,12 @@ pub(crate) fn show<R>(ctx: &egui::Context, title: &str, id: Id, nudge: f32, marg
|
||||
.and_then(|r| r.inner)
|
||||
}
|
||||
|
||||
/// The layer of the backdrop behind a modal dialog window, which takes the clicks the rest of
|
||||
/// the app would get.
|
||||
pub(crate) fn backdrop() -> egui::LayerId {
|
||||
egui::LayerId::new(egui::Order::Middle, Id::new("modal-dim"))
|
||||
}
|
||||
|
||||
/// The dialog's heading, which also moves the window ([`drag_band`]).
|
||||
pub(crate) fn heading(ui: &mut egui::Ui, text: &str) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
|
||||
Reference in New Issue
Block a user