Skip to content

Commit

Permalink
Constrain window resize to usable area of platform window.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljungberg committed Jan 4, 2013
1 parent b869312 commit 0d31f79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion AppKit/CPWindow/_CPWindowView.j
Expand Up @@ -390,6 +390,7 @@ var _CPWindowViewResizeIndicatorImage = nil,
newY = _CGRectGetMinY(_resizeFrame),
newWidth = _CGRectGetWidth(_resizeFrame),
newHeight = _CGRectGetHeight(_resizeFrame),
platformFrame = [[theWindow platformWindow] usableContentFrame],
minSize = [theWindow minSize],
maxSize = [theWindow maxSize];

Expand Down Expand Up @@ -440,7 +441,10 @@ var _CPWindowViewResizeIndicatorImage = nil,
if (theWindow._isSheet && theWindow._parentView && (frame.size.width !== newWidth))
[theWindow._parentView _setAttachedSheetFrameOrigin];

[theWindow setFrame:_CGRectMake(newX, newY, newWidth, newHeight)];
// Constrain resize to fit within the platform window.
var newFrame = CGRectIntersection(_CGRectMake(newX, newY, newWidth, newHeight), platformFrame);

[theWindow setFrame:newFrame];
[self setCursorForLocation:location resizing:YES];
}

Expand Down

0 comments on commit 0d31f79

Please sign in to comment.