Reputation: 9241
I am trying to call touch Listener on line, but it is not working. If I try it on any other display object, it does work.
Simple Example:
local function touchListener(e)
print("removeLine")
print("Name: " .. e.target.name)
end
Above is touch listener function.
local line = display.newLine(sceneGroup, 0, 0, 100, 100)
line:setStrokeColor(1, 0, 0, 1)
line.strokeWidth = 10
line.name = 'line'
line:addEventListener( "touch", touchListener )
Added listener on line
, but never works.
local circle = display.newCircle(sceneGroup, 150, 150, 50)
circle:setFillColor(0, 1, 0, 1)
circle.name = "circle"
circle:addEventListener( "touch", touchListener )
Added listener on circle
, and works perfectly.
Can anyone please suggest, what I am doing wrong with line
?
Upvotes: 0
Views: 174
Reputation: 3063
A single line is a small target to try and touch. Apple suggests that 44 points is the smallest touch target.
Upvotes: 1