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

easeTo panning does not work properly when zoom changes #1744

Closed
lucaswoj opened this issue Nov 20, 2015 · 7 comments · Fixed by #1771
Closed

easeTo panning does not work properly when zoom changes #1744

lucaswoj opened this issue Nov 20, 2015 · 7 comments · Fixed by #1771
Labels

Comments

@lucaswoj
Copy link
Contributor

... while flyTo does work

https://jsfiddle.net/vyaLssek/

@lucaswoj
Copy link
Contributor Author

We should add test cases for easeTo and flyTo with pitch

@lucaswoj lucaswoj changed the title easeTo does not work properly when pitch is set easeTo panning does not work properly when pitch is set Nov 21, 2015
@lucaswoj
Copy link
Contributor Author

@1ec5 Can you provide a little more context for "needs port from C++"? Does this remind you of a gl-native bug that was fixed?

@1ec5
Copy link
Contributor

1ec5 commented Nov 30, 2015

I think I misread “easeTo panning” as “easeTo padding”. Looking at the fiddle you posted, I’m not sure I see what the bug is. Can you elaborate?

@lucaswoj
Copy link
Contributor Author

This fiddle makes the bug easier to understand: https://jsfiddle.net/4jusfhp2/

easeTo is passed center: [0, 0] but the map actually centers on some point in Alaska. Compare to the behavior when

  • a zoom is not passed to easeTo
  • flyTo is used instead of easeTo

@1ec5
Copy link
Contributor

1ec5 commented Nov 30, 2015

Interesting. mapbox-gl-native doesn’t have this bug. Its easeTo() implementation doesn’t do anything particularly special around pitch, but you might have a look at whether the transforms differ in some way during the animation.

@lucaswoj lucaswoj changed the title easeTo panning does not work properly when pitch is set easeTo panning does not work properly when zoom changes Nov 30, 2015
@khashashin
Copy link

khashashin commented Nov 1, 2019

It's still throws error:

state.map.easeTo({
	center: e.currentTarget.dataset.location.split(','),
	zoom: 15, // throws error
	duration: 3000
});

image

Uncaught TypeError: this._onEaseFrame is not a function
    at r.i._renderFrameCallback (camera.js:1060)
    at ko.run (task_queue.js:52)
    at r._render (map.js:1926)
    at map.js:2051
i._renderFrameCallback @ camera.js:1060
ko.run @ task_queue.js:52
r._render @ map.js:1926
(anonymous) @ map.js:2051
requestAnimationFrame (async)
frame @ browser.js:35
r.triggerRepaint @ map.js:2049
r._update @ map.js:1891
(anonymous) @ map.js:384
St.fire @ evented.js:115
i._fireMoveEvents @ camera.js:775
(anonymous) @ camera.js:1007
i._renderFrameCallback @ camera.js:1060
ko.run @ task_queue.js:52
r._render @ map.js:1926
(anonymous) @ map.js:2051
requestAnimationFrame (async)
frame @ browser.js:35
r.triggerRepaint @ map.js:2049
r._update @ map.js:1891
r._requestRenderFrame @ map.js:1903
i._ease @ camera.js:1053
i.flyTo @ camera.js:991
mountDetail @ ./drones.html.js:260

@Yanonix
Copy link
Contributor

Yanonix commented Nov 18, 2019

Hi @khashashin ,
I presume you have the same error as me, as I can see by your call stack.
I have found and fix the problem, just few minutes ago.
You shouldn't call a map camera transition (map.easeTo, flyTo, ..) while the context is in a map event (such as moveend, ...). You have to deferred your new camera transition calls, by using requestAnimationFrame or timeout.

There is a problem with calling inside an event while the user is interacting. This calls a double map.stop() and makes a difference between map._easeFrameId and the current map._requestRenderFrame queue (which in this case contains multiple ease animation).

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

Successfully merging a pull request may close this issue.

4 participants