Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Report a bug: the window can be dragged by its title (#9916) (#9934)

austin62jakec4f926940926
diff --git a/crates/ui-egui/src/issue_report.rs b/crates/ui-egui/src/issue_report.rs
index 7af85281f5..69344ed8c4 100644
--- a/crates/ui-egui/src/issue_report.rs
+++ b/crates/ui-egui/src/issue_report.rs
@@ -1532,6 +1532,32 @@ mod tests {
}
}
+ /// #9916: the window opens at the top middle, and dragging its title band moves it off the
+ /// model, in a sketch too.
+ #[test]
+ fn issue_report_window_moves_by_its_title() {
+ for sketch in [false, true] {
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.call("ui.resize", json!({"width":1400,"height":800}));
+ if sketch {
+ h.app.run("sketch.create", json!({"plane": "XY"})).unwrap();
+ }
+ h.app.issue_report.draft = Some(draft_for(&h.app, None, None));
+ h.frames(10);
+ let rect = |h: &crate::scenario::Harness| egui::containers::AreaState::load(&h.ctx, egui::Id::new("sc_issue_report")).unwrap().rect();
+ let at = rect(&h);
+ assert!((at.center().x - h.ctx.content_rect().center().x).abs() < 1.0, "sketch={sketch}: it opens at the top middle: {at:?}");
+ // On the title, clear of the close button.
+ let grip = at.left_top() + egui::vec2(140.0, 18.0);
+ h.call("ui.drag", json!({"x0": grip.x, "y0": grip.y, "x1": grip.x - 250.0, "y1": grip.y, "steps": 20}));
+ h.frames(4);
+ let moved = rect(&h);
+ assert!((moved.min.x - (at.min.x - 250.0)).abs() < 2.0 && (moved.min.y - at.min.y).abs() < 2.0, "sketch={sketch}: {at:?} -> {moved:?}");
+ assert!(h.app.issue_report.draft.is_some(), "still open");
+ }
+ }
+
/// Save screenshot… writes the PNG where the picker says, the way the web app's other saves
/// write (#7192), and a failure reads as plain words, not a Rust value.
#[test]
diff --git a/crates/ui-egui/src/issue_report/form.rs b/crates/ui-egui/src/issue_report/form.rs
index a2b86f4900..3cb0ff5c42 100644
--- a/crates/ui-egui/src/issue_report/form.rs
+++ b/crates/ui-egui/src/issue_report/form.rs
@@ -120,7 +120,9 @@ pub(super) fn show(app: &mut SolveApp, draft: &mut Draft, ctx: &egui::Context) -
let close_label = if compact { "" } else { "Close draft" };
let (closed, mut action) = ui_kit::Window::new(Id::new("sc_issue_report"), "bug_report", tr_label("Report a bug"))
.cards(cards)
- .anchor(egui::Align2::CENTER_TOP, vec2(0.0, t.space_16))
+ // Opens at the top middle, and its title band drags it off what the report is about
+ // (#9916).
+ .placed(egui::Align2::CENTER_TOP, egui::pos2(screen.center().x, screen.top() + t.space_16))
.fields()
.keep_open_on_escape()
.actions(tr_label(open_label), tr_label(close_label), Some(tr_label("Copy report")))