Skip to content

Commit

Permalink
fix window pinning
Browse files Browse the repository at this point in the history
  • Loading branch information
TicClick committed Jan 26, 2024
1 parent 418787b commit 3f55e5e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/gui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ impl Menu {
);

if resp.clicked() {
ctx.send_viewport_cmd(egui::ViewportCommand::WindowLevel(
egui::WindowLevel::AlwaysOnTop,
));
ctx.send_viewport_cmd(egui::ViewportCommand::Decorations(!self.pin_window));
match self.pin_window {
true => {
ctx.send_viewport_cmd(egui::ViewportCommand::WindowLevel(egui::WindowLevel::AlwaysOnTop));
ctx.send_viewport_cmd(egui::ViewportCommand::Decorations(false));
}
false => {
ctx.send_viewport_cmd(egui::ViewportCommand::WindowLevel(egui::WindowLevel::Normal));
ctx.send_viewport_cmd(egui::ViewportCommand::Decorations(true));
}
}
} else if resp.is_pointer_button_down_on() {
ctx.send_viewport_cmd(egui::ViewportCommand::StartDrag);
}
Expand Down

0 comments on commit 3f55e5e

Please sign in to comment.