Fixed: when constraining a window resize, the horizontal margin was fixed (and too large).

Previously a fixed margin of 40px was maintained at the left/right of a window when resizing it, which was excessive.

Now the minimum size allowed during a resize is the same as the minimum margin allowed when moving a window, which is determined based on the type of window.
This commit is contained in:
Aparajita Fishman committed 2013-08-09 09:16:43 -04:00
1 parent d751fea510
commit 3beb753c63
2 files changed
+6 -4

No files matched your search

+4 -3
View File
@@ -803,13 +803,14 @@ CPTexturedBackgroundWindowMask
if (!_constrainsToUsableScreen || !_isVisible)
return frame;
var usableRect = [_platformWindow usableContentFrame];
var usableRect = [_platformWindow usableContentFrame],
minimumSize = [_windowView _minimumResizeSize];
// First constrain x so that at least CPWindowMinVisibleHorizontalMargin is visible on the right
frame.origin.x = MAX(frame.origin.x, CGRectGetMinX(usableRect) + CPWindowMinVisibleHorizontalMargin - CGRectGetWidth(frame));
frame.origin.x = MAX(frame.origin.x, CGRectGetMinX(usableRect) + minimumSize.width - CGRectGetWidth(frame));
// Now constrain x so that at least CPWindowMinVisibleHorizontalMargin is visible on the left
frame.origin.x = MIN(frame.origin.x, CGRectGetMaxX(usableRect) - CPWindowMinVisibleHorizontalMargin);
frame.origin.x = MIN(frame.origin.x, CGRectGetMaxX(usableRect) - minimumSize.width);
// Now constrain y so that it is below the top of the usable content
frame.origin.y = MAX(frame.origin.y, CGRectGetMinY(usableRect));
+2 -1
View File
@@ -959,7 +959,8 @@ _CPWindowViewResizeSlop = 3;
- (CGSize)_minimumResizeSize
{
return CGSizeMake(0, _CPWindowViewMinContentHeight);
// Leave at least 4px so there is something visible.
return CGSizeMake(4, _CPWindowViewMinContentHeight);
}
- (int)bodyOffset