Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) drawBezelWithFrame:(NSRect) frame inView:(NSView *) controlView {
- NSEvent * currentEvent = [NSApp currentEvent];
- BOOL isMouseUp = true;
- BOOL isLeftMouseDown = ([currentEvent type] == NSLeftMouseDown);
- if(isLeftMouseDown) {
- isMouseUp = false;
- NSPoint localPoint;
- BOOL coordsAreScreen = ([currentEvent window]==nil);
- NSPoint windowPoint = [currentEvent locationInWindow];
- if(coordsAreScreen) {
- NSLog(@"coords are screen");
- windowPoint = [[[self controlView] window] convertScreenToBase:windowPoint];
- }
- if(windowPoint.x < 0 || windowPoint.y < 0) {
- isLeftMouseDown = false;
- isMouseUp = true;
- } else { //in this block is where I can't get "localPoint" to correctly convert.
- NSLog(@"windowPoint: %@",GDPrintGetPrintedNSPoint(windowPoint));
- localPoint = [[self controlView] convertPoint:windowPoint toView:nil];
- NSLog(@"localPoint: %@",GDPrintGetPrintedNSPoint(localPoint));
- localPoint = [[[[self controlView] window] contentView] convertPoint:windowPoint fromView:[self controlView]];
- NSLog(@"localPoint2: %@",GDPrintGetPrintedNSPoint(localPoint));
- localPoint = [[self controlView] convertPoint:windowPoint fromView:[self controlView]];
- NSLog(@"localPoint3: %@",GDPrintGetPrintedNSPoint(localPoint));
- NSLog(@"is in rect: %i",NSPointInRect(localPoint,frame));
- NSLog(@"frame: %@",GDPrintGetPrintedNSRect(frame));
- if(!NSPointInRect(localPoint,frame)) isLeftMouseDown = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement