I apologize. I was not aware that bug reports were classified. Here’s my main.lua. [lua]local n_SwipeLength = 150
local n_radius = 140
local n_legitTouch = false
local shape_selection_body
local shape_selection_head
local centerX = display.contentWidth/2
local centerY = display.contentHeight/2
local InterfaceEvent = function(event)
print(event.phase)
if event.phase == ‘began’ then
n_legitTouch = true
shape_selection_head = display.newCircle(0, 0, 20)
shape_selection_head:setFillColor(255, 255, 255)
shape_selection_head:translate(centerX,centerY)
elseif event.phase == ‘moved’ and n_legitTouch == true then
if(shape_selection_body ~= nil) then shape_selection_body:removeSelf() end
local cursorX = event.xDist * n_radius
local cursorY = event.yDist * n_radius
local cursorLength = math.sqrt(cursorX*cursorX + cursorY*cursorY)
shape_selection_body = display.newLine(centerX, centerY, centerX+cursorX, centerY+cursorY)
shape_selection_body:setColor(180, 180, 180)
shape_selection_body.width=5
if(shape_selection_head ~= nil) then
shape_selection_head.x = centerX+cursorX
shape_selection_head.y = centerY+cursorY
end
elseif (event.phase == ‘ended’ or event.phase == ‘cancelled’) and n_legitTouch == true then
print(event.xDist…’, '…event.yDist)
if(shape_selection_body ~= nil) then shape_selection_body:removeSelf() end
shape_selection_body = nil
if(shape_selection_head ~= nil) then shape_selection_head:removeSelf() end
shape_selection_head = nil
n_legitTouch = false
end
end
local screenTouch = function(event)
if(event.phase == ‘began’) then
InterfaceEvent({phase=‘began’})
elseif(event.phase == ‘moved’) then
local xDist = event.x - event.xStart
local yDist = event.y - event.yStart
if xDist < -n_SwipeLength then xDist = -n_SwipeLength end
if yDist < -n_SwipeLength then yDist = -n_SwipeLength end
if xDist > n_SwipeLength then xDist = n_SwipeLength end
if yDist > n_SwipeLength then yDist = n_SwipeLength end
xDist = xDist/n_SwipeLength
yDist = yDist/n_SwipeLength
InterfaceEvent({phase=‘moved’, xDist=xDist, yDist=yDist})
elseif(event.phase == ‘ended’ or event.phase == ‘cancelled’) then
local xDist = event.x - event.xStart
local yDist = event.y - event.yStart
if xDist < -n_SwipeLength then xDist = -n_SwipeLength end
if yDist < -n_SwipeLength then yDist = -n_SwipeLength end
if xDist > n_SwipeLength then xDist = n_SwipeLength end
if yDist > n_SwipeLength then yDist = n_SwipeLength end
xDist = xDist/n_SwipeLength
yDist = yDist/n_SwipeLength
InterfaceEvent({phase=‘ended’, xDist=xDist, yDist=yDist})
end
end
Runtime:addEventListener( “touch”, screenTouch )[/lua]
A little more complicated than necessary, but demonstrates the problem. If you touch with one finger, drag, touch with another finger, then remove the first and second fingers, there will be no ended phase. I know this because the circle shape_selection_head is never removed, and just gets assigned to a new circle when the next began phase appears.
I have modified the code since, to test for n_legitTouch in the began phase, so that I can get rid of the rogue circles. But still, this behavior seems buggy.
Are you testing with iOS or Android? I can only test with Android. [import]uid: 70391 topic_id: 19348 reply_id: 75121[/import]
