giu
giu copied to clipboard
Row widget: strange behaviour when using CustomWidget
What happend?
when using CustomWidget inside RowWidget (especially as a last of the widgets), imgui.SameLine() is called incorrectly.
Code example
main.go
giu.Row(
giu.Label("Hi!"),
giu.Custom(func() { fmt.Println("Hello world!") }),
),
giu.Label("I'll be next to Hi label... - it shouldn't happen"),
To Reproduce
- Run my demo
- You'll see that both labels are in the same line
Version
(latest)
OS
fedora workstation 36
@AllenDang what do you think about the following solution, I've tought about: in (*RowWidget).Build:
- before rendering widget save giu.GetCursorPos()
- render widget
- check if new CursorPos is diffrent and (if so) call imgui.Sameline
sadly, it could affect performency... maybe add something like giu.Row(...).AutoDetectCursorMove(true)?
@gucio321 RowWidget has a list of types inside to decide whether to call SameLine or not, I think this is the best solution right now to leverage performance.
I think we can close this.