feat: hit on primitives
This commit is contained in:
@@ -2,8 +2,6 @@ package world
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// drawKind is used only for stable tie-breaking when priorities are equal.
|
||||
@@ -18,7 +16,7 @@ const (
|
||||
type drawItem struct {
|
||||
kind drawKind
|
||||
priority int
|
||||
id uuid.UUID
|
||||
id PrimitiveID
|
||||
styleID StyleID
|
||||
|
||||
// Exactly one of these is set.
|
||||
@@ -122,7 +120,7 @@ func (w *World) drawPlanSinglePass(drawer PrimitiveDrawer, plan RenderPlan, allo
|
||||
if a.kind != b.kind {
|
||||
return a.kind < b.kind
|
||||
}
|
||||
return uuidLess(a.id, b.id)
|
||||
return a.id < b.id
|
||||
})
|
||||
|
||||
drawer.Save()
|
||||
@@ -149,17 +147,3 @@ func (w *World) drawPlanSinglePass(drawer PrimitiveDrawer, plan RenderPlan, allo
|
||||
drawer.Restore()
|
||||
}
|
||||
}
|
||||
|
||||
func uuidLess(a, b uuid.UUID) bool {
|
||||
aa := a[:]
|
||||
bb := b[:]
|
||||
for i := 0; i < len(aa); i++ {
|
||||
if aa[i] < bb[i] {
|
||||
return true
|
||||
}
|
||||
if aa[i] > bb[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user