There was a WWDC video on Responsive Scrolling. 
It's not the easiest API to get sophisticated with, but worth it if you have 
the time. 
The key is in the kinds of event phases you get. 

It's all about NSEvent. 
You just need to check things within the scrollWheel: method and branch 
accordingly. 

Sent from my iPhone

> On 2015/05/11, at 11:47, Graham Cox <graham....@bigpond.com> wrote:
> 
> 
>>> On 11 May 2015, at 9:29 am, Graham Cox <graham....@bigpond.com> 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 (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:
> https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.com

_______________________________________________

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

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

Reply via email to