Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cancelOnLeave option #69

Merged
merged 2 commits into from
Nov 20, 2020
Merged

Added cancelOnLeave option #69

merged 2 commits into from
Nov 20, 2020

Conversation

m424m
Copy link
Contributor

@m424m m424m commented Nov 17, 2020

Currently, the mousemove event is only fired while the pointer is inside the container, and the drag gesture being suddenly cancelled feels a little anticlimactic. I added the cancelOnLeave option which allows to override this behavior.

@rcbyr
Copy link
Owner

rcbyr commented Nov 20, 2020

Hey @m424m,

thanks for your contribution. I think I will change the option name to mouseCancelOnLeave or so, to make it more explicit. I think I will publish it on Sunday.

@rcbyr rcbyr merged commit ff76385 into rcbyr:master Nov 20, 2020
eventAdd(container, 'mouseup', eventDragStop)
eventAdd(options.cancelOnLeave ? container : window, 'mousemove', eventDrag)
if (options.cancelOnLeave) eventAdd(container, 'mouseleave', eventDragStop)
eventAdd(window, 'mouseup', eventDragStop)
Copy link
Contributor

@roderickhsiao roderickhsiao Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this change is intentional? this is changing the existing behavior as the mouseup event now binding to window regardless of options.cancelOnLeave option, which previously bind to the container.

Some of our use case which manually handles tap (mouseup) on the slide and programmatically calls slider.next/slider.prev (v5), and this behavior breaks the use case as the timing for eventDragStop changes (window vs container).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants