close image popup and add to playlist dialog on escape
This commit is contained in:
+8
-5
@@ -27,11 +27,6 @@ func ImageAspect(im image.Image) float32 {
|
||||
return float32(b.Max.X-b.Min.X) / float32(b.Max.Y-b.Min.Y)
|
||||
}
|
||||
|
||||
type PopUpProvider interface {
|
||||
CreatePopUp(fyne.CanvasObject) *widget.PopUp
|
||||
WindowSize() fyne.Size
|
||||
}
|
||||
|
||||
func RichTextSegsFromHTMLString(s string) []widget.RichTextSegment {
|
||||
tokr := html.NewTokenizer(strings.NewReader(s))
|
||||
var segs []widget.RichTextSegment
|
||||
@@ -59,3 +54,11 @@ func RichTextSegsFromHTMLString(s string) []widget.RichTextSegment {
|
||||
|
||||
return segs
|
||||
}
|
||||
|
||||
func ClosePopUpOnEscape(pop *widget.PopUp) {
|
||||
pop.Canvas.SetOnTypedKey(func(e *fyne.KeyEvent) {
|
||||
if e.Name == fyne.KeyEscape {
|
||||
pop.Hide()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user