Snap animated paths to MyGo's path-cache grid; removes cross-test snapshot flake
This commit is contained in:
5 files changed
+10
-1
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user