Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored May 31, 2024
1 parent 84d2042 commit df8d946
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/custom_window_frame/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ fn title_bar_ui(ui: &mut egui::Ui, title_bar_rect: eframe::epaint::Rect, title:

let painter = ui.painter();

let title_bar_response = ui.interact(title_bar_rect, Id::new("title_bar"), Sense::click());
let title_bar_response = ui.interact(
title_bar_rect,
Id::new("title_bar"),
Sense::click_and_drag(),
);

// Paint the title:
painter.text(
Expand All @@ -108,7 +112,7 @@ fn title_bar_ui(ui: &mut egui::Ui, title_bar_rect: eframe::epaint::Rect, title:
.send_viewport_cmd(ViewportCommand::Maximized(!is_maximized));
}

if title_bar_response.is_pointer_button_down_on() {
if title_bar_response.dragged_by(PointerButton::Primary) {
ui.ctx().send_viewport_cmd(ViewportCommand::StartDrag);
}

Expand Down

0 comments on commit df8d946

Please sign in to comment.