client io architecture

This commit is contained in:
Ilia Denisov
2026-03-12 18:45:46 +02:00
committed by GitHub
parent 2dafa69b93
commit 079b9facb0
36 changed files with 1810 additions and 460 deletions
-38
View File
@@ -147,18 +147,11 @@ func (w *World) Theme() StyleTheme {
}
// SetTheme updates the world's current theme.
// Step 1 behavior:
// - Does NOT mutate built-in default styles (1/2/3).
// - Materializes three theme default styles as new StyleIDs in the style table.
// - New objects (and later, theme-relative ones) can use these IDs.
// - Forces next render to full redraw.
func (w *World) SetTheme(theme StyleTheme) {
if theme == nil {
theme = DefaultTheme{}
}
// fmt.Println("current theme:", w.theme.ID())
w.theme = theme
// fmt.Println("new theme:", w.theme.ID())
// Drop derived cache when theme changes to avoid unbounded growth.
for k := range w.derivedCache {
@@ -174,7 +167,6 @@ func (w *World) SetTheme(theme StyleTheme) {
// Full redraw to apply new background and base styles.
w.renderState.Reset()
// w.forceFullRedraw = true
w.ForceFullRedrawNext()
}
@@ -503,36 +495,6 @@ func (w *World) AddLine(x1, y1, x2, y2 float64, opts ...LineOpt) (PrimitiveID, e
return id, nil
}
// func (g *World) resolvePointStyleID(o PointOptions) StyleID {
// if o.hasStyleID {
// return o.StyleID
// }
// if o.Override.IsZero() {
// return StyleIDDefaultPoint
// }
// return g.styles.AddDerived(StyleIDDefaultPoint, o.Override)
// }
// func (g *World) resolveCircleStyleID(o CircleOptions) StyleID {
// if o.hasStyleID {
// return o.StyleID
// }
// if o.Override.IsZero() {
// return StyleIDDefaultCircle
// }
// return g.styles.AddDerived(StyleIDDefaultCircle, o.Override)
// }
// func (g *World) resolveLineStyleID(o LineOptions) StyleID {
// if o.hasStyleID {
// return o.StyleID
// }
// if o.Override.IsZero() {
// return StyleIDDefaultLine
// }
// return g.styles.AddDerived(StyleIDDefaultLine, o.Override)
// }
// worldToCellX converts a fixed-point X coordinate to a grid column index.
func (w *World) worldToCellX(x int) int {
return worldToCell(x, w.W, w.cols, w.cellSize)