Bug Fix: Allocate Frame outer margins (#2089)

This commit is contained in:
Paul Rouget 2022-10-01 20:18:15 +08:00 committed by GitHub
parent 2ee9ab3151
commit 2dca01ecd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -244,6 +244,13 @@ impl Prepared {
rect rect
} }
fn content_with_margin(&self) -> Rect {
let mut rect = self.content_ui.min_rect();
rect.min -= self.frame.inner_margin.left_top() + self.frame.outer_margin.left_top();
rect.max += self.frame.inner_margin.right_bottom() + self.frame.outer_margin.right_bottom();
rect
}
pub fn end(self, ui: &mut Ui) -> Response { pub fn end(self, ui: &mut Ui) -> Response {
let paint_rect = self.paint_rect(); let paint_rect = self.paint_rect();
@ -258,6 +265,6 @@ impl Prepared {
ui.painter().set(where_to_put_background, shape); ui.painter().set(where_to_put_background, shape);
} }
ui.allocate_rect(paint_rect, Sense::hover()) ui.allocate_rect(self.content_with_margin(), Sense::hover())
} }
} }