I have a canvas that reacts to pointer down, pointer move etc by drawing.
For obvious reasons, people also expect to be able to pinch zoom.
I thought I had a reasonable handle on this by noticing how many points I have in the pointerdown, and only doing something zoomy about it if I STILL have two in the move event.
PointerDown:
If pointerinfo.ubound > 0 Then
//multi touch .. get out
Exit Sub
End If
PointerDrag:
If pointerinfo.ubound > 0 Then
//multi touch .. record here, change zoom? and get out
var thisdistance as double
static lastx,lasty as integer
thisdistance = abs(pointerinfo(0).position.DistanceTo( pointerinfo(1).position))
//etc
end if
But what I am hearing from people using an Apple Pencil, is that they get stray events - either odd touches from their fingers, or odd zooms when it detects a mix of Pencil and (presumably) fingers.
Is there a way to detect whether a pointer event is one from a pencil ONLY and ignore āfat fingersā?
Pinches are usually not done with individual touches but with Gesture Recognizers. That way you donāt have to figure out all of the math to get it right.
Iām sure that iOSKit or Jeremieās extensions cover this.
Pinch is working with this code.
TBH, I included IOSKit in an older project and have had no end of trouble with it.
I really donāt want to include it now, as I am (probably stupidly) trying to avoid too much rework/iOS dependance , just in case I can ever use Xojo to build for Android.
I suspect for my fat finger issue, I need a user setting to say āIm using a Pencil, so ignore any touches with a diameter over (some size to be determined by guesswork) unless its a multi-touchā
In API1, the canvas Pointer events used iOSEventInfo class where the handle was exposed. Allowing for more information to be retrieved, using declares.
Unfortunately with API2, iOSEventInfo is replaced with PointerEvent which has no exposed handle.
Since issue 64316 is now implemented, how would we go to detect Apple pencils from the PointerDown event?
I would have to detect if a PointerDown event is made with a pencil or with a finger. Iāve checked in iOSdesignExtensions (both by browsing its classes and by searching using terms such as āGestureā, āPointerDownā or āPencilā) and I did found nothing. Iām assuming it hasnāt been included there.
Sorry, I actually never implemented Apple Pencil recognition in iOSDesignExtensions.
First you could use:
Declare function description_ lib "UIKit" Selector "description" (obj as ptr) as CFStringRef
for i as Integer = 0 to pointerInfo.LastIndex
System.DebugLog "#" + i.ToString + " " + description_(pointerInfo(i).Handle)
next