Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local touches = {}
- local function monitor(event)
- if event.phase == 'began' or event.phase == 'moved' then
- touches[event.id] = event.target
- else
- touches[event.id] = nil
- end
- end
- function touchesInRegion(r)
- local n = 0
- for touch, target in pairs(touches) do
- if target == r then
- n = n + 1
- end
- end
- return n
- end
- function trackRegion(r)
- r:addEventListener('touch', monitor)
- end
- function ignoreRegion(r)
- r:removeEventListener('touch', monitor)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement