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
+9 -5
View File
@@ -127,7 +127,7 @@ func (w *World) HitTest(out []Hit, params *RenderParams, cursorXPx, cursorYPx in
}
// Gather candidates from grid cells, dedupe by ID.
cand := make(map[PrimitiveID]MapItem, 32)
cand := make(map[PrimitiveID]struct{}, 32)
for _, r := range rects {
colStart := w.worldToCellX(r.minX)
colEnd := w.worldToCellX(r.maxX - 1)
@@ -138,7 +138,7 @@ func (w *World) HitTest(out []Hit, params *RenderParams, cursorXPx, cursorYPx in
for col := colStart; col <= colEnd; col++ {
cell := w.grid[row][col]
for _, it := range cell {
cand[it.ID()] = it
cand[it.ID()] = struct{}{}
}
}
}
@@ -148,8 +148,12 @@ func (w *World) HitTest(out []Hit, params *RenderParams, cursorXPx, cursorYPx in
out = out[:0]
limit := cap(out)
for _, it := range cand {
h, ok := w.hitOne(it, cursorX, cursorY, zoomFp, allowWrap)
for id := range cand {
cur, ok := w.objects[id]
if !ok {
continue
}
h, ok := w.hitOne(cur, cursorX, cursorY, zoomFp, allowWrap)
if !ok {
continue
}
@@ -210,7 +214,7 @@ func (w *World) hitOne(it MapItem, cx, cy int, zoomFp int, allowWrap bool) (Hit,
// Unknown style should not happen; treat as no-hit rather than panic.
return Hit{}, false
}
return hitCircle(v, style, cx, cy, zoomFp, allowWrap, w.W, w.H)
return hitCircle(v, circleRadiusEffFp(v.Radius, w.circleRadiusScaleFp), style, cx, cy, zoomFp, allowWrap, w.W, w.H)
case Line:
return hitLine(v, cx, cy, zoomFp, allowWrap, w.W, w.H)