Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-child committed Jun 23, 2023
1 parent 73524d9 commit a0fa5fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.20

require (
github.com/go-telegram/bot v0.7.13
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.3
github.com/gogf/gf/v2 v2.4.3
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.4
github.com/gogf/gf/v2 v2.4.4
)

require (
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.2 h1:a9E3rCbUAwPxbGMsw58ATF1tPD
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.2/go.mod h1:vcWNEnZdK2z3FImfWp3/A6bcirJbu8tGfzTMzg2qVO0=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.3 h1:wtIRoEB/5eii8qi2nsBzYMGe6o9xzxEdG7QLMxQJA8I=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.3/go.mod h1:xSyx+Y5PWOY2lLhOpJdLPsRCHEuw0i+PRyrvbqbWfVU=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.4 h1:qpyXk+0/IDjKEwMyP+9GAz4hUGityVFU80arIQFNREI=
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.4.4/go.mod h1:mxSu91GPO4iM6r+iQcnBd+zFmsF0Bp0aBDk+ijrN2Ak=
github.com/gogf/gf/v2 v2.4.0 h1:Tem4xKVI52h92XlKxKTxlID9hzzmTOVSI226vDJRZ1c=
github.com/gogf/gf/v2 v2.4.0/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogf/gf/v2 v2.4.2 h1:31ekx+YKisG84/iEC2Ih6lB+g92+sB9R+VrfIbqfpac=
github.com/gogf/gf/v2 v2.4.2/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogf/gf/v2 v2.4.3 h1:OP91EICmypAEaEpwSyjFnAZtTfcmeKXJQnPP4FZR/BM=
github.com/gogf/gf/v2 v2.4.3/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogf/gf/v2 v2.4.4 h1:+s7PKxd4LJKjJn5ODZvYcbXMM5e+88Ww1W3GdOarLE8=
github.com/gogf/gf/v2 v2.4.4/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
Expand Down
14 changes: 10 additions & 4 deletions internal/logic/myduo/myduo.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@ func (sv *sMyDuo) Draw(ctx context.Context, elem consts.MyDuoElements, toJpeg ..
originTextImgY := originTextImg.Bounds().Dy()
translatedTextImgY := translatedTextImg.Bounds().Dy()
ySize := flagImgY + 20 + originTextImgY + 20 + translatedTextImgY
translatedTextFix := 15
yBoxFix := -2
if originTextImgY >= 100 {
yBoxFix = 3
translatedTextFix = 20
}
// yCenter 260px
yBoxFrom := 260 - ySize/2 - 40
yBoxTo := ySize/2 + 260 + 36
yBoxFrom := 260 - ySize/2 - 39 - 2
yBoxTo := ySize/2 + 260 + 32 + yBoxFix
// box
sv.drawBox(img, 41, yBoxFrom, 751, yBoxTo,
color.RGBA{229, 229, 229, 255},
Expand All @@ -93,7 +99,7 @@ func (sv *sMyDuo) Draw(ctx context.Context, elem consts.MyDuoElements, toJpeg ..
flagImg, flagImg.Bounds().Min, draw.Over)
draw.Draw(img, img.Bounds().Add(image.Point{X: 41 + 41 - 3, Y: yBoxFrom + 42 + 22 + flagImgY}),
originTextImg, originTextImg.Bounds().Min, draw.Over)
draw.Draw(img, img.Bounds().Add(image.Point{X: 41 + 41 - 3, Y: yBoxFrom + 42 + 22 + flagImgY + 15 + originTextImgY}),
draw.Draw(img, img.Bounds().Add(image.Point{X: 41 + 41 - 3, Y: yBoxFrom + 42 + 22 + flagImgY + translatedTextFix + originTextImgY}),
translatedTextImg, translatedTextImg.Bounds().Min, draw.Over)
// character
sv.drawCharacter(img, elem.Character)
Expand Down Expand Up @@ -171,7 +177,7 @@ func (sv *sMyDuo) drawText(s string) *image.RGBA {
lines++
cursor = fixed.Int26_6(3 * 64)
}
sv.drawTextOnImg(img, f, v.Text, cursor, fixed.Int26_6(40*64+(lines*50*64)))
sv.drawTextOnImg(img, f, v.Text, cursor, fixed.Int26_6(40*64+(lines*52*64)))
cursor += w
}
if lines == 0 {
Expand Down

0 comments on commit a0fa5fc

Please sign in to comment.