mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Hide previous pop-out animations when showing a new one
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
#include <oak/misc.h>
|
||||
|
||||
PUBLIC void OakShowPopOutAnimation (NSRect aRect, NSImage* image);
|
||||
PUBLIC void OakShowPopOutAnimation (NSRect aRect, NSImage* image, BOOL hidePrevious = YES);
|
||||
|
||||
@@ -28,10 +28,19 @@ static double const kFadeFinishTime = 0.70;
|
||||
- (void)startAnimation:(id)sender;
|
||||
@end
|
||||
|
||||
void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage)
|
||||
void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage, BOOL hidePrevious)
|
||||
{
|
||||
if(popOutRect.size.width == 0 || popOutRect.size.height == 0)
|
||||
return;
|
||||
|
||||
static NSMutableSet<NSWindow*>* previousWindows = [NSMutableSet set];
|
||||
|
||||
if(hidePrevious)
|
||||
{
|
||||
for(NSWindow* window in previousWindows)
|
||||
[window close];
|
||||
[previousWindows removeAllObjects];
|
||||
}
|
||||
|
||||
popOutRect = NSInsetRect(popOutRect, -kExtendWidth, -kExtendHeight);
|
||||
NSRect windowRect = popOutRect;
|
||||
@@ -58,6 +67,7 @@ void OakShowPopOutAnimation (NSRect popOutRect, NSImage* anImage)
|
||||
|
||||
[window setFrame:[window frameRectForContentRect:windowRect] display:YES];
|
||||
[window orderFront:nil];
|
||||
[previousWindows addObject:window];
|
||||
|
||||
[aView startAnimation:nil];
|
||||
}
|
||||
|
||||
@@ -790,12 +790,14 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
documentView->remove_enclosing_folds(range.min().index, range.max().index);
|
||||
[self ensureSelectionIsInVisibleArea:self];
|
||||
|
||||
BOOL firstRange = YES;
|
||||
for(auto const& range : ranges)
|
||||
{
|
||||
NSRect imageRect;
|
||||
NSImage* image = [self imageForRanges:range imageRect:&imageRect];
|
||||
imageRect = [[self window] convertRectToScreen:[self convertRect:imageRect toView:nil]];
|
||||
OakShowPopOutAnimation(imageRect, image);
|
||||
OakShowPopOutAnimation(imageRect, image, firstRange);
|
||||
firstRange = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user