littlektframework / littlekt

A multiplatform WebGPU 2D game framework written in Kotlin. Build your own game engine on top.
https://littlekt.com
Apache License 2.0
321 stars 12 forks source link

A child `Control` node added to a node already in a scene isn't measured #194

Closed LeHaine closed 1 year ago

LeHaine commented 1 year ago

If the scene is already initialized and a new control node is added, that node is not measured resulting it having a width & height of zero.

Current work around includes setting an anchor tag to a new value and the back to invoke the measuring.

label {
  text = "test"

  onUpdate += {
      if (width == 0 && height == 0) {
          anchorRight = 0f
          anchorRight = 1f 
      }
  }
}.addTo(myOtherNode)