Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Able to resize by Pressing Shift Key

  • Loading branch information...
commit abb76ff7dbe716d4e28ad6a6fbbe48bc07a38b66 1 parent 272f668
@pppoe authored
Showing with 54 additions and 19 deletions.
  1. +54 −19 GetFrame/GetFrameWinController.m
View
73 GetFrame/GetFrameWinController.m
@@ -186,27 +186,62 @@ - (void)selectionMoved {
- (void)keyDown:(NSEvent *)theEvent {
if (![_selectionView isHidden] && !_isSelecting)
{
- if ([[theEvent characters] length] > 0)
+ if ([[theEvent charactersIgnoringModifiers] length] > 0)
{
- unichar c = [[theEvent characters] characterAtIndex:0];
- NSPoint org = [_selectionView frame].origin;
- switch (c) {
- case NSLeftArrowFunctionKey:
- org.x--;
- break;
- case NSRightArrowFunctionKey:
- org.x++;
- break;
- case NSUpArrowFunctionKey:
- org.y++;
- break;
- case NSDownArrowFunctionKey:
- org.y--;
- break;
- default:
- break;
+ unichar c = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
+ NSUInteger modifier = [NSEvent modifierFlags];
+ if (modifier & NSShiftKeyMask)
+ {
+ NSSize sz = [_selectionView frame].size;
+ NSPoint org = [_selectionView frame].origin;
+ switch (c) {
+ case NSLeftArrowFunctionKey:
+ if (sz.width > 0)
+ {
+ sz.width--;
+ }
+ break;
+ case NSRightArrowFunctionKey:
+ sz.width++;
+ break;
+ case NSUpArrowFunctionKey:
+ if (sz.height > 0)
+ {
+ org.y++;
+ sz.height--;
+ }
+ break;
+ case NSDownArrowFunctionKey:
+ org.y--;
+ sz.height++;
+ break;
+ default:
+ break;
+ }
+ [_selectionView setFrameSize:sz];
+ [_selectionView setFrameOrigin:org];
+ }
+ else
+ {
+ NSPoint org = [_selectionView frame].origin;
+ switch (c) {
+ case NSLeftArrowFunctionKey:
+ org.x--;
+ break;
+ case NSRightArrowFunctionKey:
+ org.x++;
+ break;
+ case NSUpArrowFunctionKey:
+ org.y++;
+ break;
+ case NSDownArrowFunctionKey:
+ org.y--;
+ break;
+ default:
+ break;
+ }
+ [_selectionView setFrameOrigin:org];
}
- [_selectionView setFrameOrigin:org];
[self selectionMoved];
[self updateFieldContent];
}
Please sign in to comment.
Something went wrong with that request. Please try again.