corona-textrender
corona-textrender copied to clipboard
Get reference to autoWrappedText from handler
Hi, it seems like, that the link object from the example below is not part of the event.target in the handler function when the link was tapped. Am I missing something? It would be great to find the matching object after the click. The textrender.lua file is so complex, I have a really hard time to understand all the code and make appropriate changes myself. Otherwise a really great library for rendering HTML content!
E.g.:
local options = { text ="Click me", font = "Futura-Bold", size = "20", lineHeight = "20", hyperlinkTextColor = "255,255,255,255", -- an RGBa color in a string, like this: "200,120,255,100" opacity = "100%", width = 200, -- width of the column of text alignment = "Left", -- default text alignment, note the initial capital letter minCharCount = 100, -- Minimum number of characters per line. Start low. maxHeight = 26, handler = touchCallback, -- a function that will accept a 'tap' event isHTML = true, -- TRUE if the text is simplified HTML styled text } local link = textrender.autoWrappedText( options )
function touchCallback(event) if event.target == link then print("found it") end end