Skip to content

Commit d840b75

Browse files
committed
move addSims to web.go
1 parent b7816df commit d840b75

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

sims.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
package main
88

99
import (
10-
"cogentcore.org/core/core"
11-
"cogentcore.org/core/htmlcore"
12-
"cogentcore.org/core/styles"
1310
"cogentcore.org/core/tree"
1411
"github.com/compcogneuro/web/sims/stability"
1512
"github.com/compcogneuro/web/sims/urakubo"
@@ -36,19 +33,3 @@ func init() {
3633
"urakubo": e[urakubo.Sim, urakubo.Config],
3734
}
3835
}
39-
40-
func AddSims(ctx *htmlcore.Context) {
41-
for nm, em := range sims {
42-
snm := "sim-" + nm
43-
ctx.ElementHandlers[snm] = func(ctx *htmlcore.Context) bool {
44-
fr := core.NewFrame(ctx.BlockParent)
45-
fr.SetName(snm)
46-
fr.Styler(func(s *styles.Style) {
47-
s.Direction = styles.Column
48-
s.Grow.Set(1, 1)
49-
})
50-
em(fr)
51-
return true
52-
}
53-
}
54-
}

web.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99

1010
"cogentcore.org/core/content"
1111
"cogentcore.org/core/core"
12+
"cogentcore.org/core/htmlcore"
13+
"cogentcore.org/core/styles"
1214
"cogentcore.org/core/text/csl"
1315
_ "cogentcore.org/core/text/tex" // include this to get math
1416
"cogentcore.org/core/tree"
@@ -56,3 +58,19 @@ func main() {
5658

5759
b.RunMainWindow()
5860
}
61+
62+
func AddSims(ctx *htmlcore.Context) {
63+
for nm, em := range sims {
64+
snm := "sim-" + nm
65+
ctx.ElementHandlers[snm] = func(ctx *htmlcore.Context) bool {
66+
fr := core.NewFrame(ctx.BlockParent)
67+
fr.SetName(snm)
68+
fr.Styler(func(s *styles.Style) {
69+
s.Direction = styles.Column
70+
s.Grow.Set(1, 1)
71+
})
72+
em(fr)
73+
return true
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)