* claim: #9016 Co-authored-by: Cursor <cursoragent@cursor.com> * UI: keep Distance entry under Preferences and Report a bug (#9016) Canvas value boxes used Foreground order, so they covered system windows. Draw them as Background chrome instead. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
988caa83fc
commit
18b00a4192
3 files changed
+35
-6
No files matched your search
@@ -857,7 +857,9 @@ fn value_box_full(
|
||||
at
|
||||
};
|
||||
let mut field = None;
|
||||
Container::new(ui.ctx(), Surface::Canvas).area(area).fixed_pos(at).pivot(pivot).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
|
||||
// Background: under Preferences, Report a bug and other system windows (#9016). The box is
|
||||
// already kept clear of the command window (#6608), which floats at Middle with Features.
|
||||
Container::new(ui.ctx(), Surface::Canvas).area(area).fixed_pos(at).pivot(pivot).order(egui::Order::Background).show(ui.ctx(), |ui| {
|
||||
Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));
|
||||
@@ -1600,7 +1602,7 @@ fn draw_revolve(
|
||||
let area = Container::new(ui.ctx(), Surface::Canvas)
|
||||
.area(egui::Id::new("sc_canvas_area"))
|
||||
.fixed_pos(box_at)
|
||||
.order(egui::Order::Foreground)
|
||||
.order(egui::Order::Background)
|
||||
.interactable(false);
|
||||
area.show(ui.ctx(), |ui| {
|
||||
Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
|
||||
@@ -1852,8 +1854,8 @@ mod tests {
|
||||
}
|
||||
|
||||
/// #6608: a value box that has to move out of the command window does not cover the
|
||||
/// manipulator's handles: the box is a foreground area, so it took the press and the drag
|
||||
/// on a ring never reached the model.
|
||||
/// manipulator's handles: when it covered a handle it took the press and the drag on a ring
|
||||
/// never reached the model.
|
||||
#[test]
|
||||
fn a_value_box_keeps_clear_of_the_handles() {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
@@ -1896,6 +1898,31 @@ mod tests {
|
||||
assert_eq!(clear_of_dialog(clear, place), clear, "a box that misses the window stays");
|
||||
}
|
||||
|
||||
/// Canvas value boxes sit under Preferences and Report a bug (#9016).
|
||||
#[test]
|
||||
fn a_value_box_draws_under_system_windows() {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.run("solid.box", serde_json::json!({"length": 40, "width": 30, "height": 20})).unwrap();
|
||||
h.app.session.selection = vec![Sel::Body { name: "Body1".into() }];
|
||||
h.step(&serde_json::json!({"start": "solid.move"})).unwrap();
|
||||
h.frames(6);
|
||||
let order = |h: &crate::scenario::Harness| {
|
||||
h.ctx.memory(|m| m.areas().visible_layer_ids().into_iter().find(|l| l.id == egui::Id::new("sc_canvas_area")).map(|l| l.order))
|
||||
};
|
||||
assert_eq!(order(&h), Some(egui::Order::Background), "the value box belongs under system windows");
|
||||
h.call("ui.prefs", serde_json::json!({"open": "General"}));
|
||||
h.frames(3);
|
||||
let window = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_prefs"))).expect("Preferences");
|
||||
let box_rect = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_canvas_area"))).expect("the value box");
|
||||
assert!(order(&h) < Some(egui::Order::Middle), "Preferences draws over the value box");
|
||||
if window.intersects(box_rect) {
|
||||
assert!(
|
||||
h.ctx.memory(|m| m.layer_id_at(box_rect.center())).is_some_and(|l| l.id == egui::Id::new("sc_prefs")),
|
||||
"Preferences covers the Distance box where they overlap"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A box that would cover a handle moves off it, and one that cannot clear both the window
|
||||
/// and the handles keeps off the handles: the handle takes the press (#6608).
|
||||
#[test]
|
||||
|
||||
@@ -887,7 +887,8 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
anchor.x = anchor.x.clamp(rect.left(), (rect.right() - popup_width - 6.0).max(rect.left()));
|
||||
anchor.y = anchor.y.clamp(rect.top(), (rect.bottom() - 80.0).max(rect.top()));
|
||||
}
|
||||
Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {
|
||||
// Background: under Preferences and Report a bug (#9016), like canvas value boxes.
|
||||
Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Background).show(ctx, |ui| {
|
||||
Container::popup_frame(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {
|
||||
crate::ui_kit::scope(ui, |ui| {
|
||||
ui.set_max_width(popup_width);
|
||||
|
||||
@@ -541,7 +541,8 @@ fn boxes(app: &SolveApp, ui: &mut egui::Ui, proj: &Proj, t: &mut Tool) -> Option
|
||||
s.store(ui.ctx(), id);
|
||||
}
|
||||
let pos = in_view(sp + vec2(-34.0, -11.0), view, ui.ctx().pointer_latest_pos());
|
||||
Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(
|
||||
// Background: under Preferences and Report a bug (#9016), like canvas value boxes.
|
||||
Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Background).show(
|
||||
ui.ctx(),
|
||||
|ui| {
|
||||
let fill = if b.locked { tk.accent_soft } else { tk.panel };
|
||||
|
||||
Reference in new issue
Block a user