Snap animated paths to MyGo's path-cache grid; removes cross-test snapshot flake

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 12:14:04 -04:00
1 parent bae0a48351
commit cfc7ab023d
5 files changed
+10 -1

No files matched your search

+8
View File
@@ -2,6 +2,8 @@
package internal
import (
"math"
"github.com/egoist/mygo/ui"
"mujicaui/theme"
@@ -33,3 +35,9 @@ func Diamond(cx, cy, s float32) *ui.Path {
p.Close()
return &p
}
// Snap rounds v to MyGo's quarter-device-pixel path cache grid.
func Snap(p *ui.Painter, v float32) float32 {
g := 4 * p.Scale()
return float32(math.Round(float64(v*g))) / g
}