Commit Graph

200 Commits

Author SHA1 Message Date
Minh Nguyễn
8a23bdcd01 [core, ios, osx] Tilt around visual center point
The tilt gesture on both iOS and OS X now respects the content insets. On iOS, in user tracking mode, it additionally respects the user dot’s position if it’s aligned to the top or bottom of the view.
2016-01-26 18:49:01 -08:00
John Firebaugh
9b62661b07 [core] Use experimental optional instead of mapbox::util::optional 2016-01-19 17:56:48 -08:00
Minh Nguyễn
47b69100f9 [core, ios, osx, android, glfw] Flipped origin of Map::latLngForPixel(), Map::pixelForLatLng()
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.
2016-01-18 16:54:58 -08:00
Minh Nguyễn
bf87eaa7b8 [core, osx] Added optional padding to convenience methods
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.
2016-01-18 16:54:58 -08:00
Minh Nguyễn
143f8a7817 [core] Added padding option to CameraOptions
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.
2016-01-18 16:54:57 -08:00
Minh Nguyễn
27b308a234 [core] Separated AnimationOptions from CameraOptions 2016-01-14 00:39:12 -08:00
Minh Nguyễn
a5230f3e11 [core] Clamp pitch in easeTo(), flyTo()
Also factored out the maximum pitch into a constant.
2015-12-19 23:14:01 -08:00
John Firebaugh
110f1ec796 [ios, android] Add methods to remove a custom layer 2015-12-17 15:15:55 -08:00
Minh Nguyễn
e304033552 [core] Fixed annotation icon replacement
Another pass at #3146, including a unit test.
2015-12-15 21:04:15 -08:00
Romain Quidet
af45d87e54 2210: Sprites can be removed / updated correctly 2015-12-15 16:36:17 -08:00
Konstantin Käfer
4fc8226838 [core] allow changing the orientation
You can now change the orientation of north to be to the right, bottom, left in addition to the default of top
2015-12-15 11:41:58 -08:00
John Firebaugh
65b3220368 [core] Reduce custom layer API to lowest common denominator 2015-12-11 12:44:54 -08:00
Adam Hunter
095a8be300 Implementation of flyTo. 2015-12-09 17:14:22 -08:00
John Firebaugh
bde07c8f0e [core] Custom layers 2015-12-09 13:51:28 -08:00
Konstantin Käfer
d5fb535058 [core] add namespace comment to closing brace 2015-12-03 15:38:36 +01:00
John Firebaugh
8afa14fa78 [core] Map::setSprite ⇢ Map::addAnnotationIcon
Fixes #3084
2015-12-01 15:10:28 -08:00
John Firebaugh
58886842bc [core] Move MapData storage to MapContext
This allows MapData members to hold GL resources which must be released
on the MapContext thread -- necessary for the following commit.
2015-12-01 09:15:05 -08:00
Bruno de Oliveira Abinader
92856f394c [core] Collision debug is now MapDebugOptions::Collision 2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
1f0820c8e8 [core] Added MapDebugOptions
Map debug options are now cycled up to all debug options enabled, then
back to none.
2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
adfac6f061 [core] Added ConstrainMode::{HeightOnly,WidthAndHeight}
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.
2015-11-18 09:37:27 +02: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
Bruno de Oliveira Abinader
aa8857643d [core] Added MetersBounds 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
41120774af [core] Expose default fade duration to Map API 2015-11-10 10:28:16 +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
John Firebaugh
014b517820 [node] Output debug logs when a render test times out 2015-10-28 15:54:34 -07: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
Bruno de Oliveira Abinader
5fa144647d [core] Added GLContextMode to MapData
Adding new mbgl::GLContextMode enum to mbgl::Map ctor, which gets stored
in MapData. In shared GL context environments, we cannot assume that the
GL state that has been left since the last draw is the same, so we reset
the GL configurations to their default values.
2015-10-22 16:02:39 -07:00
Bruno de Oliveira Abinader
5db4670d78 [core] Added more transform state getters
Some platforms requires specific information that was previously not
available in public API, but stored internally in TransformState object.
2015-10-21 11:06:51 -07:00
John Firebaugh
c5b95032a5 [core] Annotation refactor 2015-10-20 13:54:19 -07:00
John Firebaugh
597b2b4851 [core] Pull annotation typedefs to own header; add AnnotationID 2015-10-20 13:54:19 -07:00
Leith Bade
2ee7b02189 [core] [android] Fix InfoWindow topOffsetPixels adjustment when switching styles
Fixes #2599
Make getTopOffsetPixelsForAnnotationSymbol private
Also implements MapChangeWillStartLoadingMap, MapChangeDidFinishLoadingMap
Paritally implements #630
2015-10-16 13:06:49 +11:00
Leith Bade
154e27968f [core] Protect MapData.pause with a lock
Fixes #2522
2015-10-08 11:36:22 +11:00
Leith Bade
b869771992 Correctly handle spurious wake-ups in Map::pause()
Fixes #2522
2015-10-06 14:10:32 +11:00
Mike Morris
b46c102eb0 mason variant@1.0 2015-09-30 15:34:40 -07:00
Adam Hunter
fa2d7453a5 Fix up of some naming issues, etc. 2015-09-29 15:07:39 -07:00
Adam Hunter
3f9f259619 Added GL logging utility 2015-09-29 15:07:39 -07:00
John Firebaugh
af392b9434 Rewrite annotation invalidation strategy
First, move style mutation code out of StyleParser and into AnnotationManager,
coalescing it with the mutation code for shape layers.

Second, allow AnnotationManager to keep track of stale tiles entirely
internally. There's no reason to pass sets of TileIDs around.

Third, correct the logic for invalidating the shape source. Since
AnnotationManager does not track shape invalidations on a tile-by-tile basis,
don't try to invalidate the shape source tile-by-tile.

Fixes #1675
Fixes #2322
Fixes #2095
2015-09-28 14:10:23 -07:00
Leith Bade
d2d3df2a69 Fix freezing on Android when rotating
Fixes #1941
2015-09-22 16:40:04 +10: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
0ff7cf20e9 Get rid of MapData::{get,set}NeedsRepaint 2015-09-02 23:20:47 +03:00
Bruno de Oliveira Abinader
0b501e0566 Substitute nudgeTransitions with async view invalidation 2015-09-02 23:20:46 +03:00
Ansis Brammanis
51c93867ae fix LatLng --> point for perspective views 2015-08-24 18:41:51 -04:00
Ansis Brammanis
14dee43a71 add map.setPitch(pitch) and map.getPitch() 2015-08-24 18:41:51 -04:00
Bruno de Oliveira Abinader
ac9d5886f0 Added operator implementations for mbgl::Update enum class 2015-08-13 10:12:48 +03:00
Konstantin Käfer
21ec505648 add benchmark mode that shows the real frame time rather than the vsync time 2015-08-11 16:40:40 +03:00
Bruno de Oliveira Abinader
fa4636ffe4 Map::nudgeTransitions no longer depends on client information
Clients no longer need to provide data (eg. if gesturing or in a custom
animation) to Map::nudgeTransitions().

Upon MapContext::renderSync(), a new atomic bool 'needsRepaint' in MapData
allows thread-safe communication between Map and MapContext.
2015-08-05 15:19:00 +03:00