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

Take clip_rect into account when storing widget rects (#4020)

* Bug introduced in https://github.com/emilk/egui/pull/4013
* Closes https://github.com/emilk/egui/issues/4017

Unfortunately this is a breaking change, since it changes the fields of
`Response`, so can't do a patch-release with this.
This commit is contained in:
Emil Ernerfeldt
2024-02-10 17:28:38 +01:00
committed by GitHub
parent 132d0ec430
commit 407224746d
4 changed files with 70 additions and 19 deletions

View File

@@ -49,9 +49,20 @@ impl eframe::App for MyApp {
}
ui.label(format!("Hello '{}', age {}", self.name, self.age));
ui.image(egui::include_image!(
"../../../crates/egui/assets/ferris.png"
));
// ui.image(egui::include_image!(
// "../../../crates/egui/assets/ferris.png"
// ));
let (response, painter) =
ui.allocate_painter(egui::vec2(300.0, 150.0), egui::Sense::click());
painter.rect_filled(response.rect, 2.0, egui::Color32::BLACK);
let clicked_pos = response.interact_pointer_pos();
if response.clicked() {
eprintln!("clicked_pos: {clicked_pos:?}");
}
if response.is_pointer_button_down_on() {
eprintln!("down_pos: {clicked_pos:?}");
}
});
}
}