Skip to content

Commit e1445be

Browse files
committed
Add alignment to Viewport
1 parent d73dba1 commit e1445be

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

widget/src/scrollable.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,15 @@ pub fn update<Message>(
553553
content_bounds,
554554
);
555555

556-
notify_on_scroll(state, on_scroll, bounds, content_bounds, shell);
556+
notify_on_scroll(
557+
state,
558+
on_scroll,
559+
bounds,
560+
content_bounds,
561+
horizontal_alignment,
562+
vertical_alignment,
563+
shell,
564+
);
557565

558566
return event::Status::Captured;
559567
}
@@ -599,6 +607,8 @@ pub fn update<Message>(
599607
on_scroll,
600608
bounds,
601609
content_bounds,
610+
horizontal_alignment,
611+
vertical_alignment,
602612
shell,
603613
);
604614
}
@@ -645,6 +655,8 @@ pub fn update<Message>(
645655
on_scroll,
646656
bounds,
647657
content_bounds,
658+
horizontal_alignment,
659+
vertical_alignment,
648660
shell,
649661
);
650662

@@ -681,6 +693,8 @@ pub fn update<Message>(
681693
on_scroll,
682694
bounds,
683695
content_bounds,
696+
horizontal_alignment,
697+
vertical_alignment,
684698
shell,
685699
);
686700
}
@@ -722,6 +736,8 @@ pub fn update<Message>(
722736
on_scroll,
723737
bounds,
724738
content_bounds,
739+
horizontal_alignment,
740+
vertical_alignment,
725741
shell,
726742
);
727743
}
@@ -758,6 +774,8 @@ pub fn update<Message>(
758774
on_scroll,
759775
bounds,
760776
content_bounds,
777+
horizontal_alignment,
778+
vertical_alignment,
761779
shell,
762780
);
763781

@@ -995,6 +1013,8 @@ fn notify_on_scroll<Message>(
9951013
on_scroll: &Option<Box<dyn Fn(Viewport) -> Message + '_>>,
9961014
bounds: Rectangle,
9971015
content_bounds: Rectangle,
1016+
horizontal_alignment: Alignment,
1017+
vertical_alignment: Alignment,
9981018
shell: &mut Shell<'_, Message>,
9991019
) {
10001020
if let Some(on_scroll) = on_scroll {
@@ -1009,6 +1029,8 @@ fn notify_on_scroll<Message>(
10091029
offset_y: state.offset_y,
10101030
bounds,
10111031
content_bounds,
1032+
horizontal_alignment,
1033+
vertical_alignment,
10121034
};
10131035

10141036
// Don't publish redundant viewports to shell
@@ -1101,6 +1123,10 @@ pub struct Viewport {
11011123
pub bounds: Rectangle,
11021124
/// The content bounds of the [`Scrollable`].
11031125
pub content_bounds: Rectangle,
1126+
/// The horizontal [`Alignment`] of the [`Scrollable`].
1127+
pub horizontal_alignment: Alignment,
1128+
/// The vertical [`Alignment`] of the [`Scrollable`].
1129+
pub vertical_alignment: Alignment,
11041130
}
11051131

11061132
impl Viewport {

0 commit comments

Comments
 (0)