vvvv / VL.StandardLibs

A collection of standard libraries for vvvv including VL.Stride, VL.Skia, VL.ImGui, msgpack.org[VL]
https://visualprogramming.net
GNU Lesser General Public License v3.0
35 stars 14 forks source link

Popup: Replace Bounds input pin by just the Position? #9

Closed antongit closed 1 year ago

antongit commented 1 year ago

At the moment the Popup widget has Bounds input pin, that is channel. Internally we set the bounds like that:

      if (boundsChanged)
      {
          ImGui.SetNextWindowPos(bounds.TopLeft.FromHectoToImGui());
          ImGui.SetNextWindowSize(bounds.Size.FromHectoToImGui());
      }

Unfortunately, somehow the SetNextWindowSize doesn't work as expected for the Popup (it does for the Modal), it works for one frame, and then the Popup jumps back to its somehow internally calculated size. See the HowTo Popup, HowTo Modal Popup. Maybe I'm missing something... SetNextWindowPos works as expected.

@azeno @gregsn: What do you think?

azeno commented 1 year ago

If it doesn't work, then yes, get rid of it. Or is it simply the changed check which makes trouble? As an alternative we could also make two pins for position and size and use Optional<Vector2> as type, so if not specified it's up to ImGui to do the layouting and if specified that value is taken, and set every frame.