Skip to content
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

Don't apply a clip rect to the contents of an Area or Window #4258

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl Area {
let layer_id = LayerId::new(self.order, self.id);
let area_rect = ctx.memory(|mem| mem.areas().get(self.id).map(|area| area.rect()));
if let Some(area_rect) = area_rect {
let clip_rect = ctx.available_rect();
let clip_rect = Rect::EVERYTHING;
let painter = Painter::new(ctx.clone(), layer_id, clip_rect);

// shrinkage: looks kinda a bad on its own
Expand Down Expand Up @@ -437,12 +437,7 @@ impl Prepared {
.at_least(self.state.left_top_pos() + Vec2::splat(32.0)),
);

let shadow_radius = ctx.style().visuals.window_shadow.margin().sum().max_elem(); // hacky
let clip_rect_margin = ctx.style().visuals.clip_rect_margin.max(shadow_radius);

let clip_rect = Rect::from_min_max(self.state.left_top_pos(), constrain_rect.max)
.expand(clip_rect_margin)
.intersect(constrain_rect);
let clip_rect = constrain_rect; // Don't paint outside our bounds

let mut ui = Ui::new(
ctx.clone(),
Expand Down