Skip to content

Commit

Permalink
Use AutoID for ImageWithRgba
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDang committed Jul 27, 2021
1 parent 5e3ec87 commit 8a88233
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Widgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,8 @@ type ImageWithRgbaWidget struct {
}

func ImageWithRgba(rgba *image.RGBA) *ImageWithRgbaWidget {
// Generate a unique id from first 100 pix from rgba
var pix []uint8
if len(rgba.Pix) >= 100 {
pix = rgba.Pix[:100]
} else {
pix = rgba.Pix
}

return &ImageWithRgbaWidget{
id: fmt.Sprintf("ImageWithRgba_%v", pix),
id: GenAutoID("ImageWithRgba_%v"),
width: 100,
height: 100,
rgba: rgba,
Expand Down

0 comments on commit 8a88233

Please sign in to comment.