v1.5.0
What's Changed
- Add new gesture based drag interaction.
- Add pointer behavior enumeration.
New configurations
It is now possible to define new drag interaction which is based on the direction of the drag, rather than relying on the start and end regions. This new configuration could be set via dragInteraction param in rememberPageCurlConfig:
PageCurl(
count = pages.size,
config = rememberPageCurlConfig(
dragInteraction = PageCurlConfig.GestureDragInteraction()
)
) { index ->
HowToPage(index, pages[index])
}
Also it is now possible to make page's edge to follow user's finger in drag interaction. This new configuration could be set via pointerBehavior param in StartEndDragInteraction:
PageCurl(
count = pages.size,
config = rememberPageCurlConfig(
dragInteraction = PageCurlConfig.StartEndDragInteraction(
pointerBehavior = PageCurlConfig.DragInteraction.PointerBehavior.PageEdge
)
)
) { index ->
HowToPage(index, pages[index])
}
Or in new GestureDragInteraction:
PageCurl(
count = pages.size,
config = rememberPageCurlConfig(
dragInteraction = PageCurlConfig.GestureDragInteraction(
pointerBehavior = PageCurlConfig.DragInteraction.PointerBehavior.PageEdge
)
)
) { index ->
HowToPage(index, pages[index])
}
API changes
As there are new APIs are introduced it could break some old config usages.
- The
rememberPageCurlConfignow accepts one drag interaction config and one tap interaction config, instead of two separate for backward and forward configurations.
Before 1.5.0
val config = rememberPageCurlConfig(
dragForwardInteraction = PageCurlConfig.DragInteraction(...),
dragBackwardEnabled = PageCurlConfig.DragInteraction(...),
tapForwardInteraction = PageCurlConfig.TapInteraction(...),
tapBackwardEnabled = PageCurlConfig.TapInteraction(...),
)
After 1.5.0
val config = rememberPageCurlConfig(
dragInteraction = PageCurlConfig.StartEndDragInteraction(),
tapInteraction = PageCurlConfig.TargetTapInteraction(),
)
- The
PageCurlConfiginstance now has one drag interaction config property and one tap interaction config property, instead of two separate for backward and forward configurations.
Before 1.5.0
config.dragForwardInteraction = ...
config.dragBackwardInteraction = ...
config.tapForwardInteraction = ...
config.tapBackwardInteraction = ...
After 1.5.0
config.dragInteraction = ...
config.tapInteraction = ...
Full Changelog: https://github.com/oleksandrbalan/pagecurl/compare/v1.4.1...v1.5.0