Adonit/Adonit-iOS-SDK

jotTouch* events behavior changed for the stylus is disconnected

Closed this issue · 4 comments

Not sure if this is by design or not:

in 94b3eec, running the Example app without a connected stylus still draws on the screen.

in bd967a5, running the Example doesn't draw at all when the SDK is enabled but stylus is disconnected.

Hi Adam,
Thanks for that information. That was not by design. The change in the code was to keep some connection-flapping that was going on when enabling the SDK. I'll take a look and see if I can figure out what might have happened there.

great thanks!

On Wed, Jan 22, 2014 at 1:44 PM, Tim Ritchey notifications@github.comwrote:

Hi Adam,
Thanks for that information. That was not by design. The change in the
code was to keep some connection-flapping that was going on when enabling
the SDK. I'll take a look and see if I can figure out what might have
happened there.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-33059656
.

Hi Adam,
This should be fixed in the example app in the latest commit. The issue was that previously the SDK was mistakenly sending JotTouch events for UITouches that were not from a stylus, and the example canvas view was only checking whether the SDK was enabled when deciding whether to process or ignore UITouch events for drawing. So in touchesBegan, etc. it was doing:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    if(![JotStylusManager sharedInstance].enabled){
    ...

that has been fixed in the latest example app to instead check whether a pen is connected before ignoring UITouch events:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    if(![JotStylusManager sharedInstance].preferredStylus){
    ...

Hope this helps.

Cheers,
Tim R.

i wanted to follow up on this - I pulled the latest today to check this out, and I'm still not able to draw in the Example app of the SDK.

What I see:

  1. run the example app from Xcode
  2. notice spinning "connecting" button, Adonit SDK is scanning for stylus
  3. can't draw at all while it's scanning (as my stylus is off, it never finds anything and i can never draw)
  4. turn off the sdk (though button still spins)
  5. can draw fine
  6. turn sdk back on; it starts scanning again
  7. can still draw fine

it seems the very first time the sdk is scanning, i can't draw. but after turning the sdk off -> on again, i can draw. Debugging a bit, it seems the preferredStylus property of JotStylusManager is being set even though the sdk hasn't connected to it when it first starts