JoshDSommer / nativescript-slides

A NativeScript plugin that is for Intro Tutorials, Image Carousels or any other slide functionality
Other
70 stars 32 forks source link

Support disabling Pan at runtime #124

Closed toddanglin closed 5 years ago

toddanglin commented 5 years ago

This change makes it possible to disable the "pan" behavior at runtime AFTER the slider has been loaded. Currently, the disablePan property is only checked during initial load. If it is changed after the Slider loads, it has no effect. With this change, setting disablePan to true at runtime will remove the pan event handler for the currentPanel.panel. If disablePan is set to true, the applySwipe method is called to re-init the pan gesture handler for the currentPanel.panel. This helps in cases where there are nested UI elements inside of a Slider trying to capture pan events. If disablePan is false in these cases, the pan events for nested UI elements can get swallowed by the Slider. Now a nested UI element can call disablePan = false during its own pan event, and then re-enable the Slider with disablePan = true when the pan event is complete.

JoshDSommer commented 5 years ago

Awesome Idea @toddanglin, I'll publish this as 2.3.0. Thanks a bunch!

toddanglin commented 5 years ago

Thanks for the fast follow-up! Much appreciated.