I’m drawing to the screent during touch events using display.newLine
. There seems to be a bug (or just something I don’t understand) that prevents the line from being displayed onscreen until a new display.newLine
is called.
local line
local function draw(event)
if(event.phase == "moved") then
if not line then
line = display.newLine(event.xStart, event.yStart, event.x, event.y)
end
line:append(event.x, event.y)
-- Here comes the wonky part
-- Without this, the line won't appear onscreen
-- until I lift my finger from the screen and touch again
display.newLine(0,0,0,0):removeSelf()
elseif(event.phase == "ended") then
line = nil
end
end
Runtime:addEventListener("touch", draw)
This behavior doesn’t occur with other vector shapes. The shapes created by newRect
and newCircle
appear immediately, as expected. [import]uid: 41243 topic_id: 7540 reply_id: 307540[/import]