Merge branch 'main' into worktree-agent-ac0c9e7144c57cf07
This commit is contained in:
444 files changed
+30007
-38
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
)
|
||||
|
||||
// Fade animates e's background and border colors over d; zero skips it.
|
||||
func Fade(e *ui.Element, d time.Duration) *ui.Element {
|
||||
if d > 0 {
|
||||
e.Transition(ui.ElementTransition{Colors: true, Duration: d})
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
// Rule draws a 1 DIP horizontal line from x0 to x1 at y, on device pixels.
|
||||
func Rule(p *ui.Painter, x0, x1, y float32, c ui.Color) {
|
||||
s := float64(p.Scale())
|
||||
px := math.Floor(float64(y) * s)
|
||||
if int(math.Round(s))%2 == 1 {
|
||||
px += 0.5
|
||||
}
|
||||
yy := float32(px / s)
|
||||
p.Line(x0, yy, x1, yy, 1, c)
|
||||
}
|
||||
Reference in new issue
Block a user