client io architecture
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user