1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

egui: Change Ui::allocate_painter to inherit properties from Ui (#4343)

The painter, allocated by `Ui::allocate_painter`, doesn't inherit
properties from the `Ui` object, leading to improper widget rendering in
`egui`.

Specifically, if the `Ui` object is disabled, the corresponding painter
should also be disabled.
This commit is contained in:
Varphone Wong
2024-04-21 17:36:18 +08:00
committed by GitHub
parent fe454573db
commit 5f9c17c855

View File

@@ -1001,7 +1001,7 @@ impl Ui {
pub fn allocate_painter(&mut self, desired_size: Vec2, sense: Sense) -> (Response, Painter) {
let response = self.allocate_response(desired_size, sense);
let clip_rect = self.clip_rect().intersect(response.rect); // Make sure we don't paint out of bounds
let painter = Painter::new(self.ctx().clone(), self.layer_id(), clip_rect);
let painter = self.painter().with_clip_rect(clip_rect);
(response, painter)
}