diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h index ebf7509a313..727e23c5e2c 100644 --- a/include/mbgl/ios/MGLMapView.h +++ b/include/mbgl/ios/MGLMapView.h @@ -82,6 +82,9 @@ IB_DESIGNABLE /** The button shown in the lower-right of the map which when pressed displays the map attribution information. */ @property (nonatomic, readonly) UIButton *attributionButton; +/** Defines with insets an area where the contents (marker, user position) of the map will be centered.*/ +@property (nonatomic) UIEdgeInsets mapViewInsets; + #pragma mark - Accessing the Delegate /** @name Accessing the Delegate */ diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 2be31b5db6c..b1d1c4e592d 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -132,6 +132,7 @@ class Map : private util::noncopyable { // Pitch void setPitch(double pitch, const Duration& = Duration::zero()); double getPitch() const; + void setPitching(bool pitching); // North Orientation void setNorthOrientation(NorthOrientation); @@ -187,6 +188,10 @@ class Map : private util::noncopyable { bool isFullyLoaded() const; void dumpDebugLogs() const; + + // Insets + void setInsets(EdgeInsets insets); + EdgeInsets getInsets() const; private: View& view; diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index 6f481c44585..1ea90155537 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -7,6 +7,8 @@ #include #include +#include + namespace mbgl { class Map; diff --git a/ios/app/MBXDebugView.h b/ios/app/MBXDebugView.h new file mode 100644 index 00000000000..2a4f4d05298 --- /dev/null +++ b/ios/app/MBXDebugView.h @@ -0,0 +1,17 @@ +// +// MBXDebugView.h +// ios +// +// Created by Mappy SA on 04/01/2016. +// +// + +#import + +@interface MBXDebugView : UIView + +@property (nonatomic, assign) UIEdgeInsets insets; + +- (instancetype)initWithFrame:(CGRect)frame andWithInsets:(UIEdgeInsets) insets; + +@end diff --git a/ios/app/MBXDebugView.m b/ios/app/MBXDebugView.m new file mode 100644 index 00000000000..7386c027317 --- /dev/null +++ b/ios/app/MBXDebugView.m @@ -0,0 +1,39 @@ +// +// MBXDebugView.m +// ios +// +// Created by Mappy SA on 04/01/2016. +// +// + +#import "MBXDebugView.h" + +@implementation MBXDebugView + +- (instancetype)initWithFrame:(CGRect)frame andWithInsets:(UIEdgeInsets) insets { + if (self = [super initWithFrame:frame]) { + self.insets = insets; + self.backgroundColor = [UIColor clearColor]; + [self setUserInteractionEnabled:NO]; + } + return self; +} + +- (void)drawRect:(__unused CGRect) rect{ + UIEdgeInsets insets = self.insets; + CGContextRef context = UIGraphicsGetCurrentContext(); + CGRect insetsRect = CGRectMake(insets.left, + insets.top, + self.frame.size.width - insets.right - insets.left, + self.frame.size.height - insets.bottom - insets.top); + + UIColor * redColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0]; + + CGContextSetStrokeColorWithColor(context, redColor.CGColor); + CGContextStrokeRect(context, insetsRect); + CGPoint center = CGPointMake(CGRectGetMidX(insetsRect), CGRectGetMidY(insetsRect)); + CGRect circleRect = CGRectMake(center.x - 10, center.y - 10, 20, 20); + CGContextStrokeEllipseInRect(context, circleRect); +} + +@end diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm index 21a6a2aeace..361ca08d665 100644 --- a/ios/app/MBXViewController.mm +++ b/ios/app/MBXViewController.mm @@ -6,6 +6,8 @@ #import #import +#import "MBXDebugView.h" + static UIColor *const kTintColor = [UIColor colorWithRed:0.120 green:0.550 blue:0.670 alpha:1.000]; static const CLLocationCoordinate2D WorldTourDestinations[] = { @@ -61,6 +63,7 @@ - (void)viewDidLoad [super viewDidLoad]; self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds]; + self.mapView.mapViewInsets = UIEdgeInsetsMake(0, 300, 200, 0); self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.mapView.delegate = self; [self.view addSubview:self.mapView]; @@ -91,6 +94,9 @@ - (void)viewDidLoad [self.mapView addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]]; [self restoreState:nil]; + + MBXDebugView *debugView = [[MBXDebugView alloc] initWithFrame:self.mapView.frame andWithInsets:self.mapView.mapViewInsets]; + [self.view addSubview:debugView]; } - (void)saveState:(__unused NSNotification *)notification diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java index 392b26ed8fa..4523b2ad04f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java @@ -57,6 +57,7 @@ import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.Icon; +import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.InfoWindow; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; @@ -64,7 +65,6 @@ import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; -import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdate; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -1368,6 +1368,10 @@ public void setZoomLevel(@FloatRange(from = 0.0, to = MAXIMUM_ZOOM_LEVEL) double mNativeMapView.setZoom(zoomLevel, duration); } + public void setMapPadding(int left, int top, int right, int bottom) { + mNativeMapView.setInsets(top / mScreenDensity, left / mScreenDensity, bottom / mScreenDensity, right / mScreenDensity); + } + /** * Returns whether the user may zoom the map. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java index 6df0defe352..6ed90c2f4dd 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java @@ -468,6 +468,8 @@ public void removeCustomLayer(String id) { nativeRemoveCustomLayer(mNativeMapViewPtr, id); } + public void setInsets(double top, double left, double bottom, double right) {nativeSetInsets(mNativeMapViewPtr, top, left, bottom, right);} + // // Callbacks // @@ -658,4 +660,6 @@ private native void nativeSetVisibleCoordinateBounds(long mNativeMapViewPtr, Lat private native void nativeAddCustomLayer(long nativeMapViewPtr, CustomLayer customLayer, String before); private native void nativeRemoveCustomLayer(long nativeMapViewPtr, String id); + + private native void nativeSetInsets(long nativeMapViewPtr, double top, double left, double bottom, double right); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java index 506805784e7..2c2261a47cb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java @@ -60,6 +60,10 @@ public class MainActivity extends AppCompatActivity { // Used for info window private static final DecimalFormat LAT_LON_FORMATTER = new DecimalFormat("#.#####"); + public static final int LEFT = 100; + public static final int TOP = 400; + public static final int RIGHT = 200; + public static final int BOTTOM = 10; // // Instance members @@ -178,6 +182,9 @@ public void onMyLocationChange(@Nullable Location location) { } }); + findViewById(R.id.debugView).setPadding(LEFT, TOP, RIGHT, BOTTOM); + mMapView.setMapPadding(LEFT, TOP, RIGHT, BOTTOM); + mFpsTextView = (TextView) findViewById(R.id.view_fps); mFpsTextView.setText(""); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/debug_view_background.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/debug_view_background.xml new file mode 100644 index 00000000000..ae351572cea --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/debug_view_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml index 24f83d36e25..11a708b8afa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml @@ -1,69 +1,85 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="@color/primary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> + android:id="@+id/content_frame" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@+id/toolbar"> + android:id="@+id/coordinator_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/mainMapView" + android:layout_width="match_parent" + android:layout_height="match_parent"/> + android:id="@+id/view_fps" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="10dp" + android:text="@string/label_fps" + android:textAppearance="?android:attr/textAppearanceLarge"/> + android:id="@+id/locationFAB" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end|bottom" + android:layout_margin="@dimen/fab_margin" + android:src="@drawable/ic_gps_fixed_24dp" + app:backgroundTint="@color/white"/> + + + + + + + + + android:id="@+id/nav_view" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="start" + android:fitsSystemWindows="true" + app:menu="@menu/menu_drawer"/> diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 9a4db6ddfe1..1f61158bcfb 100644 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -1544,6 +1544,14 @@ void JNICALL nativeEaseTo(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdou nativeMapView->getMap().easeTo(options); } +void JNICALL nativeSetInsets(JNIEnv *env, jobject obj,long nativeMapViewPtr, double top, double left, double bottom, double right) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetInsets"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + mbgl::EdgeInsets insets = {top, left, bottom, right}; + nativeMapView->setInsets(insets); +} + void JNICALL nativeFlyTo(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble angle, jobject centerLatLng, jlong duration, jdouble pitch, jdouble zoom) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeFlyTo"); assert(nativeMapViewPtr != 0); @@ -2130,6 +2138,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeAddCustomLayer)}, {"nativeRemoveCustomLayer", "(JLjava/lang/String;)V", reinterpret_cast(&nativeRemoveCustomLayer)}, + {"nativeSetInsets", "(JDDDD)V", + reinterpret_cast(&nativeSetInsets)} }; if (env->RegisterNatives(nativeMapViewClass, methods.data(), methods.size()) < 0) { diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 30fdee81b91..4d3f340c88d 100644 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -751,5 +751,12 @@ void NativeMapView::resizeFramebuffer(int w, int h) { map->update(mbgl::Update::Repaint); } +void NativeMapView::setInsets(EdgeInsets insets) { + map->setInsets(insets); +} + +EdgeInsets NativeMapView::getInsets() { + return map->getInsets(); +} } } diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 7b5473d48c0..d6cc451959f 100644 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -53,6 +53,9 @@ class NativeMapView : public mbgl::View, private mbgl::util::noncopyable { void resizeView(int width, int height); void resizeFramebuffer(int width, int height); + void setInsets(EdgeInsets insets); + EdgeInsets getInsets(); + private: EGLConfig chooseConfig(const EGLConfig configs[], EGLint numConfigs); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 5eee1d52ffb..6f11e502849 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -270,7 +270,8 @@ - (void)commonInit // setup mbgl view const float scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale]; - _mbglView = new MBGLView(self, scaleFactor); + mbgl::EdgeInsets mapViewInsets = {self.mapViewInsets.top, self.mapViewInsets.left, self.mapViewInsets.bottom, self.mapViewInsets.right}; + _mbglView = new MBGLView(self, scaleFactor, mapViewInsets); // setup mbgl cache & file source NSString *fileCachePath = @""; @@ -557,6 +558,16 @@ - (void)setBounds:(CGRect)bounds [self setNeedsLayout]; } +- (void)setMapViewInsets:(UIEdgeInsets)mapViewInsets +{ + if (UIEdgeInsetsEqualToEdgeInsets(mapViewInsets, _mapViewInsets)) { + return; + } + _mapViewInsets = mapViewInsets; + _mbglMap->setInsets({_mapViewInsets.top, _mapViewInsets.left, _mapViewInsets.bottom, _mapViewInsets.right}); + [self setNeedsLayout]; +} + + (BOOL)requiresConstraintBasedLayout { return YES; @@ -1284,12 +1295,14 @@ - (void)handleTwoFingerDragGesture:(UIPanGestureRecognizer *)twoFingerDrag CGFloat pitchNew = currentPitch - (gestureDistance / slowdown); + _mbglMap->setPitching(pitchNew != currentPitch); _mbglMap->setPitch(pitchNew); [self notifyMapChange:mbgl::MapChangeRegionIsChanging]; } else if (twoFingerDrag.state == UIGestureRecognizerStateEnded || twoFingerDrag.state == UIGestureRecognizerStateCancelled) { + _mbglMap->setPitching(NO); [self notifyGestureDidEndWithDrift:NO]; [self unrotateIfNeededAnimated:YES]; } @@ -3363,8 +3376,8 @@ - (void)prepareForInterfaceBuilder class MBGLView : public mbgl::View { public: - MBGLView(MGLMapView* nativeView_, const float scaleFactor_) - : nativeView(nativeView_), scaleFactor(scaleFactor_) { + MBGLView(MGLMapView* nativeView_, const float scaleFactor_, mbgl::EdgeInsets insets_) + : nativeView(nativeView_), scaleFactor(scaleFactor_), insets(insets_) { } virtual ~MBGLView() {} @@ -3424,6 +3437,7 @@ void afterRender() override private: __weak MGLMapView *nativeView = nullptr; const float scaleFactor; + mbgl::EdgeInsets insets; }; @end diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 8fe73458fc8..02a0eebcbf4 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -129,6 +129,10 @@ void Map::setGestureInProgress(bool inProgress) { transform->setGestureInProgress(inProgress); update(Update::Repaint); } + +void Map::setPitching(bool pitching) { + transform->setPitching(pitching); +} bool Map::isGestureInProgress() const { return transform->isGestureInProgress(); @@ -146,6 +150,16 @@ bool Map::isPanning() const { return transform->isPanning(); } +#pragma mark - Insets + +void Map::setInsets(EdgeInsets insets) { + transform->setInsets(insets); +} + +EdgeInsets Map::getInsets() const { + return transform->getInsets(); +} + #pragma mark - void Map::jumpTo(const CameraOptions& options) { diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 7e9c0c4f417..f82bebee57d 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -98,6 +98,14 @@ void Transform::easeTo(const CameraOptions& options) { double xn = -latLng.longitude * state.Bc; double yn = 0.5 * state.Cc * std::log((1 + f) / (1 - f)); + + if (!state.isGestureInProgress()) { + double insetX = state.getInsetX(); + double insetY = state.getInsetY(); + xn = xn + insetX * std::cos( angle) + insetY * std::cos(state.pitch) * std::sin(angle); + yn = yn + insetX * std::sin(-angle) + insetY * std::cos(angle) * std::cos(state.pitch); + + } easeOptions.center.reset(); easeOptions.zoom.reset(); @@ -168,6 +176,11 @@ void Transform::setLatLngZoom(const LatLng& latLng, double zoom, const Duration& easeTo(options); } +void Transform::setInsets(EdgeInsets insets) { + state.insets = insets; + setLatLng(getLatLng()); +} + #pragma mark - Zoom @@ -594,6 +607,10 @@ void Transform::setPitch(double pitch, const Duration& duration) { easeTo(options); } +void Transform::setPitching(bool pitching) { + state.pitching = pitching; +} + double Transform::getPitch() const { return state.pitch; } diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp index b5bbe9d3005..b18f14139ed 100644 --- a/src/mbgl/map/transform.hpp +++ b/src/mbgl/map/transform.hpp @@ -36,6 +36,10 @@ class Transform : private util::noncopyable { void setLatLng(const LatLng&, const PrecisionPoint&, const Duration& = Duration::zero()); void setLatLngZoom(const LatLng&, double zoom, const Duration& = Duration::zero()); LatLng getLatLng() const { return state.getLatLng(); } + + // Insets + void setInsets(EdgeInsets insets); + EdgeInsets getInsets() const {return state.getInsets();}; // Zoom void scaleBy(double ds, const PrecisionPoint& center = { 0, 0 }, const Duration& = Duration::zero()); @@ -53,6 +57,7 @@ class Transform : private util::noncopyable { // Pitch void setPitch(double pitch, const Duration& = Duration::zero()); double getPitch() const; + void setPitching(bool pitching); // North Orientation void setNorthOrientation(NorthOrientation); diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index 2a594cef1ab..60bc71c7a6a 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -33,9 +33,13 @@ void TransformState::getProjMatrix(mat4& projMatrix) const { matrix::perspective(projMatrix, 2.0f * std::atan((getHeight() / 2.0f) / getAltitude()), double(getWidth()) / getHeight(), 0.1, farZ); - - matrix::translate(projMatrix, projMatrix, 0, 0, -getAltitude()); - + + // translate center according to insets + double insetX = isPitching() ? getInsetX() : 0; + double insetY = isPitching() ? getInsetY() : 0; + + matrix::translate(projMatrix, projMatrix, insetX, -insetY, -getAltitude()); + // After the rotateX, z values are in pixel units. Convert them to // altitude unites. 1 altitude unit = the screen height. matrix::scale(projMatrix, projMatrix, 1, -1, 1.0f / (rotatedNorth() ? getWidth() : getHeight())); @@ -101,6 +105,7 @@ double TransformState::getNorthOrientationAngle() const { #pragma mark - Position LatLng TransformState::getLatLng() const { +//return pointToLatLng(PrecisionPoint(width/2 + getInsetX(), height/2 + getInsetY())); LatLng ll; ll.longitude = -x / Bc; @@ -215,11 +220,14 @@ bool TransformState::isPanning() const { return panning; } +bool TransformState::isPitching() const { + return pitching && pitch != 0; +} + bool TransformState::isGestureInProgress() const { return gestureInProgress; } - #pragma mark - Projection double TransformState::lngX(double lng) const { @@ -379,8 +387,8 @@ void TransformState::setLatLngZoom(const LatLng &latLng, double zoom) { const double f = util::clamp(std::sin(util::DEG2RAD * latLng.latitude), -m, m); PrecisionPoint point = { - -latLng.longitude * Bc, - 0.5 * Cc * std::log((1 + f) / (1 - f)), + -latLng.longitude * Bc + getInsetX(), + 0.5 * Cc * std::log((1 + f) / (1 - f)) + getInsetY(), }; setScalePoint(newScale, point); } @@ -397,4 +405,11 @@ void TransformState::setScalePoint(const double newScale, const PrecisionPoint & Cc = worldSize() / util::M2PI; } +double TransformState::getInsetX() const { + return (insets.left - insets.right) / 2; +} + +double TransformState::getInsetY() const { + return (insets.top - insets.bottom) / 2; +} diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp index 9ae2f62a46d..a3c40ac144c 100644 --- a/src/mbgl/map/transform_state.hpp +++ b/src/mbgl/map/transform_state.hpp @@ -12,6 +12,8 @@ #include #include +#include + namespace mbgl { class TileID; @@ -45,6 +47,9 @@ class TransformState { LatLng getLatLng() const; double pixel_x() const; double pixel_y() const; + + // Insets + EdgeInsets getInsets() const {return insets;}; // Zoom float getNormalizedZoom() const; @@ -65,6 +70,7 @@ class TransformState { bool isRotating() const; bool isScaling() const; bool isPanning() const; + bool isPitching() const; bool isGestureInProgress() const; // Conversion and projection @@ -103,6 +109,8 @@ class TransformState { void setLatLngZoom(const LatLng &latLng, double zoom); void setScalePoint(const double scale, const PrecisionPoint &point); + double getInsetX() const; + double getInsetY() const; private: ConstrainMode constrainMode; @@ -111,10 +119,12 @@ class TransformState { bool rotating = false; bool scaling = false; bool panning = false; + bool pitching = false; bool gestureInProgress = false; // map position double x = 0, y = 0; + EdgeInsets insets = {0,0,0,0}; double angle = 0; double scale = 1; double altitude = 1.5; diff --git a/src/mbgl/map/view.cpp b/src/mbgl/map/view.cpp index 9e3352daa89..ee37f3d4ff7 100644 --- a/src/mbgl/map/view.cpp +++ b/src/mbgl/map/view.cpp @@ -1,5 +1,4 @@ #include -#include #include @@ -18,5 +17,4 @@ void View::notifyMapChange(MapChange) { // no-op } - } // namespace mbgl