Scroll review.
This commit is contained in:
parent
18190a2cf3
commit
cc30e5e50b
|
@ -7,12 +7,9 @@
|
|||
- Test access to the scroll offset inside the content.
|
||||
|
||||
* Test scroll to end when the height changes by scrolling.
|
||||
* How this ties in with virtualization? Widgets that only reserve layout space when not visible.
|
||||
- How this ties in with virtualization? Widgets that only reserve layout space when not visible.
|
||||
|
||||
* Widgets may want to know what percentage of a widget is visible in the viewport, see flutter "slivers" concept.
|
||||
* "Sliver" widgets may change size due to scrolling.
|
||||
- "Sliver" widgets may change size due to scrolling.
|
||||
|
||||
* Touch scrolling.
|
||||
- Need touch events first.
|
||||
- Push against end indicator.
|
||||
- Acceleration/smooth scrolling integration.
|
||||
* Scroll-to-fill/fit.
|
|
@ -32,7 +32,6 @@
|
|||
* Implement touch scroll inertia.
|
||||
* Implement `ScrollMode::ZOOM`.
|
||||
- Touch gesture.
|
||||
* Scroll-to-fill/fit.
|
||||
|
||||
# Touch Events
|
||||
|
||||
|
|
|
@ -698,9 +698,8 @@ pub fn scroll_to_node(child: impl UiNode) -> impl UiNode {
|
|||
// replace scale
|
||||
let rendered_scale = SCROLL.rendered_zoom_scale();
|
||||
if let Some(s) = zoom {
|
||||
target_bounds.origin /= rendered_scale;
|
||||
let s = s / rendered_scale;
|
||||
target_bounds.origin *= s;
|
||||
target_bounds.size /= rendered_scale;
|
||||
target_bounds.size *= s;
|
||||
}
|
||||
// target bounds is in the content space at future scale
|
||||
|
@ -721,10 +720,10 @@ pub fn scroll_to_node(child: impl UiNode) -> impl UiNode {
|
|||
|
||||
// vertical scroll
|
||||
if target_bounds.size.height < viewport_size.height {
|
||||
if target_bounds_in_content.origin.y < Px(0) {
|
||||
if target_bounds.origin.y < Px(0) {
|
||||
// scroll up
|
||||
offset.y = target_bounds.origin.y;
|
||||
} else if target_bounds_in_content.origin.y > viewport_size.height {
|
||||
} else if target_bounds.origin.y > viewport_size.height {
|
||||
// scroll down
|
||||
offset.y = target_bounds.max_y() - viewport_size.height;
|
||||
}
|
||||
|
@ -767,8 +766,7 @@ pub fn scroll_to_node(child: impl UiNode) -> impl UiNode {
|
|||
// scroll range
|
||||
let mut content_size = SCROLL.content_size().get();
|
||||
if let Some(scale) = zoom {
|
||||
content_size /= rendered_scale;
|
||||
content_size *= scale;
|
||||
content_size *= scale / rendered_scale;
|
||||
}
|
||||
let max_scroll = content_size - viewport_size;
|
||||
|
||||
|
|
|
@ -723,7 +723,7 @@ impl SCROLL {
|
|||
|
||||
/// Scroll the [`WIDGET`] into view and adjusts the zoom scale.
|
||||
///
|
||||
/// This rquests [`commands::scroll_to_info_zoom`] for the contextual widget.
|
||||
/// This requests [`commands::scroll_to_info_zoom`] for the contextual widget.
|
||||
pub fn scroll_to_zoom(&self, mode: impl Into<super::commands::ScrollToMode>, zoom: impl Into<Factor>) {
|
||||
commands::scroll_to_info_zoom(&WIDGET.info(), mode.into(), zoom.into())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue