Map and Transform methods assume an origin at the top-left corner of the view, like iOS, Android, and GLFW but unlike OS X. Transform is responsible for flipping coordinates between the top-left origin of Map and the bottom-left origin of TransformState.
Fixes#3574.
Methods that offer a convenient way to jump or ease now accept an optional padding parameter. MGLMapView specifies the padding to ensure that keyboard-based zooming and rotation respects the toolbar.
Moved EdgeInsets to geo.hpp so CameraOptions and Transform can refer to it. Added a padding option to CameraOptions that alters the frame of reference for the center option. Added optional padding parameters to LatLng getters and setters.
Working towards #2600.
This is a tricky one:
We are storing a lambda at the member variable `transitionFrameFn` and
capturing `this` at this lambda function.
At some point when running the callback, we set `transitionFrameFn` to
`nullptr`, effectively destroying the callback that is being executed.
After this point, `this` is no longer valid, as the memory gets
cleared and it might point to the correct location (or not). That
is why it works on some compilers but not on g++ 5.3.1. Touching
any `this->[smth]` is undefined after that.
The fix is just move `transitionFrameFn = nullptr` to the last
thing we do on the callback. This behaves similarly to calling
`delete this` on a class method.
All Transform methods that take a PrecisionPoint now assume a “flipped” origin at the upper-left corner of the view. Previously, some methods assumed an origin at the lower-left corner.
Eliminated many redundant methods on Transform. Minimized usage of TransformState::x and TransformState::y. Added convenient constructors for AnimationOptions. When scaling, passing in view’s origin as the anchor no longer anchors the scaling operation at the view’s center. To specify no anchor, use NaN.
Increased precision of worldSize(), now that it’s used much more heavily in transform methods.
Even if the map supports wrapping the world, it isn’t necessary to show more than one full revolution of the world at a time. Removed a redundant zoom level clamp.
Greatly simplified conversions between zoom level and altitude. Adjusted field of view to more closely match MapKit. Conversions are now well within the same order of magnitude as MapKit at all latitudes.
Fixes#2266.
The speed and curve fields in CameraOptions have been replaced with velocity and minZoom fields, which expressed in screen units. Scaling and easing make it difficult to derive options that are expressed in physical units.
Rewrote the flyTo implementation to more closely match GL JS’s implementation and the paper on which it is based.
Rewrote CameraOptions documentation. Only document units for generic types like double. The semantics of LatLng and Duration are already baked into the types; one just needs to look up the types’ definitions. Also, the […) is set notation, so the braces are supposed to be mismatched.
Fixes#3296.
Corrected some fairly opaque code that was incorrectly ported from GL JS the first time around in #3171, causing the trajectory to extend far into the Earth’s orbit. Also transition pitch while flying, call transition frame/finish callback functions, and recognize the same “speed” and “curve” parameters that GL JS does.
Fixes#3296, fixes#3297.
Added transition frame and finish functions to CameraOptions. Added Objective-C equivalents to the three main entry points to easeTo() in MGLMapView.
Fixes#1581.
ConstrainMode gives flexibility to our engine to choose between
constraining both vertically and horizontally, or just vertically
(default behavior).
Constrain in both axis means we can no longer pan the map beyond the map
boundaries. This fixes an issue where e.g. annotations disappear upon
crossing the map boundaries.
In MapContext thread, TransformState gets updated from main thread to
MapContext and Painter can safely reference MapContext's TransformState
instead of copying it upon each Painter::render call.
Make use of PrecisionPoint's operator functionalities inherited from
vec2<> and reduced overhead eg. offset_y is always 0 so no need to add
this to calculation inside the if.
Corrected Transform::_setScale() after the refactoring in 5a24ac605b for #2994. This change also addresses two dead store warnings from the static analyzer.
Pass-by-const-ref is not always possible because CameraOptions gets its
members modified along the way.
Also fixes a case in Map::jumpTo where Update::Zoom should be called if
zoom is affected.
The final frame is self-destructing – it destroys the frame and finish functions – so technically we’re no longer inTransition(). Yet there still needs to be an update after that final frame.
Also, avoid a redundant change notification on the last frame. (It would come too late, after the DidChange notification, anyhow.)
Fixes#2946.
The location under your finger stays under your finger as you pan.
The location you double tap to zoom stays at the same point.
The location at the center of a pinch zoom stays at the center.
The location at the center of a rotation stays at the center.
Plumbed camera options all the way through to MGLMapView. Added a method that lets you specify a direction in addition to center point and zoom level.
Added Map::jumpTo() for parity with mapbox-gl-js. Replaced usage of Map::setLatLng() and Map::setLatLngZoom() with Map::jumpTo() or Map::easeTo() within MGLMapView. Replaced MGLMapView.pitch with MGLMapCamera for setting all supported degrees of freedom simultaneously. Simultaneously move and rotate with course.
Support customizable timing functions on iOS.
iosapp now persists an archived MGLMapCamera instead of separate viewpoint properties and also synchronizes user defaults on termination. This change implements persistence entirely in Objective-C, eliminating the use of the Objective-C++ implementation.
Fixes#1643, fixes#1834. Ref #1581.
Transform::{_moveBy,_setAngle} were returning Update::Nothing, causing
the render to not repaint. Replacing with Update::Repaint fixes the
issue.
Fixes#2036.