mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-17 20:20:44 +00:00
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:
1 parent
6a43c544eb
commit
db3514a2c1
1 file changed
+11
-7
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user