-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refs #6779: mobile SDK style transition options #7711
Changes from 1 commit
aeb20cb
b2b0198
705cb6b
fb9c416
59f5e7a
2c68ae7
2f4ee9c
16d6a05
530e32b
6ddc216
1fa75dd
71947b6
264005b
d2d4af9
37f3c54
6745984
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -568,6 +568,34 @@ - (MGLImage *)imageForName:(NSString *)name | |
return spriteImage ? [[MGLImage alloc] initWithMGLSpriteImage:spriteImage] : nil; | ||
} | ||
|
||
#pragma mark Style transitions | ||
|
||
- (void)setTransitionDuration:(NSTimeInterval)duration | ||
{ | ||
mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
transitionOptions.duration = MGLDurationInSeconds(duration); | ||
self.mapView.mbglMap->setTransitionOptions(transitionOptions); | ||
} | ||
|
||
- (NSTimeInterval)transitionDuration | ||
{ | ||
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions(); | ||
return MGLSecondsFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero())); | ||
} | ||
|
||
- (void)setTransitionDelay:(NSTimeInterval)delay | ||
{ | ||
mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions(); | ||
transitionOptions.delay = MGLDurationInSeconds(delay); | ||
self.mapView.mbglMap->setTransitionOptions(transitionOptions); | ||
} | ||
|
||
- (NSTimeInterval)transitionDelay | ||
{ | ||
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions(); | ||
return MGLSecondsFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero())); | ||
} | ||
|
||
- (NSString *)description | ||
{ | ||
return [NSString stringWithFormat:@"<%@: %p; name = %@, URL = %@>", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ | |
/// Converts from a duration in seconds to a duration object usable in mbgl. | ||
mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration); | ||
|
||
/// Converts from an mbgl duration object to a duration in seconds. | ||
NSTimeInterval MGLSecondsFromDuration(mbgl::Duration duration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then should we not also rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, took me a while to figure that out, but true. Do you think it's worth adding an assertion or other check here that it remains in seconds in this part of the code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I don’t think that’s an issue with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These options should be exposed as properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b2b0198