Custom window title #8

Merged
ardocrat merged 29 commits from custom_window_title into master 2024-07-03 13:44:26 +03:00
2 changed files with 5 additions and 18 deletions
Showing only changes of commit 8b0bb2b771 - Show all commits

View file

@ -353,15 +353,9 @@ impl<Platform: PlatformCallbacks> App<Platform> {
let sense = egui::Sense::drag();
let area_resp = ui.interact(rect, id, sense).on_hover_cursor(cursor);
if area_resp.dragged() {
let current_pos = area_resp.interact_pointer_pos();
if let Some(pos) = current_pos {
if self.resize_direction.is_none() {
self.resize_direction = Some(direction.clone());
ui.ctx().send_viewport_cmd(ViewportCommand::BeginResize(direction));
}
ui.ctx().send_viewport_cmd(ViewportCommand::InnerSize(
pos.to_vec2() + egui::vec2(Root::WINDOW_FRAME_MARGIN, Root::WINDOW_FRAME_MARGIN)
));
if self.resize_direction.is_none() {
self.resize_direction = Some(direction.clone());
ui.ctx().send_viewport_cmd(ViewportCommand::BeginResize(direction));
}
}
if area_resp.drag_stopped() {

View file

@ -83,15 +83,8 @@ impl View {
/// Get width and height of app window.
pub fn window_size(ui: &egui::Ui) -> (f32, f32) {
ui.ctx().input(|i| {
return match i.viewport().inner_rect {
None => {
let rect = i.screen_rect;
(rect.width(), rect.height())
},
Some(rect) => (rect.width(), rect.height())
};
})
let rect = ui.ctx().screen_rect();
(rect.width(), rect.height())
}
/// Callback on Enter key press event.