From 2dca00c4a039f5d844d6d0487fa7c7fd8754369b Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Mon, 11 Mar 2013 00:29:05 -0400 Subject: [PATCH] Fixed: sheets should not be resizable from the top Previously, sheets could be resized from the top, which would destroy the illusion of being attached to the top of the parent window. With this commit, sheets are prevented from being resized by the user from the top edge. --- AppKit/CPWindow/_CPWindowView.j | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 9b49f8624..5d837516e 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -245,6 +245,8 @@ _CPWindowViewResizeSlop = 3; rects are the same size. So to save calculations, we can just create 3 rects and move them around to do hit testing. Start with the corners and then do left/right and top/bottom. + + NOTE: If the window is a sheet, the top is never eligible for resizing. */ var wind = [self window], frame = [wind frame], @@ -252,7 +254,8 @@ _CPWindowViewResizeSlop = 3; minSize = [wind minSize], maxSize = [wind maxSize], isFixedWidth = minSize.width === maxSize.width, - isFixedHeight = minSize.height === maxSize.height; + isFixedHeight = minSize.height === maxSize.height, + isSheet = wind._isSheet; if (isFixedWidth) { @@ -262,7 +265,7 @@ _CPWindowViewResizeSlop = 3; _CPWindowViewResizeSlop * 2); if (_CGRectContainsPoint(rect, aPoint)) - return _CPWindowViewResizeRegionTop; + return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop; rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; @@ -292,12 +295,12 @@ _CPWindowViewResizeSlop = 3; _CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop); if (_CGRectContainsPoint(rect, aPoint)) - return _CPWindowViewResizeRegionTopLeft; + return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopLeft; rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewCornerResizeRectWidth; if (_CGRectContainsPoint(rect, aPoint)) - return _CPWindowViewResizeRegionTopRight; + return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopRight; rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewCornerResizeRectWidth; @@ -328,7 +331,7 @@ _CPWindowViewResizeSlop = 3; _CPWindowViewResizeSlop * 2); if (_CGRectContainsPoint(rect, aPoint)) - return _CPWindowViewResizeRegionTop; + return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop; rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop;