8000 Make sure contents of a panel don't overflow by emilk · Pull Request #4676 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make sure contents of a panel don't overflow #4676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ impl SidePanel {
})),
);
panel_ui.expand_to_include_rect(panel_rect);
panel_ui.set_clip_rect(panel_rect); // If we overflow, don't do so visibly (#4475)

let frame = frame.unwrap_or_else(|| Frame::side_top_panel(ui.style()));
let inner_response = frame.show(&mut panel_ui, |ui| {
ui.set_min_height(ui.max_rect().height()); // Make sure the frame fills the full height
Expand Down Expand Up @@ -335,7 +337,7 @@ impl SidePanel {
// (hence the shrink).
let resize_x = side.opposite().side_x(rect.shrink(1.0));
let resize_x = ui.painter().round_to_pixel(resize_x);
ui.painter().vline(resize_x, rect.y_range(), stroke);
ui.painter().vline(resize_x, panel_rect.y_range(), stroke);
}

inner_response
Expand Down Expand Up @@ -749,6 +751,8 @@ impl TopBottomPanel {
})),
);
panel_ui.expand_to_include_rect(panel_rect);
panel_ui.set_clip_rect(panel_rect); // If we overflow, don't do so visibly (#4475)

let frame = frame.unwrap_or_else(|| Frame::side_top_panel(ui.style()));
let inner_response = frame.show(&mut panel_ui, |ui| {
ui.set_min_width(ui.max_rect().width()); // Make the frame fill full width
Expand Down Expand Up @@ -814,7 +818,7 @@ impl TopBottomPanel {
// (hence the shrink).
let resize_y = side.opposite().side_y(rect.shrink(1.0));
let resize_y = ui.painter().round_to_pixel(resize_y);
ui.painter().hline(rect.x_range(), resize_y, stroke);
ui.painter().hline(panel_rect.x_range(), resize_y, stroke);
}

inner_response
Expand Down Expand Up @@ -1078,6 +1082,7 @@ impl CentralPanel {
Layout::top_down(Align::Min),
Some(UiStackInfo::new(UiKind::CentralPanel)),
);
panel_ui.set_clip_rect(panel_rect); // If we overflow, don't do so visibly (#4475)

let frame = frame.unwrap_or_else(|| Frame::central_panel(ui.style()));
frame.show(&mut panel_ui, |ui| {
Expand Down
Loading
0