Commit Graph

41 Commits

Author SHA1 Message Date
Bruno de Oliveira Abinader
fc2fa73363 [core] Cleanup Transform::rotateBy
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.
2015-11-12 10:46:50 -08:00
Bruno de Oliveira Abinader
8b76f00d8c [core] PrecisionPoint is now a vec2<double>
We could reuse all the operators defined in vec2<>, including operator
bool() that checks if the contained values are !NaN.
2015-11-12 10:46:50 -08:00
Minh Nguyễn
aae7f90e37 [core] Fixed Transform::_setScale()
Corrected Transform::_setScale() after the refactoring in 5a24ac605b for #2994. This change also addresses two dead store warnings from the static analyzer.
2015-11-12 10:46:43 -08:00
Bruno de Oliveira Abinader
cd0266f25c [core] Added more NaN checks in Transform 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
5a24ac605b [core] Use PrecisionPoint in zoom and angle functions 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
99ac8d8720 [core] Use pass-by-ref in CameraOptions
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.
2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
c78e769635 [core] Use PrecisionPoint in coordinate functions 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
e2052ea3e4 [core] Added PrecisionPoint to represent pixel points 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
e5c460f2db [core] Added isValid to geo helper structs 2015-11-11 16:59:49 +02:00
Minh Nguyễn
17451418cc [core] Update after final frame of transition
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.
2015-11-06 11:06:53 -08:00
Ansis Brammanis
750c72f324 improve gestures in perspective view
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.
2015-10-26 12:48:03 -07:00
Minh Nguyễn
0a172a21fd CameraOptions
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.
2015-09-07 09:22:52 -07:00
Bruno de Oliveira Abinader
0b501e0566 Substitute nudgeTransitions with async view invalidation 2015-09-02 23:20:46 +03:00
Ansis Brammanis
14dee43a71 add map.setPitch(pitch) and map.getPitch() 2015-08-24 18:41:51 -04:00
Bruno de Oliveira Abinader
5ff855bb00 Fix Update flags in mbgl::Transform
Transform::{_moveBy,_setAngle} were returning Update::Nothing, causing
the render to not repaint. Replacing with Update::Repaint fixes the
issue.

Fixes #2036.
2015-08-13 10:17:08 +03:00
Bruno de Oliveira Abinader
ac9d5886f0 Added operator implementations for mbgl::Update enum class 2015-08-13 10:12:48 +03:00
Bruno de Oliveira Abinader
58357b7964 Removed Transform::needsTransition()
Transform::updateTransitions() already checks if there is a callback to
update transitions.
2015-08-05 15:19:00 +03:00
Konstantin Käfer
78ec33320f don't use certain STL functions
some functions defined in <cmath>, as well as std::to_string aren't available on GNU's STL for some platforms, e.g. Android
2015-08-04 14:08:19 +02:00
Bruno de Oliveira Abinader
2aad2f4e14 Pass {Duration,TimePoint} by const ref if possible 2015-07-14 16:48:34 +03:00
Konstantin Käfer
675ddddee7 Make pixelRatio constant across a Map object lifetime
also moves framebuffer size out of TransformState into its own object
2015-07-08 10:40:05 +02:00
Minh Nguyễn
08acb65b1c Eliminated map overrotation on drift pan
Wrap the angle on each interpolated step instead of when normalizing.
2015-07-06 13:08:59 -07:00
Minh Nguyễn
46a6173bd7 [wrap)
If (wrap] is desired, it is the responsibility of the caller to handle the case in which min is returned.
2015-07-06 13:07:34 -07:00
John Firebaugh
95351dd906 Send MapChangeRegionIsChanging notifications 2015-06-26 10:32:07 -07:00
John Firebaugh
d193083513 Remove duration argument from View::notifyMapChange
Fixes #1026
2015-06-26 10:32:07 -07:00
John Firebaugh
e6a576f6eb currentState() ⇢ getState() 2015-06-26 10:32:07 -07:00
John Firebaugh
07a6d2ef64 Move Transform from MapData to Map
Pass current state to MapContext where needed. Remove mutex from
Transform.
2015-06-26 10:32:07 -07:00
John Firebaugh
e87a36444f Move getMin/MaxZoom to TransformState 2015-06-26 10:32:07 -07:00
John Firebaugh
4ba78b6bcf Transform needs only a single TransformState 2015-06-24 13:08:36 -07:00
Konstantin Käfer
f4707f72e0 Replace mbgl::util::make_unique<> with std::make_unique<> 2015-05-26 17:57:38 +02:00
Minh Nguyễn
b6765a2eb1 Merge pull request #1453 from mapbox/1ec5-whee-2
Prevent full-circle spin during animated rotation
2015-05-19 16:18:26 -07:00
Konstantin Käfer
24ea920810 ignore Transform changes with NaN parameters 2015-05-08 20:25:47 +02:00
Minh Nguyễn
d876274ad1 Prevent full-circle spin during animated rotation
#1295 made #1199 a lot less common, but it was still possible for the map to do a full 180° when drift-rotating past due-south. With this change, the map is atomically rotated to a bearing in the same cycle as the final bearing.

/cc @friedbunny
2015-05-06 16:38:59 -07:00
Dane Springmeyer
33f30aae93 fix integer division to work in doubles in transform.cpp 2015-05-03 23:23:13 -07:00
Ansis Brammanis
ed9ef0f7d1 fix pixelForLatLng during animated zoom
fix #1160
2015-04-30 16:03:35 -07:00
Minh Nguyễn
8b44cfeb76 Ensure correct spin direction
Ported mapbox/mapbox-gl-js#821 as well as `util.wrap()` from mapbox-gl-js.

Fixes #1199.
2015-04-18 22:14:39 -07:00
John Firebaugh
12c07b916b Rework easing transition code
This brings the easing transition code a bit closer to how easings work
in gl-js. Instead of having an array of individual transitions for scale,
rotate, and pan, there is a single transition function that does all the
required calculations. This permits us to:

* Eliminate the "timeout" transition. (Fixes #126)
* Replace start/stopPanning() et al with setGestureInProgress(). Apps or
  SDKs are expected to make paired calls to setGestureInProgress(). This
  state will be ORed with the active easing state to determine when to
  use texture interpolation. (Fixes #79)
* Run style recalculations only when an ease transition that affects the
  zoom is in progress. (Fixes #1155)
2015-04-02 16:12:29 -07:00
John Firebaugh
9331acf8e6 Add typedefs for std::chrono::steady_clock types 2015-04-02 12:28:12 +02:00
Justin R. Miller
6e41664cb0 fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS 2015-02-16 09:52:36 -08:00
Leith Bade
89bbd29278 Use std::chrono 2015-02-04 09:39:25 +11:00
Leith Bade
0771e50460 Rename View functions to match conventions. Also tidy up view classes and remove C style casts. Closes #656 2014-12-23 09:29:45 +13:00
Konstantin Käfer
abafb52f37 make most headers private 2014-12-04 20:02:50 +01:00