Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor xkcd layout #20

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions xkcd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func (x *XKCD) DataToScreen() {
if newline := strings.IndexAny(v, "\n.-,"); newline > -1 {
v = v[:newline] + "..."
}
// NOTE: See Id == 1459
if len(v) > 100 {
v = v[:100] + "..."
}
x.labels[tag].SetText(v)
}
}
Expand Down Expand Up @@ -167,8 +171,14 @@ func Show(app fyne.App) {
}),
submit)
x.image = &canvas.Image{FillMode: canvas.ImageFillOriginal}
imageContainer := widget.NewScrollContainer(x.image)
controlsContainer := fyne.NewContainerWithLayout(
layout.NewBorderLayout(buttons, form, nil, nil),
buttons, form)
w.SetContent(fyne.NewContainerWithLayout(
layout.NewBorderLayout(form, buttons, nil, nil),
form, buttons, x.image))
layout.NewBorderLayout(controlsContainer, nil, nil, nil),
controlsContainer, imageContainer))
w.Resize(fyne.NewSize(1000, 800)) // will limit to screensize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is a sensible start size? it seems very large?
I agree it will (depending on OS) likely limit to screen size, but it doesn't seem like the kind of window that wants to be so big.
Also I don't think we should be requesting center on screen without good reason.

w.CenterOnScreen()
w.Show()
}