PageRenderTime 15ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/CPView+OffsetCorners.j

http://github.com/rheimbuch/YED
Unknown | 52 lines | 35 code | 17 blank | 0 comment | 0 complexity | 8d6800c9b4736f72669be29484f07e5d MD5 | raw file
 1@import <AppKit/CPView.j>
 2
 3@implementation CPView (OffsetCorners)
 4
 5- (void)offsetFrameTopLeft:(CGPoint)delta
 6{    
 7    var currentFrame = [self frame],
 8        currentLocation = currentFrame.origin;
 9            
10    var newFrame = CGRectMake(currentLocation.x+delta.x , currentLocation.y+delta.y, CGRectGetWidth(currentFrame) - delta.x, CGRectGetHeight(currentFrame) - delta.y);
11    [self setFrame:newFrame];
12    
13    [self setNeedsDisplay:YES];
14}
15
16- (void)offsetFrameTopRight:(CGPoint)delta
17{
18    var currentFrame = [self frame],
19        currentLocation = currentFrame.origin;
20        
21            
22    var newFrame = CGRectMake(currentLocation.x , currentLocation.y+delta.y, CGRectGetWidth(currentFrame) + delta.x, CGRectGetHeight(currentFrame) - delta.y);
23    [self setFrame:newFrame];
24    
25    [self setNeedsDisplay:YES];
26
27}
28
29- (void)offsetFrameBottomRight:(CGPoint)delta
30{
31    var currentFrame = [self frame],
32        currentLocation = currentFrame.origin;
33        
34            
35    var newFrame = CGRectMake(currentLocation.x , currentLocation.y, CGRectGetWidth(currentFrame) + delta.x, CGRectGetHeight(currentFrame) + delta.y);
36    [self setFrame:newFrame];
37    
38    [self setNeedsDisplay:YES];
39}
40
41- (void)offsetFrameBottomLeft:(CGPoint)delta
42{
43    var currentFrame = [self frame],
44        currentLocation = currentFrame.origin;
45        
46            
47    var newFrame = CGRectMake(currentLocation.x + delta.x , currentLocation.y, CGRectGetWidth(currentFrame) - delta.x, CGRectGetHeight(currentFrame) + delta.y);
48    [self setFrame:newFrame];
49    
50    [self setNeedsDisplay:YES];
51}
52@end