summaryrefslogtreecommitdiffstats
path: root/native/src/overlay
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/overlay')
-rw-r--r--native/src/overlay/element.rs10
-rw-r--r--native/src/overlay/group.rs6
2 files changed, 12 insertions, 4 deletions
diff --git a/native/src/overlay/element.rs b/native/src/overlay/element.rs
index bdf7766e..237d25d1 100644
--- a/native/src/overlay/element.rs
+++ b/native/src/overlay/element.rs
@@ -53,8 +53,14 @@ where
}
/// Computes the layout of the [`Element`] in the given bounds.
- pub fn layout(&self, renderer: &Renderer, bounds: Size) -> layout::Node {
- self.overlay.layout(renderer, bounds, self.position)
+ pub fn layout(
+ &self,
+ renderer: &Renderer,
+ bounds: Size,
+ translation: Vector,
+ ) -> layout::Node {
+ self.overlay
+ .layout(renderer, bounds, self.position + translation)
}
/// Processes a runtime [`Event`].
diff --git a/native/src/overlay/group.rs b/native/src/overlay/group.rs
index 5c9cf809..1126f0cf 100644
--- a/native/src/overlay/group.rs
+++ b/native/src/overlay/group.rs
@@ -66,13 +66,15 @@ where
&self,
renderer: &Renderer,
bounds: Size,
- _position: Point,
+ position: Point,
) -> layout::Node {
+ let translation = position - Point::ORIGIN;
+
layout::Node::with_children(
bounds,
self.children
.iter()
- .map(|child| child.layout(renderer, bounds))
+ .map(|child| child.layout(renderer, bounds, translation))
.collect(),
)
}