image popup aspect ratio matches that of image
This commit is contained in:
@@ -2,6 +2,7 @@ package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
@@ -20,6 +21,11 @@ func SecondsToTimeString(s float64) string {
|
||||
return fmt.Sprintf("%d:%02d", min, sec)
|
||||
}
|
||||
|
||||
func ImageAspect(im image.Image) float32 {
|
||||
b := im.Bounds()
|
||||
return float32(b.Max.X-b.Min.X) / float32(b.Max.Y-b.Min.Y)
|
||||
}
|
||||
|
||||
func RichTextSegsFromHTMLString(s string) []widget.RichTextSegment {
|
||||
tokr := html.NewTokenizer(strings.NewReader(s))
|
||||
var segs []widget.RichTextSegment
|
||||
|
||||
Reference in New Issue
Block a user