diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-03-10 11:33:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 11:33:31 -0800 |
commit | 20712b7c84bd91bcf658d74bf25f3460354b5fd6 (patch) | |
tree | c12fd8cf71d293ddfc123f9e1d0af1dafa887750 /platform/darwin/src/MGLStyleLayer.mm.ejs | |
parent | 4a0ce1365f469c5da30aa7136ec5d31dfd621ff1 (diff) | |
download | qtlocation-mapboxgl-20712b7c84bd91bcf658d74bf25f3460354b5fd6.tar.gz |
Per-attribute transition properties on MGLStyleLayer (#8225)
* [ios, macos] new struct MGLTransition
* [ios] MGLTransition struct moved to MGLTypes.h
* [ios] MGLTransition implemented for style layer properties
* [ios, macos] added support for getting property transitions
* [ios, macos] updated to MGLDurationFromTimeInterval and MGLTimeIntervalFromDuration
* [ios, macos] added transition properties test
* [ios, macos] modified key strings imp
* [ios, macos] The impl for transition properties were changed to public methods
* [ios, macos] Changelog update
* [ios] Fixed layer space formatting
* [core] The name space was fixed for getters that returned TransitionOptions
* [ios, macos] Added rawLayer transition property tests
* [ios] Added a factory method for MGLTransition and transition-related methods to NSValue(MGLAdditions)
* [ios, macos] Copyedited changelog blurbs about transition properties
Diffstat (limited to 'platform/darwin/src/MGLStyleLayer.mm.ejs')
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 24aff7fca8..1e5f3df160 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -10,6 +10,7 @@ #import "MGLSource.h" #import "MGLMapView_Private.h" #import "NSPredicate+MGLAdditions.h" +#import "NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" #import "MGLStyleValue_Private.h" #import "MGL<%- camelize(type) %>StyleLayer.h" @@ -228,8 +229,8 @@ namespace mbgl { <% } -%> <% if (paintProperties.length) { -%> #pragma mark - Accessing the Paint Attributes - <% for (const property of paintProperties) { -%> + - (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> { MGLAssertStyleLayerIsValid(); @@ -270,15 +271,34 @@ namespace mbgl { <% } -%> <% } -%> } +<% if (property["transition"]) { -%> + +- (void)set<%- camelize(property.name) %>Transition:(MGLTransition )transition { + MGLAssertStyleLayerIsValid(); + mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; + self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options); +} + +- (MGLTransition)<%- objCGetter(property) %>Transition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions transitionOptions = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition(); + MGLTransition transition; + transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); + transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); + + return transition; +} +<% } -%> <% if (property.original) { -%> + - (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> { } - (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> { return self.<%- objCGetter(property) %>; } - <% } -%> <% } -%> <% } -%> |