Skip to content

Commit 062040e

Browse files
jeremymanningclaude
andcommitted
Fix minimap drag visual feedback and domain zoom to include sub-domains
- Minimap: update viewport rect locally during drag so it visually follows the pointer (was suppressed by _suppressViewportUpdates) - Domain zoom: compute union bounding box of domain + all descendants so parent domains encompass their sub-domain regions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 307b0ff commit 062040e

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/app.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,28 @@ async function switchDomain(domainId) {
494494

495495
if (!allDomainBundle) return;
496496

497-
// Look up the target domain's region from the registry (index.json)
498-
// — the single source of truth for bounding boxes.
497+
// Look up the target domain's region from the registry (index.json).
498+
// For parent domains, compute the union bounding box of the domain + all descendants
499+
// so the view encompasses all sub-domain content.
499500
let targetRegion = GLOBAL_REGION;
500501
const registryEntry = registry.getDomain(domainId);
501502
if (registryEntry && registryEntry.region) {
502-
targetRegion = registryEntry.region;
503+
const descendants = registry.getDescendants(domainId);
504+
if (descendants.length > 0) {
505+
let { x_min, x_max, y_min, y_max } = registryEntry.region;
506+
for (const descId of descendants) {
507+
const desc = registry.getDomain(descId);
508+
if (desc && desc.region) {
509+
x_min = Math.min(x_min, desc.region.x_min);
510+
x_max = Math.max(x_max, desc.region.x_max);
511+
y_min = Math.min(y_min, desc.region.y_min);
512+
y_max = Math.max(y_max, desc.region.y_max);
513+
}
514+
}
515+
targetRegion = { x_min, x_max, y_min, y_max };
516+
} else {
517+
targetRegion = registryEntry.region;
518+
}
503519
}
504520

505521
// Ensure the domain bundle is loaded/cached (for questions & labels).

src/viz/minimap.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ export class Minimap {
210210
const clampedCx = Math.max(vpW / 2, Math.min(1 - vpW / 2, cx));
211211
const clampedCy = Math.max(vpH / 2, Math.min(1 - vpH / 2, cy));
212212

213+
// Update viewport rect locally during drag (round-trip is suppressed)
214+
this.currentViewport = {
215+
x_min: clampedCx - vpW / 2, x_max: clampedCx + vpW / 2,
216+
y_min: clampedCy - vpH / 2, y_max: clampedCy + vpH / 2,
217+
};
218+
this.render();
219+
this._didDrag = true;
220+
213221
this.panHandler(clampedCx, clampedCy, false);
214222
}
215223

0 commit comments

Comments
 (0)