add context menu to cover thumbnail in bottom panel

This commit is contained in:
Drew Weymouth
2023-05-08 09:10:43 -07:00
parent f7b31e1514
commit 3e448ed995
6 changed files with 96 additions and 34 deletions
+9 -2
View File
@@ -50,7 +50,8 @@ type TappableImage struct {
widget.BaseWidget
canvas.Image
OnTapped func()
OnTapped func()
OnTappedSecondary func(pos fyne.Position)
}
func NewTappableImage(onTapped func()) *TappableImage {
@@ -86,12 +87,18 @@ func (t *TappableImage) Cursor() desktop.Cursor {
return desktop.DefaultCursor
}
func (t *TappableImage) Tapped(e *fyne.PointEvent) {
func (t *TappableImage) Tapped(_ *fyne.PointEvent) {
if t.haveImage() && t.OnTapped != nil {
t.OnTapped()
}
}
func (t *TappableImage) TappedSecondary(e *fyne.PointEvent) {
if t.haveImage() && t.OnTappedSecondary != nil {
t.OnTappedSecondary(e.AbsolutePosition)
}
}
func (t *TappableImage) CreateRenderer() fyne.WidgetRenderer {
return widget.NewSimpleRenderer(&t.Image)
}