From 5bf7d65ce884fe02c2ddb972ab9c08abdceb3f67 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sat, 10 May 2025 14:46:56 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20go.mod=20?= =?UTF-8?q?=E5=92=8C=20go.sum=20=E6=96=87=E4=BB=B6=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E7=9A=84=E4=BE=9D=E8=B5=96=E9=A1=B9=E5=B9=B6?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A7=E7=89=88=E6=9C=AC=E7=9A=84=20imaged?= =?UTF-8?q?d=20=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 2 ++ service/beatleader/model.go | 13 +++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 214d58b..44c7629 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.23.0 toolchain go1.23.3 require ( + git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510064143-ba9126d54ac6 github.com/bytedance/mockey v1.2.14 github.com/chromedp/cdproto v0.0.0-20241003230502-a4a8f7c660df github.com/chromedp/chromedp v0.10.0 @@ -28,7 +29,6 @@ require ( ) require ( - git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510061940-c492839691e4 // indirect github.com/Microsoft/go-winio v0.4.14 // indirect github.com/andybalholm/brotli v1.1.1 // indirect github.com/bytedance/sonic v1.11.6 // indirect diff --git a/go.sum b/go.sum index bfa84ee..904ca58 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510061940-c492839691e4 h1:yDPaEFsQ7zj9NqLhl2iOY2bswn8+oNcGTl/1geJgeAs= git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510061940-c492839691e4/go.mod h1:luas4p32Wtsywcz+8HsxIB3gf65FDDBa+3XYhm0S2b8= +git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510064143-ba9126d54ac6 h1:v1cEHG5kGJN5Tu+3icJ6gfrcwrXJRZQMCu8eb4goEKQ= +git.lxtend.com/lixiangwuxian/imagedd v0.0.0-20250510064143-ba9126d54ac6/go.mod h1:luas4p32Wtsywcz+8HsxIB3gf65FDDBa+3XYhm0S2b8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= diff --git a/service/beatleader/model.go b/service/beatleader/model.go index c1cba5f..99aef2a 100644 --- a/service/beatleader/model.go +++ b/service/beatleader/model.go @@ -6,7 +6,6 @@ import ( "image/color" "image/draw" "log" - "math" "os" "strings" "time" @@ -619,15 +618,17 @@ func (p PlayerDataLite) LastDiffToImage(lastDayQueryData PlayerDataLite) string } baseboard.AddSprite(&textSpirit) - totalWidth := textImg.Bounds().Dx() + avatar.Bounds().Dx() - totalHeight := math.Max(float64(textImg.Bounds().Dy()), float64(avatar.Bounds().Dy())) + minX, minY, maxX, maxY := baseboard.GetRenderBounds() + totalWidth := maxX - minX + totalHeight := maxY - minY background := image.NewRGBA(image.Rect(0, 0, int(totalWidth), int(totalHeight))) draw.Draw(background, background.Bounds(), image.White, image.Point{}, draw.Src) backgroundSpirit := sprite.Sprite{ - Name: "background", - Image: background, - Index: 0, + Name: "background", + Image: background, + Index: 0, + Position: image.Point{X: minX, Y: minY}, } baseboard.AddSprite(&backgroundSpirit)