Custom window title #8
2 changed files with 5 additions and 18 deletions
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue