GUI Adjust Mode Issues

I have a problem with Adjust Mode after enabling node (gui.set_enabled(node, true))

There is next hierarchy:

  • node_A
    • node_B (Adjust Mode = Stretch)
      • node C (Adjust Mode = Fit)
      • node D (Adjust Mode = Fit)
      • node E (Adjust Mode = Fit)

if disable node A, then resize the window, and then enable node A —> nodes C, D, E will be incorrectly stretched
but if resize the window again nodes will take the correct size
Is there a way to force update nodes? Or is it a bug?

How to reproduce:

  • run project (command+B)
  • press space
  • resize window
  • press space again

GUI Test.zip (212.5 KB)

Defold v1.2.165

1 Like

This feels a bit like a bug to be honest. I’ll take a look tomorrow. What if your change position of node A after you’ve enabled it? Or resize it?

Yes, resizing nodes helps

local node = gui.get_node("box1")
gui.set_size(node, gui.get_size(node))

node = gui.get_node("text1")
gui.set_size(node, gui.get_size(node))

Not optimal, but it is at least a workaround for now.

Yep, this was a bug. A fix will be included in the beta and subsequent stable release.

3 Likes

There is next hierarchy:

  • node_A
    • node_B (Adjust Mode = Stretch)
      • node C (Adjust Mode = Fit)
      • node D (Adjust Mode = Fit)
      • node E (Adjust Mode = Fit)

If I reset the size of node_A instead of the app window size, can I dynamically adjust the size of node_B /node_C /node_D /node_E ?