X-Git-Url: http://git.ithinksw.org/ITKit.git/blobdiff_plain/cdaf08d75aed64cffcb54c908eb383b05dd92789..11c398c047d4e737a59c70f13de3cde3a788810a:/ITSpinAndZoomWindowEffect.m?ds=sidebyside diff --git a/ITSpinAndZoomWindowEffect.m b/ITSpinAndZoomWindowEffect.m old mode 100755 new mode 100644 index 029b7bd..910a21a --- a/ITSpinAndZoomWindowEffect.m +++ b/ITSpinAndZoomWindowEffect.m @@ -42,7 +42,7 @@ + (unsigned int)listOrder { - return 600; + return 800; } @@ -193,28 +193,22 @@ - (void)setScale:(float)scale angle:(float)angle { - int hPos = [_window horizontalPosition]; float radAngle = (angle * 4 * pi); CGAffineTransform transform; NSPoint translation; - NSRect screenFrame = [[_window screen] frame]; + NSRect winFrame = [_window frame]; + + scale = MAX(scale, 0.000001); - translation.x = screenFrame.origin.x + ([_window frame].size.width / 2.0); - translation.y = screenFrame.origin.y + ([_window frame].size.height / 2.0); + translation.x = (winFrame.size.width / 2.0); + translation.y = (winFrame.size.height / 2.0); transform = CGAffineTransformMakeTranslation(translation.x, translation.y); transform = CGAffineTransformScale(transform, 1.0 / scale, 1.0 / scale); transform = CGAffineTransformRotate(transform, radAngle); transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y); - - if (hPos == ITWindowPositionLeft) { - translation.x = -[_window frame].origin.x; - } else if (hPos == ITWindowPositionRight) { - translation.x = -[_window frame].origin.x; - } else { - translation.x = -[_window frame].origin.x; - } - - translation.y = -( [[_window screen] frame].size.height - [_window frame].origin.y - [_window frame].size.height ); + + translation.x = -winFrame.origin.x; + translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height; transform = CGAffineTransformTranslate(transform, translation.x, translation.y); CGSSetWindowTransform([NSApp contextID],