1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

answering todo

This commit is contained in:
Bruno Paré-Simard
2025-01-30 12:06:27 -05:00
parent 69eeab03c4
commit e060403904

View File

@@ -20,7 +20,7 @@ use emath::{GuiRounding as _, Pos2};
use crate::panel::TopBottomSide; use crate::panel::TopBottomSide;
use crate::{ use crate::{
lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt, lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt,
Rangef, Rect, Response, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Rangef, Rect, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2,
}; };
fn animate_expansion(ctx: &Context, id: Id, is_expanded: bool) -> f32 { fn animate_expansion(ctx: &Context, id: Id, is_expanded: bool) -> f32 {
@@ -262,7 +262,7 @@ impl PanelSizer {
/// ///
/// ``` /// ```
/// # egui::__run_test_ctx(|ctx| { /// # egui::__run_test_ctx(|ctx| {
/// egui::SidePanel::left("my_left_panel").show(ctx, |ui| { /// egui::Panel::left("my_left_panel").show(ctx, |ui| {
/// ui.label("Hello World!"); /// ui.label("Hello World!");
/// }); /// });
/// # }); /// # });
@@ -569,7 +569,8 @@ impl Panel {
self.prepare_resizable_panel(&mut panel_sizer, ui); self.prepare_resizable_panel(&mut panel_sizer, ui);
} }
// TODO(shark98): Does it have to be here or could be in `PanelBuilder::new()`? // NOTE(shark98): This must be **after** the resizable preparation, as the size
// may change and round_ui() uses the size.
panel_sizer.panel_rect = panel_sizer.panel_rect.round_ui(); panel_sizer.panel_rect = panel_sizer.panel_rect.round_ui();
let get_ui_kind = || match side { let get_ui_kind = || match side {
@@ -730,12 +731,10 @@ impl Panel {
if resize_response.is_some() { if resize_response.is_some() {
let resize_response = resize_response.unwrap(); let resize_response = resize_response.unwrap();
// TODO(sharky98): Verify if it is needed to initialize as false. // NOTE(sharky98): The original code was initializing to
let mut is_resizing = false; // false first, but it doesn't seem necessary.
is_resizing = resize_response.dragged(); let is_resizing = resize_response.dragged();
let pointer = resize_response.interact_pointer_pos(); let pointer = resize_response.interact_pointer_pos();
panel_sizer.prepare_resizing_response(is_resizing, pointer); panel_sizer.prepare_resizing_response(is_resizing, pointer);
} }
} }