/CPView+OffsetCorners.j
http://github.com/rheimbuch/YED · Unknown · 52 lines · 35 code · 17 blank · 0 comment · 0 complexity · 8d6800c9b4736f72669be29484f07e5d MD5 · raw file
- @import <AppKit/CPView.j>
- @implementation CPView (OffsetCorners)
- - (void)offsetFrameTopLeft:(CGPoint)delta
- {
- var currentFrame = [self frame],
- currentLocation = currentFrame.origin;
-
- var newFrame = CGRectMake(currentLocation.x+delta.x , currentLocation.y+delta.y, CGRectGetWidth(currentFrame) - delta.x, CGRectGetHeight(currentFrame) - delta.y);
- [self setFrame:newFrame];
-
- [self setNeedsDisplay:YES];
- }
- - (void)offsetFrameTopRight:(CGPoint)delta
- {
- var currentFrame = [self frame],
- currentLocation = currentFrame.origin;
-
-
- var newFrame = CGRectMake(currentLocation.x , currentLocation.y+delta.y, CGRectGetWidth(currentFrame) + delta.x, CGRectGetHeight(currentFrame) - delta.y);
- [self setFrame:newFrame];
-
- [self setNeedsDisplay:YES];
- }
- - (void)offsetFrameBottomRight:(CGPoint)delta
- {
- var currentFrame = [self frame],
- currentLocation = currentFrame.origin;
-
-
- var newFrame = CGRectMake(currentLocation.x , currentLocation.y, CGRectGetWidth(currentFrame) + delta.x, CGRectGetHeight(currentFrame) + delta.y);
- [self setFrame:newFrame];
-
- [self setNeedsDisplay:YES];
- }
- - (void)offsetFrameBottomLeft:(CGPoint)delta
- {
- var currentFrame = [self frame],
- currentLocation = currentFrame.origin;
-
-
- var newFrame = CGRectMake(currentLocation.x + delta.x , currentLocation.y, CGRectGetWidth(currentFrame) - delta.x, CGRectGetHeight(currentFrame) + delta.y);
- [self setFrame:newFrame];
-
- [self setNeedsDisplay:YES];
- }
- @end