themes and styles

This commit is contained in:
IliaDenisov
2026-03-08 15:31:17 +02:00
parent e37a67bc99
commit 1c2fc30127
39 changed files with 2693 additions and 199 deletions
+18 -18
View File
@@ -245,11 +245,21 @@ func (e *editor) BuildUI(w fyne.Window) {
}
func (e *editor) loadWorld(w *world.World) {
e.world = w
// TODO: store camera position in user settings
e.wp.CameraXWorldFp = w.W / 2
e.wp.CameraYWorldFp = w.H / 2
e.updateSizes()
if e.world == nil {
w.SetCircleRadiusScaleFp(world.SCALE / 4)
e.world = w
// TODO: store camera position in user settings
e.wp.CameraXWorldFp = w.W / 2
e.wp.CameraYWorldFp = w.H / 2
e.world.SetTheme(world.ThemeDark)
e.updateSizes()
} else {
if e.world.Theme().ID() == "theme.light.v1" {
e.world.SetTheme(world.ThemeDark)
} else {
e.world.SetTheme(world.ThemeLight)
}
}
e.RequestRefresh()
}
@@ -304,24 +314,14 @@ func mockWorldInit(w *world.World) {
StrokeDashes: new([]float64{10.}),
})
discStyle := w.AddStyleCircle(world.StyleOverride{
FillColor: color.RGBA{R: 255, G: 255, B: 0, A: 255},
})
circleStyle := w.AddStyleCircle(world.StyleOverride{
FillColor: world.TransparentFill(),
StrokeColor: color.RGBA{R: 255, G: 255, B: 255, A: 255},
StrokeWidthPx: new(4.0),
})
if _, err := w.AddCircle(150, 150, 50, world.CircleWithStyleID(discStyle)); err != nil {
if _, err := w.AddCircle(150, 150, 50); err != nil {
panic(err)
}
if _, err := w.AddCircle(150, 299, 30, world.CircleWithStyleID(circleStyle)); err != nil {
if _, err := w.AddCircle(150, 299, 30); err != nil {
panic(err)
}
if _, err := w.AddCircle(299, 150, 30, world.CircleWithStyleID(circleStyle)); err != nil {
if _, err := w.AddCircle(299, 150, 30); err != nil {
panic(err)
}