> -(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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to