Widgets added to Overlay have incorrect Size until window Resize event occurs. #5299
Open
2 tasks done
Labels
unverified
A bug that has been reported but not verified
Checklist
Describe the bug
When adding a Widget to the
Canvas().Overlays()
without first setting itsSize()
toCanvas().Size()
it is displayed with it's currentSize()
(Usually itsMinSize()
) instead of the size of the Canvas. Upon resizing the Window (Not via code) it is then resized to the fullCanvas().Size()
as you would have expected when it was initially added. The 'correct' behavior would be for the WidgetsLayout()
to be called with theCanvas.Size()
whenCanvas().Overlays().Add(widget)
is called.canvas.Rectangle
,widget.Label
, etc)widget.NewSimpleRenderer()
)Canvas().Overlays()
such asModalPopup
.How to reproduce
Canvas().Overlays()
. It will be 100, 100 instead of spanning the full Canvas.Screenshots
Using the example code provided, when you press "Space" it will add
bar
to theCanvas().Overlays()
which in this case is a simplecanvas.Rectangle
. When this is added to the overlay it's using the currentSize()
value of 100, 100.If you resize the window by dragging it out slightly, it updates to span the Width/Height of the full Canvas.
Example code
Fyne version
v2.5.2
Go compiler version
1.22.6
Operating system and version
NixOS
Additional Information
Reproducible on NixOS with both Hyprland and Gnome as well as Window11, with multiple different hardware setups.
Another method for viewing this behavior. This requires you to launch the application in debug mode
go run -tags debug .
This method will add a Label instead and you will see that it's bounding box is it's MinSize() when first added but after resizing the window the bounding box spans the Width/Height of the canvas the same as the Rectangle example.The text was updated successfully, but these errors were encountered: