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

Disabled interactions still interrupt easeTo animations #8725

Closed
VadimDubovoy opened this issue Sep 4, 2019 · 3 comments
Closed

Disabled interactions still interrupt easeTo animations #8725

VadimDubovoy opened this issue Sep 4, 2019 · 3 comments
Assignees
Labels

Comments

@VadimDubovoy
Copy link

I'm trying to prevent interruptions of easeTo animation, so I disable map interactions when run easeTo and enable them back when animation ends.

Disable interactions:

map.easeTo( options, { isAnimation: true } )
map.boxZoom.disable();
map.scrollZoom.disable();
map.dragPan.disable();
map.dragRotate.disable();
map.keyboard.disable();
map.doubleClickZoom.disable();
map.touchZoomRotate.disable();

Enable interactions:

map.on( 'moveend', e => {
  if (e.isAnimation) {
    map.boxZoom.enable();
    map.scrollZoom.enable();
    map.dragPan.enable();
    map.dragRotate.enable();
    map.keyboard.enable();
    map.doubleClickZoom.enable();
    map.touchZoomRotate.enable();
  }
})

However this works differently depending on interactive flag set on map creation.

If set interactive: false, map behaves as expected: it stops interactions when animation starts and enable them back when animation ends.

if set interactive: true, manually disabled interactions still can interrupt animation and moveend event will be fired before animation has reached the end point.

https://jsfiddle.net/8sajomqv/

@arindam1993
Copy link
Contributor

Thanks for the report @VadimDubovoy .

@vakila One more reason to refactor input handlers.

@vakila
Copy link

vakila commented Sep 10, 2019

Just looking at bind_handlers.js and indeed it seems like we don't really care about the handlers' enabled/disabled state but rather rely on options.interactive to decide whether or not to stop the animation. We should definitely still look into refactoring handlers overall, but for now I think we can fix this with some extra checks in there. Self-assigning this as part of the other UI stuff I'm working on.

@vakila vakila self-assigned this Sep 10, 2019
@ansis ansis mentioned this issue Apr 7, 2020
17 tasks
@ansis
Copy link
Contributor

ansis commented Apr 7, 2020

This has been fixed by #9365. If you have a chance to test and confirm, that would be great! The fix is in master and will be released in a beta release tomorrow.

@ansis ansis closed this as completed Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants