mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Respect margins when painting Container
This commit is contained in:
parent
d13510bfe3
commit
66dcb73263
1 changed files with 7 additions and 2 deletions
|
@ -150,16 +150,21 @@ impl Element for Container {
|
||||||
_: &mut Self::LayoutState,
|
_: &mut Self::LayoutState,
|
||||||
ctx: &mut PaintContext,
|
ctx: &mut PaintContext,
|
||||||
) -> Self::PaintState {
|
) -> Self::PaintState {
|
||||||
|
let quad_bounds = RectF::from_points(
|
||||||
|
bounds.origin() + vec2f(self.margin.left, self.margin.top),
|
||||||
|
bounds.lower_right() - vec2f(self.margin.right, self.margin.bottom),
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(shadow) = self.shadow.as_ref() {
|
if let Some(shadow) = self.shadow.as_ref() {
|
||||||
ctx.scene.push_shadow(scene::Shadow {
|
ctx.scene.push_shadow(scene::Shadow {
|
||||||
bounds: bounds + shadow.offset,
|
bounds: quad_bounds + shadow.offset,
|
||||||
corner_radius: self.corner_radius,
|
corner_radius: self.corner_radius,
|
||||||
sigma: shadow.blur,
|
sigma: shadow.blur,
|
||||||
color: shadow.color,
|
color: shadow.color,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ctx.scene.push_quad(Quad {
|
ctx.scene.push_quad(Quad {
|
||||||
bounds,
|
bounds: quad_bounds,
|
||||||
background: self.background_color,
|
background: self.background_color,
|
||||||
border: self.border,
|
border: self.border,
|
||||||
corner_radius: self.corner_radius,
|
corner_radius: self.corner_radius,
|
||||||
|
|
Loading…
Reference in a new issue