with the attached program, you can drag your finger in a circle and it tracks pretty well. if you drag the apple pencil in a circle, after a while it slows down, the marker falling further and farther behind. if you lift the pencil, the tracking slowly catches up. sometimes codea crashes.
i suspect a leak in handling pencil touch. also no idea why code format doesn’t work here.
-- Controls
function setup()
Touches = {}
Center = vec2(WIDTH*.25, HEIGHT/2)
Radius = 100
end
function draw()
background(40, 40, 50)
ellipseMode(RADIUS)
blendMode(ADDITIVE)
pushStyle()
fill(255, 0, 0, 255)
ellipse(Center.x, Center.y, Radius)
popStyle()
local n = 0
t = "Touches:"
for id, touch in pairs(Touches) do
n = n + 1
inside = "no"
if insideCircle(touch.x, touch.y) then inside = "yes" end
t = t .. "\
" .. id .. ": " .. inside
ellipse(touch.x, touch.y, 30)
end
t = t.."\
"..n
text(t, WIDTH/2, HEIGHT/2)
end
function touched(touch)
if touch.state == ENDED then
Touches[touch.id] = nil
else
Touches[touch.id] = touch
end
end
function insideCircle(x,y)
return Center:dist(vec2(x,y)) <= Radius
end
@RonJeffries thank you for this report, I spent about three to five minutes continuously dragging the pencil in a circle in your demo app but wasn’t able to reproduce the problem. I did it while watching the memory profile, which remained flat (so memory usage wasn’t growing)
Am I not trying for long enough? Is anyone else seeing this behaviour?
As far as I can tell it should happen for non-pencil touches too (as they are identical aside from the type being STYLUS for pencil touches)
@Simeon I don’t have a pencil, so I’m just using my finger. What I see is the faster I move my finger, the farther behind the circle gets. As I slow down the circle catches back up to my finger. That has always been like that and it depends on what and how much is being drawn, so that’s not the issue.
Were you running my program above? The only odd thing I see in it is the use of ADDITIVE, which ought not be a problem.
I agree it doesn’t seem to be a Codea memory loss but the events are coming more and more slowly. Let me try it on my newer iPad … it’s definitely NOT happening on the 3rd Gen pro. The effect on the older iPad is quite visible, only takes maybe 10 seconds at most to start lagging and it will lag behind for one or more full rotations of a drawn circle about half screen size. When you lift the pen, the marker continues to slowly trace until it finally catches up. And … if I do it long enough (well under five minutes) sometimes it crashes out to the editor, and sometimes crashes Codea entirely. Very odd.
The program doesn’t seem like it would be very laggy, but it acts as it would if touch events were being generated too fast to handle them, and handling was V E R Y slow. Finger never does it, pen always does.
I guess it’s just a mystery. I’ll report if I can find out anything more.
That doesn’t seem enough to result in getting behind on events, but my tiny programs sure act as if they are getting behind. The tracking gets further behind the pencil, when I lift the pencil the tracking continues, and often, even after the tracking catches up, the next pencil tap gets very slow response. After a while, in my fiddling last night, it seems to settle out, and then scribbling again does the same build-up of slowness.
And, as I mentioned before, I’ve had Codea crash out to editor, or clear out, several times while doing this.
I’ll see if I can devise a simple fail in my copious free time.