Add alignment to Viewport
This commit is contained in:
parent
905c307f0b
commit
d79cedd8da
1 changed files with 27 additions and 1 deletions
|
|
@ -577,7 +577,15 @@ pub fn update<Message>(
|
||||||
content_bounds,
|
content_bounds,
|
||||||
);
|
);
|
||||||
|
|
||||||
notify_on_scroll(state, on_scroll, bounds, content_bounds, shell);
|
notify_on_scroll(
|
||||||
|
state,
|
||||||
|
on_scroll,
|
||||||
|
bounds,
|
||||||
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
|
shell,
|
||||||
|
);
|
||||||
|
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
|
|
@ -623,6 +631,8 @@ pub fn update<Message>(
|
||||||
on_scroll,
|
on_scroll,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
shell,
|
shell,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -669,6 +679,8 @@ pub fn update<Message>(
|
||||||
on_scroll,
|
on_scroll,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
shell,
|
shell,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -705,6 +717,8 @@ pub fn update<Message>(
|
||||||
on_scroll,
|
on_scroll,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
shell,
|
shell,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -746,6 +760,8 @@ pub fn update<Message>(
|
||||||
on_scroll,
|
on_scroll,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
shell,
|
shell,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -782,6 +798,8 @@ pub fn update<Message>(
|
||||||
on_scroll,
|
on_scroll,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
shell,
|
shell,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -997,6 +1015,8 @@ fn notify_on_scroll<Message>(
|
||||||
on_scroll: &Option<Box<dyn Fn(Viewport) -> Message + '_>>,
|
on_scroll: &Option<Box<dyn Fn(Viewport) -> Message + '_>>,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
content_bounds: Rectangle,
|
content_bounds: Rectangle,
|
||||||
|
horizontal_alignment: Alignment,
|
||||||
|
vertical_alignment: Alignment,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
) {
|
) {
|
||||||
if let Some(on_scroll) = on_scroll {
|
if let Some(on_scroll) = on_scroll {
|
||||||
|
|
@ -1011,6 +1031,8 @@ fn notify_on_scroll<Message>(
|
||||||
offset_y: state.offset_y,
|
offset_y: state.offset_y,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
|
horizontal_alignment,
|
||||||
|
vertical_alignment,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't publish redundant viewports to shell
|
// Don't publish redundant viewports to shell
|
||||||
|
|
@ -1103,6 +1125,10 @@ pub struct Viewport {
|
||||||
pub bounds: Rectangle,
|
pub bounds: Rectangle,
|
||||||
/// The content bounds of the [`Scrollable`].
|
/// The content bounds of the [`Scrollable`].
|
||||||
pub content_bounds: Rectangle,
|
pub content_bounds: Rectangle,
|
||||||
|
/// The horizontal [`Alignment`] of the [`Scrollable`].
|
||||||
|
pub horizontal_alignment: Alignment,
|
||||||
|
/// The vertical [`Alignment`] of the [`Scrollable`].
|
||||||
|
pub vertical_alignment: Alignment,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Viewport {
|
impl Viewport {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue