summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2017-01-18 12:43:08 -0800
committerGitHub <noreply@github.com>2017-01-18 12:43:08 -0800
commitf6715694f918a884eda77151aa4fec05521b9536 (patch)
treebd930307db9fb13ad5751324ae57bf858f30aa2a /platform/ios
parentd076ba05673a6ced9d3e641e2c7a2b5f3c70a80f (diff)
downloadqtlocation-mapboxgl-f6715694f918a884eda77151aa4fec05521b9536.tar.gz
refs #6779: mobile & Mac SDK style transition options (#7711)
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/app/MBXViewController.m2
-rw-r--r--platform/ios/src/MGLMapView.mm24
3 files changed, 15 insertions, 12 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 00fdf9f2c1..86d96750d7 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Improved the line wrapping behavior of point-placed labels written in Chinese, Japanese, and Yi. ([#6828](https://github.com/mapbox/mapbox-gl-native/pull/6828))
* Fixed an issue where translucent, non-view-backed point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832))
* Added a Simplified Chinese localization. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316))
+* Support for style-wide transition animation duration and delay. [#6779](https://github.com/mapbox/mapbox-gl-native/issues/6779)
## 3.4.0
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index a14ad9350f..63cde71f27 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -819,6 +819,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
- (void)styleBuildingLayer
{
+ self.mapView.style.transitionDuration = 5;
+ self.mapView.style.transitionDelay = 1;
MGLFillStyleLayer *buildingLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"building"];
buildingLayer.fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor blackColor]];
}
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index c211d4419b..e6ebd4492f 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1226,7 +1226,7 @@ public:
if (drift)
{
CGPoint offset = CGPointMake(velocity.x * self.decelerationRate / 4, velocity.y * self.decelerationRate / 4);
- _mbglMap->moveBy({ offset.x, offset.y }, MGLDurationInSeconds(self.decelerationRate));
+ _mbglMap->moveBy({ offset.x, offset.y }, MGLDurationInSecondsFromTimeInterval(self.decelerationRate));
}
[self notifyGestureDidEndWithDrift:drift];
@@ -1316,7 +1316,7 @@ public:
if (velocity && duration)
{
- _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSeconds(duration));
+ _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSecondsFromTimeInterval(duration));
}
[self notifyGestureDidEndWithDrift:velocity && duration];
@@ -1375,7 +1375,7 @@ public:
CGFloat newRadians = radians + velocity * decelerationRate * 0.1;
CGFloat newDegrees = MGLDegreesFromRadians(newRadians) * -1;
- _mbglMap->setBearing(newDegrees, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSeconds(decelerationRate));
+ _mbglMap->setBearing(newDegrees, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSecondsFromTimeInterval(decelerationRate));
[self notifyGestureDidEndWithDrift:YES];
@@ -1504,7 +1504,7 @@ public:
CGPoint gesturePoint = [self anchorPointForGesture:doubleTap];
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
- _mbglMap->scaleBy(2, center, MGLDurationInSeconds(MGLAnimationDuration));
+ _mbglMap->scaleBy(2, center, MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration));
__weak MGLMapView *weakSelf = self;
@@ -1532,7 +1532,7 @@ public:
CGPoint gesturePoint = [self anchorPointForGesture:twoFingerTap];
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
- _mbglMap->scaleBy(0.5, center, MGLDurationInSeconds(MGLAnimationDuration));
+ _mbglMap->scaleBy(0.5, center, MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration));
__weak MGLMapView *weakSelf = self;
@@ -2288,7 +2288,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration)
{
- animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2329,7 +2329,7 @@ public:
_mbglMap->setZoom(zoomLevel,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInset),
- MGLDurationInSeconds(duration));
+ MGLDurationInSecondsFromTimeInterval(duration));
}
- (void)setMinimumZoomLevel:(double)minimumZoomLevel
@@ -2441,7 +2441,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2489,13 +2489,13 @@ public:
{
_mbglMap->setBearing(direction,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInset),
- MGLDurationInSeconds(duration));
+ MGLDurationInSecondsFromTimeInterval(duration));
}
else
{
CGPoint centerPoint = self.userLocationAnnotationViewCenter;
_mbglMap->setBearing(direction, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y },
- MGLDurationInSeconds(duration));
+ MGLDurationInSecondsFromTimeInterval(duration));
}
}
@@ -2548,7 +2548,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration.emplace(MGLDurationInSeconds(duration));
+ animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2594,7 +2594,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration >= 0)
{
- animationOptions.duration = MGLDurationInSeconds(duration);
+ animationOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
}
if (peakAltitude >= 0)
{