Re: Rotate a standard Cocoa control?
Re: Rotate a standard Cocoa control?
- Subject: Re: Rotate a standard Cocoa control?
- From: Graham Cox <email@hidden>
- Date: Mon, 11 May 2015 12:47:06 +1000
> On 11 May 2015, at 9:29 am, Graham Cox <email@hidden> wrote:
>
>> One thing I’d suggest: When the knob is set to stop on tick marks, the scroll event should take it immediately to the next/prev tick instead of waiting for the float value to get close enough to the next tick value.
>
>
> Yes, that might be better. As it is I have to keep track of the “unquantised” value so that the scrollwheel can accumulate until it hits the next threshold. The only reason I did it that way is so that the handling of snapping to tick marks works no matter where the events come from that change the value - in other words I don’t need to do extra work in the scroll wheel handler. But it might be better to do it the way you suggest.
I”ve tried this out and indeed it’s a nicer behaviour when using the scrollwheel on my mouse. I generally use a Logitech mouse that has a clicky physical scroll wheel, rather than an optical sensor. One click jumps to the next tickmark in whatever direction I scroll - it’s pretty nice.
Unfortunately it’s horrible when using the scroll gesture on a trackpad. In that case my original implementation is much better. Sadly the -scrollWheel: event handler is invoked in either case but as far as I can tell there’s no way to determine what sort of input device the event originated from. Even dropping down to the CGEvent/CGEventSource API doesn’t get you that info it seems.
It’s a real shame because this is a clear example where one size doesn’t fit all. The trackpad gesture generates many -scrollWheel: events and even has some “inertia” in that I can swipe rapidly up or down with two fingers and the knob acts as if it has some weight, continuing to turn slightly even after my fingers leave the pad. That’s not bad using the original code, but when snapping to ticks and immediately jumping to the next value, the knob jumps all over the place.
Anyone know if there is a way to distinguish what sort of input device an event came from?
—Graham
_______________________________________________
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