diff options
Diffstat (limited to '')
-rw-r--r-- | runtime/src/overlay/nested.rs (renamed from runtime/src/user_interface/overlay.rs) | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/src/user_interface/overlay.rs b/runtime/src/overlay/nested.rs index 1211d55b..5c5fafde 100644 --- a/runtime/src/user_interface/overlay.rs +++ b/runtime/src/overlay/nested.rs @@ -21,6 +21,12 @@ where Self { overlay: element } } + /// Returns the position of the [`Nested`] overlay. + pub fn position(&self) -> Point { + self.overlay.position() + } + + /// Returns the layout [`Node`] of the [`Nested`] overlay. pub fn layout( &mut self, renderer: &Renderer, @@ -36,7 +42,7 @@ where where Renderer: renderer::Renderer, { - let translation = position - Point::ORIGIN; + let translation = position - element.position(); let node = element.layout(renderer, bounds, translation); @@ -58,6 +64,7 @@ where recurse(&mut self.overlay, renderer, bounds, position) } + /// Draws the [`Nested`] overlay using the associated `Renderer`. pub fn draw( &mut self, renderer: &mut Renderer, @@ -127,6 +134,7 @@ where recurse(&mut self.overlay, layout, renderer, theme, style, cursor); } + /// Applies a [`widget::Operation`] to the [`Nested`] overlay. pub fn operate( &mut self, layout: Layout<'_>, @@ -157,6 +165,7 @@ where recurse(&mut self.overlay, layout, renderer, operation) } + /// Processes a runtime [`Event`]. pub fn on_event( &mut self, event: Event, @@ -247,6 +256,7 @@ where status } + /// Returns the current [`mouse::Interaction`] of the [`Nested`] overlay. pub fn mouse_interaction( &mut self, layout: Layout<'_>, @@ -298,6 +308,7 @@ where .unwrap_or_default() } + /// Returns true if the cursor is over the [`Nested`] overlay. pub fn is_over( &mut self, layout: Layout<'_>, |