I have a sliding menu panel with a touch listener called “swipe”. This listener enables the panel to follow the user’s finger swipes. Then I have a table widget on the menu with the normal “OnRowTouch” listener.
These two objects and listeners overlap. The table is in the center of the panel. Whenever the panel is swiped, it does as stated in the swipe listener but when ever the user tries to swipe on the area where the table is, the swipe listener isn’t activated.
I’m trying to set things up in a way that when the table is swiped, the swipe listener on the pane below it is called, when it’s clicked, the normal “OnRowTouch” listener is called. I tried removing the “return true” but it didn’t work.
currently i just used the “swipeleft” “swiperight” of the onRowTouch to close the menu but I want it to follow the users finger movements like in swipe.
Here’s my current code, its kinda mess looking:
swipe:
local function swipe(event) if (event.phase == "began") then dialog\_object.startX = dialog\_object.x dialog\_object.lastTime = event.time dialog\_object.speed = 0 elseif (event.phase == "moved") then dialog\_object.deltaTime = event.time - dialog\_object.lastTime dist = ( (event.x - (backdrop.width/2)) - (event.xStart - (backdrop.width/2)) ) dialog\_object.speed = dist / dialog\_object.deltaTime print ( dialog\_object.speed ) if (dialog\_object.startX + dist) \<= dialog\_object.limit then dialog\_object.x = dialog\_object.startX + dist end elseif (event.phase == "cancelled") or (event.phase == "ended") then if (dialog\_object.x \<= obj\_edge) or (( dialog\_object.speed \* (-1) ) \>= 0.8) then group:close() else transition.to(dialog\_object, { x= dialog\_object.limit, time = 100, transition=easing.linear}) end end
onRowTouch:
local function onRowTouch( event ) local row = event.target local params=event.target.params print (event.phase ) if event.phase == "press" then rowMoved = false wrongMoved = false elseif event.phase == "swipeLeft" then rowMoved = true if opt.align == "left" then wrongMoved = false group:close() else wrongMoved = true end elseif event.phase == "swipeRight" then rowMoved = true if opt.align == "right" then wrongMoved = false group:close() else wrongMoved = true end elseif event.phase == "release" or event.phase == "ended" then if wrongMoved == false then group:close() end if params.onClick and (rowMoved == false) then params.onClick() end end return true end
I’d appreciate the help, thanks