cmd/scroll: update x/y scrolling demo.
This commit is contained in:
parent
70e5529a9b
commit
f96cdb619a
|
@ -80,7 +80,7 @@ func diffInsets(x, y app.Insets) bool {
|
||||||
|
|
||||||
func eventloop() {
|
func eventloop() {
|
||||||
w := app.NewWindow(
|
w := app.NewWindow(
|
||||||
app.WithWidth(ui.Dp(200)),
|
app.WithWidth(ui.Dp(400)),
|
||||||
app.WithHeight(ui.Dp(400)),
|
app.WithHeight(ui.Dp(400)),
|
||||||
app.WithTitle("Tickets"))
|
app.WithTitle("Tickets"))
|
||||||
ctx := gio.NewContext(w)
|
ctx := gio.NewContext(w)
|
||||||
|
@ -93,8 +93,14 @@ func eventloop() {
|
||||||
bg := gio.NewBackground(gio.Color(gray2))
|
bg := gio.NewBackground(gio.Color(gray2))
|
||||||
|
|
||||||
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
margin := gio.NewInset(gio.Size(ui.Dp(10)))
|
||||||
|
f1 := gio.NewFlex(gio.Axis(layout.Horizontal))
|
||||||
|
lbar := gio.NewLabel(" ", gio.Face(face))
|
||||||
|
f2 := gio.NewFlex(gio.Axis(layout.Vertical))
|
||||||
|
topbar := gio.NewLabel("Scroll X and Y. Click to select", gio.Face(face))
|
||||||
|
|
||||||
sh := gio.HScroll(gio.NewFlex(gio.Axis(layout.Horizontal)))
|
sh := gio.HScroll(gio.NewFlex(gio.Axis(layout.Horizontal)))
|
||||||
sv := gio.VScroll(gio.NewFlex(gio.Axis(layout.Vertical)))
|
sv := gio.VScroll(gio.NewFlex(gio.Axis(layout.Vertical)))
|
||||||
|
|
||||||
numlabs := 50
|
numlabs := 50
|
||||||
labs := make([][]gio.Widget, numlabs)
|
labs := make([][]gio.Widget, numlabs)
|
||||||
sels := make([][]bool, numlabs)
|
sels := make([][]bool, numlabs)
|
||||||
|
@ -127,7 +133,7 @@ func eventloop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sysbg(sysinset(bg(margin(
|
sysbg(sysinset(bg(margin(
|
||||||
sh(
|
f1(lbar,f2(topbar,sh(
|
||||||
sv(labs[0]...),
|
sv(labs[0]...),
|
||||||
sv(labs[1]...),
|
sv(labs[1]...),
|
||||||
sv(labs[2]...),
|
sv(labs[2]...),
|
||||||
|
@ -144,7 +150,7 @@ func eventloop() {
|
||||||
sv(labs[13]...),
|
sv(labs[13]...),
|
||||||
sv(labs[14]...),
|
sv(labs[14]...),
|
||||||
sv(labs[15]...),
|
sv(labs[15]...),
|
||||||
))))).Layout(ctx)
|
))))))).Layout(ctx)
|
||||||
ctx.Update()
|
ctx.Update()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user