Re: How to get rid of blinking?
Re: How to get rid of blinking?
- Subject: Re: How to get rid of blinking?
- From: Jim McGowan <email@hidden>
- Date: Thu, 20 Oct 2011 12:10:17 +0800
> -(void)mouseDragged:(NSEvent *)theEvent {
> NSPoint locationOnCanvas = [self convertPoint:[theEvent
> locationInWindow] fromView:nil];
>
> if(currentMouseMode == MMZooming) {
> * [self display]; //clear the previous "rectangle"
> [self lockFocus];
> [self drawRectUsingTwoPoints:lastMouseDownPos:locationOnCanvas];
> [self unlockFocus];
> [self displayIfNeeded]; //show the currect "rectangle"*
> }
> }
I suspect that the blinking is due to you drawing the selection rectangle in the mouseDragged method, then calling display if needed, which (if needed) will call drawRect:, which will presumably draw the view without the selection rectangle
In the past I've implemented this by having the mouseDragged: method store the rectangle in and NSRect ivar, then call setNeedsDisplay, and have the drawRect: method draw the selection rectangle if the NSRect ivar has a valid value.
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden