refactor: 调整 LastDiffToImage 函数中的背景图大小和位置,增加边距以改善图像布局效果

This commit is contained in:
lixiangwuxian 2025-05-10 14:49:22 +08:00
parent 5bf7d65ce8
commit 8e29152d6d

View File

@ -622,13 +622,13 @@ func (p PlayerDataLite) LastDiffToImage(lastDayQueryData PlayerDataLite) string
totalWidth := maxX - minX totalWidth := maxX - minX
totalHeight := maxY - minY totalHeight := maxY - minY
background := image.NewRGBA(image.Rect(0, 0, int(totalWidth), int(totalHeight))) background := image.NewRGBA(image.Rect(0, 0, int(totalWidth+10), int(totalHeight+10)))
draw.Draw(background, background.Bounds(), image.White, image.Point{}, draw.Src) draw.Draw(background, background.Bounds(), image.White, image.Point{}, draw.Src)
backgroundSpirit := sprite.Sprite{ backgroundSpirit := sprite.Sprite{
Name: "background", Name: "background",
Image: background, Image: background,
Index: 0, Index: 0,
Position: image.Point{X: minX, Y: minY}, Position: image.Point{X: minX - 5, Y: minY - 5},
} }
baseboard.AddSprite(&backgroundSpirit) baseboard.AddSprite(&backgroundSpirit)