mirror of
https://github.com/wassname/moral-maps.git
synced 2026-09-22 13:20:36 +08:00
Prevent WVS frontier label placement crashes
Co-Authored-By: PI[gpt-5.6-terra] <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
co-authored by
PI[gpt-5.6-terra]
parent
08139484c0
commit
912451eaeb
@@ -101,6 +101,14 @@ function ReleaseScatter({ data, hidden, field, title, axisMode }) {
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (!found) {
|
||||
for (let cy = bounds.top + size.height / 2; cy <= bounds.bottom - size.height / 2 && !found; cy += size.height + 4) {
|
||||
for (let cx = bounds.left + size.width / 2; cx <= bounds.right - size.width / 2; cx += 12) {
|
||||
const candidate = box(cx, cy, size.width, size.height);
|
||||
if (!taken.some(obstacle => hits(candidate, obstacle))) { found = candidate; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) throw new Error(`no frontier label location for ${model.name}`);
|
||||
placement[model.name] = { ...found, anchor };
|
||||
taken.push(found);
|
||||
|
||||
Reference in New Issue
Block a user