I am building a PencilKit app that interprets a canvasView.drawing's size. Drawings below a certain size are interpreted as tap gestures and get cleared in the interpretation process.
Effectively, I am doing it like this:
func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {
// Check if drawing is empty,
// otherwise this would loop
guard !canvasView.drawing.bounds.isEmpty
else {
return
}
if canvasView.drawing.bounds.width 10 &&
canvasView.drawing.bounds.height 10
{
canvasView.drawing = PKDrawing()
handleDetectedTapGesture()
}
}
On my 2020 iPad Pro, this works flawlessly. On other iPads however, I observe a strange behaviour:
In a series of drawing little specks on the canvas that are all supposed to be cleared immediately, sometimes the canvas seems to not be cleared, a single speck stays visible. After I draw the next speck somewhere else, the clearing is functional again, which means the canvas was internally emptied, the visible state was just not up-to-date.
Finger input on the canvas is deactivated. The canvas tool is set to pencil, width 5.0.
Does anybody have an idea what could be the reason for this behaviour?