fuse-open / fuselibs

Fuselibs is the Uno-libraries that provide the UI framework used in Fuse apps
https://npmjs.com/package/@fuse-open/fuselibs
MIT License
176 stars 72 forks source link

add Snapping to the ScrollView #1459

Closed ichan-mb closed 1 year ago

ichan-mb commented 1 year ago

Scroll snapping allows you to lock the viewport to a certain location after a user has finished scrolling. You can use the SnapAlignment property to control the lock position. Three lock positions are available: ' Start Center, and End.

The setup that works now is with a StackPanel (Horizontal or Vertical)

<ScrollView LayoutMode="PreserveVisual" Height="400">
    <StackPanel>
        <Each Count="100" Reuse="Frame" >
            <Panel Color="#AAA">
                <Text Value="Data {= index() }"/>
            </Panel>
        </Each>
    </StackPanel>
    <ScrollViewSnap SnapAlignment="Center" />
</ScrollView>

It's required to use LayoutMode="PreserveVisual" on the ScrollView and the child element in the StackPanel has an equal size

This PR contains: