Only allow a single window frame animation at a time; stop the previous animation before starting a new one. This allows e.g. a sheet animating open to 'turn around' and animate right back out. Fixed: if a sheet was closed before it finished animating open, for example by hitting a keyboard equivalent immediately, CPWindow would crash with "Uncaught TypeError: Cannot read property 'sheet' of null".

This commit is contained in:
Alexander Ljungberg authored and Ross Boucher committed 2010-06-16 08:46:54 -07:00
1 parent 6a43c544eb
commit db3514a2c1
1 file changed
+11 -7
+11 -7
View File
@@ -320,6 +320,8 @@ var CPWindowSaveImage = nil,
CPDictionary _sheetContext;
CPWindow _parentView;
BOOL _isSheet;
_CPWindowFrameAnimation _frameAnimation;
}
/*
@@ -659,9 +661,10 @@ CPTexturedBackgroundWindowMask
if (shouldAnimate)
{
var animation = [[_CPWindowFrameAnimation alloc] initWithWindow:self targetFrame:aFrame];
[_frameAnimation stopAnimation];
_frameAnimation = [[_CPWindowFrameAnimation alloc] initWithWindow:self targetFrame:aFrame];
[animation startAnimation];
[_frameAnimation startAnimation];
}
else
{
@@ -2074,11 +2077,12 @@ CPTexturedBackgroundWindowMask
- (void)_setFrame:(CGRect)aFrame delegate:(id)delegate duration:(int)duration curve:(CPAnimationCurve)curve
{
var animation = [[_CPWindowFrameAnimation alloc] initWithWindow:self targetFrame:aFrame];
[animation setDelegate:delegate];
[animation setAnimationCurve:curve];
[animation setDuration:duration];
[animation startAnimation];
[_frameAnimation stopAnimation];
_frameAnimation = [[_CPWindowFrameAnimation alloc] initWithWindow:self targetFrame:aFrame];
[_frameAnimation setDelegate:delegate];
[_frameAnimation setAnimationCurve:curve];
[_frameAnimation setDuration:duration];
[_frameAnimation startAnimation];
}
/* @ignore */