Skip to content

Commit

Permalink
Improve rendering of icon-less buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jun 2, 2021
1 parent 61809b6 commit 6c5ab28
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions widget_button.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ func (w *ButtonWidget) Update(dev *streamdeck.Device) error {

if w.label != "" {
iconsize := int((float64(height) / 3.0) * 2.0)
err = drawImage(img, w.icon, iconsize, image.Pt(-1, margin))

bounds := img.Bounds()
bounds.Min.Y += iconsize + margin
bounds.Max.Y -= margin

if w.icon != "" {
err = drawImage(img, w.icon, iconsize, image.Pt(-1, margin))

bounds.Min.Y += iconsize + margin
bounds.Max.Y -= margin
}

drawString(img,
bounds,
ttfFont,
w.label,
w.fontsize,
image.Pt(-1, -1))
} else {
} else if w.icon != "" {
err = drawImage(img, w.icon, height, image.Pt(-1, -1))
}

Expand Down

0 comments on commit 6c5ab28

Please sign in to comment.