diff options
Diffstat (limited to 'platform/darwin/src/MGLBackgroundStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLBackgroundStyleLayer.mm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index bcad0aa11b..8f416a0ea2 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -4,6 +4,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 "MGLBackgroundStyleLayer.h" @@ -101,6 +102,24 @@ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } +- (void)setBackgroundColorTransition:(MGLTransition )transition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; + self.rawLayer->setBackgroundColorTransition(options); +} + +- (MGLTransition)backgroundColorTransition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition(); + MGLTransition transition; + transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); + transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); + + return transition; +} + - (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity { MGLAssertStyleLayerIsValid(); @@ -118,6 +137,24 @@ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } +- (void)setBackgroundOpacityTransition:(MGLTransition )transition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; + self.rawLayer->setBackgroundOpacityTransition(options); +} + +- (MGLTransition)backgroundOpacityTransition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition(); + MGLTransition transition; + transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); + transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); + + return transition; +} + - (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern { MGLAssertStyleLayerIsValid(); @@ -135,5 +172,22 @@ return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue); } +- (void)setBackgroundPatternTransition:(MGLTransition )transition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } }; + self.rawLayer->setBackgroundPatternTransition(options); +} + +- (MGLTransition)backgroundPatternTransition { + MGLAssertStyleLayerIsValid(); + + mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition(); + MGLTransition transition; + transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); + transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); + + return transition; +} @end |