-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] easeTo: linear interpolation over zoom instead of scale #15281
Conversation
@1ec5 , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does look to be somewhat consistent with how flyTo()
works. (I’d be more hesitant to change how flyTo()
calculates the zoom level, because I’m pretty sure it’s now aligned with the paper describing the optimal path, following #3301 and #3355.)
We should check whether the trajectory looks good if the origin is at a low latitude and the destination is at a high latitude or vice versa. For example, how does it look if the camera eases from Null Island to Greenwich, England, with identical MGLMapCamera.altitude
and thus different zoom levels?
Suggested changelog entry:
- Fixed an issue where animated camera transitions zoomed in or out too dramatically.
The video currently looks like the camera is going in a curve, not as a straight line, which I'd consider a bug for |
f8117eb
to
eb99e9c
Compare
@mourner , @1ec5 , @chloekraw , @ansis Patch eb99e9c
The patch also sets linear interpolation for flyTo edgeInsets animation, as it looks more appropriate to follow the approach taken for pitch and bearing. Attached videos use this easeTo (patch in issue description) with two different set of coordinates. |
Curve related to set latitude and longitude or altitude? Could you compare it to videos attached to #15281 (comment)? One of the videos uses the same coordinates as in the gif. |
eb99e9c
to
9c9a034
Compare
@astojilj oh, yeah, I can see the "curve" in the camera path in those videos too (camera not moving in a straight line). I just checked in GL JS and there it is too. I guess it's an unrelated bug that was there before and I didn't pay attention. An example of a straight line camera path would be scroll-zooming with a mouse on a GL JS map. |
0710ed4
to
7cc6f6d
Compare
@alexshalamov PTAL |
7cc6f6d
to
7727324
Compare
@1ec5 ,
Done. |
…plementation. When using flyTo for easeTo: Limit zoom out to min(startZoom, targetZoom). Reduce cinematic zoom in animation at the end of transition, Linear zoom interpolation. The patch also sets linear interpolation for flyTo edgeInsets animation, as it looks more appropriate to follow the approach taken for pitch and bearing. Fixes: #15144
b2454a8
to
03f64a6
Compare
Captured screen video could be compared against videos #15144.
Final version (reusing fly to calculation for constant movement) as in https://github.com/mapbox/mapbox-gl-native/files/3460613/Archive.zip
Version after first patch:
Linear interpolation over zoom looks more natural, as the rate of change looks constant to user: for every zoom change of 1, view displays 2 times wider area.
Problem if using scale could be described by this graph:
http://www.mathopenref.com/graphfunctions.html?fx=log(x)&xh=1000000&xl=0&yh=20&yl=0
Horizontal axis: scale, vertical axis: zoom:
When linearly interpolating over scale, zoom changes very slowly when zoomed in. When zooming out (values of scale towards 0), as reported in #15144, it feels like a sudden zoom out.
The transition could be further improved, by moving center coordinate slower for higher zoom values, to present linear interpolation of center coordinate on the screen, but this improvement already feels like fixing original issue.
Manual verification using modified iosapp:
Fixes: #15144