Testing with a clean project, clean gui, Windows 10, editor 1.2.142
function on_input(self, action_id, action) if action.pressed and gui.pick_node (txtNode, action.x, action.y) then if gui.get_text (txtNode) == "A" then gui.set_text (txtNode, "LONGER WORD") else gui.set_text (txtNode, "A") end end end function init(self) txtNode = gui.new_text_node (vmath.vector3 (100, 100, 0), "A") gui.set_pivot (txtNode, gui.PIVOT_NW) gui.set_size_mode (txtNode, gui.SIZE_MODE_AUTO) msg.post (".", "acquire_input_focus") end
If you click on text node “A” so it changes to “LONGER WORD”, I was expecting pick node to resize so you can now click on the entire width of “LONGER WORD”. Instead you can only click on the letter “L” or likely just the width of the original text “A”.
I tried setting size_mode of the text to auto, but same results. Tried with default font, and importing a different font.
What is the proper way to do this? Currently my workaround is that whenever I change values of text nodes, I compute the metrics of the text and do a set_size again, but isn’t there a simpler way?