Skip to content

Commit 4da3085

Browse files
committed
Fix window drag without breaking title bar buttons
Use ui.interact() with a drag rect that excludes the right 90px where the close/minimize buttons live. This way dragging works on the logo/title area while buttons remain fully clickable.
1 parent 326c156 commit 4da3085

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/gui.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,14 @@ impl AcceleratorApp {
578578
},
579579
);
580580

581-
if inner.response.drag_started() {
581+
// Drag area covers the title bar EXCLUDING the right button area (~90px)
582+
let drag_rect = egui::Rect::from_min_max(
583+
inner.response.rect.left_top(),
584+
egui::pos2(inner.response.rect.right() - 90.0, inner.response.rect.bottom()),
585+
);
586+
let drag_response =
587+
ui.interact(drag_rect, ui.id().with("title_bar_drag"), egui::Sense::drag());
588+
if drag_response.drag_started() {
582589
ctx.send_viewport_cmd(egui::ViewportCommand::StartDrag);
583590
}
584591

0 commit comments

Comments
 (0)