switch resize algo; document odd window size behavior
This commit is contained in:
10
main.go
10
main.go
@@ -140,14 +140,18 @@ func updateImage(file string, img *tk.LabelWidget) {
|
|||||||
// -50 to give some space to breathe around the edges
|
// -50 to give some space to breathe around the edges
|
||||||
must(strconv.Atoi(tk.WinfoScreenWidth(tk.App)))-50,
|
must(strconv.Atoi(tk.WinfoScreenWidth(tk.App)))-50,
|
||||||
must(strconv.Atoi(tk.WinfoScreenHeight(tk.App)))-50,
|
must(strconv.Atoi(tk.WinfoScreenHeight(tk.App)))-50,
|
||||||
imaging.Linear,
|
imaging.CatmullRom,
|
||||||
)
|
)
|
||||||
repaint(img, filepath.Base(file), tk.Data(i))
|
repaint(img, filepath.Base(file), tk.Data(i))
|
||||||
directoryState.currentFile = filepath.Base(file)
|
directoryState.currentFile = filepath.Base(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
func repaint(img *tk.LabelWidget, name string, opt tk.Opt) {
|
func repaint(img *tk.LabelWidget, name string, data tk.Opt) {
|
||||||
img.Configure(tk.Image(tk.NewPhoto(opt)))
|
// TODO: sometimes, when going from a big image to a smaller one,
|
||||||
|
// the window remains the same height as the big image,
|
||||||
|
// even as the width shrinks to fit the smaller image.
|
||||||
|
// This only seems to happen when the large image was full-screen height.
|
||||||
|
img.Configure(tk.Image(tk.NewPhoto(data)))
|
||||||
if name != "" {
|
if name != "" {
|
||||||
tk.App.WmTitle(fmt.Sprintf("why | %s", name))
|
tk.App.WmTitle(fmt.Sprintf("why | %s", name))
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user