Layout: review r2 fixes

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 12:59:52 -04:00
1 parent cfdccfec5c
commit 8c63b5b098
7 files changed
+105 -30

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
package internal
import "github.com/egoist/mygo/ui"
// Remeasure rebuilds the view when layout gives e another size than the w×h it was built for.
func Remeasure(c *ui.Context, e *ui.Element, w, h float32) *ui.Element {
return e.DrawOver(func(_ *ui.Painter, r ui.Rect) {
if abs(r.W-w) > 0.5 || abs(r.H-h) > 0.5 {
c.Invalidate()
}
})
}
func abs(v float32) float32 { return max(v, -v) }