• 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
minimal redraw with scrollPoint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

minimal redraw with scrollPoint


  • Subject: minimal redraw with scrollPoint
  • From: "Simon Strandgaard" <email@hidden>
  • Date: Fri, 20 Oct 2006 12:31:44 +0200

I have a grab-mode in my program, where the user can hold
down the SHIFT-modifier and scroll by doing click-drag-release.

If I scroll diagonally then getRectsBeingDrawn tells me that
everything is changed. However scrolling either only-horizontally
or only-vertically then getRectsBeingDrawn gives me the delta-changes.

I have made an adhoc solution for scrolling diagonally with
minimal redraw:
At odd times I scroll horizontally.
At even times I scroll vertically.


Is there something better around?


float dx = [event deltaX]; float dy = [event deltaY]; NSClipView *cv = (NSClipView*)[self superview]; NSPoint orig = [cv bounds].origin; if(scroll_x_if_odd & 1) { NSPoint new_orig = NSMakePoint( round(orig.x - dx - accum_x), orig.y ); [self scrollPoint: new_orig]; accum_y += dy; accum_x = 0; } else { NSPoint new_orig = NSMakePoint( orig.x, round(orig.y - dy - accum_y) ); [self scrollPoint: new_orig]; accum_x += dx; accum_y = 0; } scroll_x_if_odd++;



--
Simon Strandgaard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: encrypting a pdf
  • Next by Date: NSTextField: drag-and-drop + Command keypresses
  • Previous by thread: custom NSSliderCell
  • Next by thread: NSTextField: drag-and-drop + Command keypresses
  • Index(es):
    • Date
    • Thread