refactor: include virtual offset in Layout

This commit is contained in:
Ashley Wulber 2025-03-19 23:11:48 -04:00
parent 7120db60ba
commit 5b0468e535
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
10 changed files with 251 additions and 98 deletions

View file

@ -290,7 +290,11 @@ where
operation.traverse(&mut |operation| {
self.content.as_widget_mut().operate(
tree,
layout.children().next().unwrap(),
layout
.children()
.next()
.unwrap()
.with_virtual_offset(layout.virtual_offset()),
renderer,
operation,
);
@ -311,7 +315,11 @@ where
self.content.as_widget_mut().update(
tree,
event,
layout.children().next().unwrap(),
layout
.children()
.next()
.unwrap()
.with_virtual_offset(layout.virtual_offset()),
cursor,
renderer,
clipboard,
@ -330,7 +338,11 @@ where
) -> mouse::Interaction {
self.content.as_widget().mouse_interaction(
tree,
layout.children().next().unwrap(),
layout
.children()
.next()
.unwrap()
.with_virtual_offset(layout.virtual_offset()),
cursor,
viewport,
renderer,
@ -366,7 +378,11 @@ where
.unwrap_or(renderer_style.text_color),
scale_factor: renderer_style.scale_factor,
},
layout.children().next().unwrap(),
layout
.children()
.next()
.unwrap()
.with_virtual_offset(layout.virtual_offset()),
cursor,
if self.clip {
&clipped_viewport
@ -387,7 +403,11 @@ where
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
self.content.as_widget_mut().overlay(
tree,
layout.children().next().unwrap(),
layout
.children()
.next()
.unwrap()
.with_virtual_offset(layout.virtual_offset()),
renderer,
viewport,
translation,
@ -404,7 +424,11 @@ where
) -> iced_accessibility::A11yTree {
let c_layout = layout.children().next().unwrap();
self.content.as_widget().a11y_nodes(c_layout, state, cursor)
self.content.as_widget().a11y_nodes(
c_layout.with_virtual_offset(layout.virtual_offset()),
state,
cursor,
)
}
fn drag_destinations(
@ -417,7 +441,7 @@ where
if let Some(l) = layout.children().next() {
self.content.as_widget().drag_destinations(
state,
l,
l.with_virtual_offset(layout.virtual_offset()),
renderer,
dnd_rectangles,
);