зеркало из https://github.com/github/Rebel.git
Ability to customise fade duration.
This commit is contained in:
Родитель
2763201ad1
Коммит
7f362f943a
|
@ -95,6 +95,10 @@ typedef void (^RBLPopoverDelegateBlock)(RBLPopover *popover);
|
|||
// animation has successfully completed.
|
||||
@property (nonatomic, copy) RBLPopoverDelegateBlock didShowBlock;
|
||||
|
||||
// Use for animation when showing and closing the popover.
|
||||
// Note closeWithFadeoutDuration: ignores this value.
|
||||
@property (nonatomic, assign) NSTimeInterval fadeDuration;
|
||||
|
||||
// Designated initialiser.
|
||||
//
|
||||
// Returns a newly initialised `RBLPopover`.
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
|
||||
//***************************************************************************
|
||||
|
||||
static NSTimeInterval const RBLPopoverDefaultFadeDuration = 0.3;
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@interface RBLPopover ()
|
||||
|
||||
// The window we are using to display the popover.
|
||||
|
@ -116,6 +112,7 @@ static NSTimeInterval const RBLPopoverDefaultFadeDuration = 0.3;
|
|||
_backgroundViewClass = RBLPopoverBackgroundView.class;
|
||||
_behavior = RBLPopoverViewControllerBehaviorApplicationDefined;
|
||||
_animates = YES;
|
||||
_fadeDuration = 0.3;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -289,7 +286,7 @@ static NSTimeInterval const RBLPopoverDefaultFadeDuration = 0.3;
|
|||
};
|
||||
|
||||
if (self.animates) {
|
||||
[NSView rbl_animateWithDuration:RBLPopoverDefaultFadeDuration animations:^{
|
||||
[NSView rbl_animateWithDuration:self.fadeDuration animations:^{
|
||||
[self.popoverWindow.animator setAlphaValue:1.0];
|
||||
} completion:postDisplayBlock];
|
||||
} else {
|
||||
|
@ -301,7 +298,7 @@ static NSTimeInterval const RBLPopoverDefaultFadeDuration = 0.3;
|
|||
#pragma mark Closing
|
||||
|
||||
- (void)close {
|
||||
[self closeWithFadeoutDuration:RBLPopoverDefaultFadeDuration];
|
||||
[self closeWithFadeoutDuration:self.fadeDuration];
|
||||
}
|
||||
|
||||
- (void)closeWithFadeoutDuration:(NSTimeInterval)duration {
|
||||
|
|
Загрузка…
Ссылка в новой задаче