themes and styles
This commit is contained in:
+9
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user