PDA

View Full Version : Scroll Ball Direction


unknown
2006.10.14, 12:17 PM
I setup an NSView with this method,


- (void)scrollWheel:(NSEvent *)theEvent
{
NSLog(@"(%f, %f)", [theEvent deltaX], [theEvent deltaY]);
}


and when moving the mighty mouse scrollball around up and down, left and right, and diagonally the values are always (x, 0) or (0, x), there is never a value printed out with two non-zero numbers,
Is there any level/API at which I can get the true scroll ball deltas?

ThemsAllTook
2006.10.14, 12:41 PM
Is it possible that this is specific to the Mighty Mouse? I can scroll diagonally in Finder windows with my MacBook Pro trackpad, but I think I remember having trouble scrolling diagonally at all with a Mighty Mouse when I tried one.

unknown
2006.10.15, 09:23 AM
Yeah, my question is specific to the Mighty Mouse. I am assuming that somewhere in the OS the lowest value of the scroll ball (out of x and y) are zero'd before being turned into an NSEvent and dispatched.

So can I capture scollball values with another API or set of functions than NSEvent?
or does anyone know that the mighty mouse just doesnt send out directional values, so its impossible to do what I want?

sohta
2006.10.15, 02:46 PM
What most likely happens is that the diagonal message gets split in two individual messages.

What you could do is add (or use a filter such as an average or kallman) the deltas over a period of time, one frame might do, since any diagonal scroll would create near-instantinuous messages. And the latency created would not be noticeable.

Also, it might be that both messages are queued at the same time before any resolving takes place, in wich case, you could query the event queue for scroll messages and combine them right then and there.

OneSadCookie
2006.10.15, 06:09 PM
Even if the mouse driver for the OS is messing with the scrolling deltas, you ought to be able to get the raw deltas from HID...