• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get rid of blinking?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Code signing issues
  • Next by Date: Re: Stepwise articles
  • Previous by thread: Re: How to get rid of blinking?
  • Next by thread: ANN: Webcast tomorrow on CouchDB / Couchbase Mobile
  • Index(es):
    • Date
    • Thread