mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
fix(cyclones): a double-click follows a storm's point or zooms to its track or cone again
The advisory was drawn as entities, which the default renderer's double-click followed (centre and forecast points) or zoomed to (tracks, cones, outlines). As draw-port items they took no part in it.
This commit is contained in:
1 parent
50cd49cc31
commit
fabf4439fe
3 files changed
+87
-3
No files matched your search
@@ -451,3 +451,39 @@ test('labels publish committed anchors to the shared overlay and follow selectio
|
||||
h.rendering.destroy();
|
||||
assert.equal(h.overlay.calls.at(-1), afterClear[1]);
|
||||
});
|
||||
|
||||
test('a double-click follows a storm’s points and zooms to its tracks and cones, as their entities did', async () => {
|
||||
const h = harness();
|
||||
await h.rendering.setSnapshot({ storms: [storm()] });
|
||||
for (const id of h.sets.points.items.keys()) {
|
||||
const target = h.rendering.followTargetFor(h.hit('points', id));
|
||||
assert.ok(target?.position, `${id} is followed`);
|
||||
assert.equal(target.key, `${h.sets.points.spec.id}:${id}`);
|
||||
}
|
||||
const center = h.rendering
|
||||
.followTargetFor(h.hit('points', 'cyclone:ep152026:center'))
|
||||
.position();
|
||||
const want = fromDegrees(179, 15, 0);
|
||||
assert.ok(
|
||||
Math.hypot(center.x - want.x, center.y - want.y, center.z - want.z) < 1e-6,
|
||||
);
|
||||
for (const kind of ['lines', 'cones'])
|
||||
for (const id of h.sets[kind].items.keys()) {
|
||||
const target = h.rendering.followTargetFor(h.hit(kind, id));
|
||||
assert.ok(target?.zoomTo?.radius > 0, `${id} is zoomed to`);
|
||||
}
|
||||
assert.equal(
|
||||
h.rendering.followTargetFor({
|
||||
set: 'other:points',
|
||||
id: 'cyclone:ep152026:center',
|
||||
surface: false,
|
||||
}),
|
||||
null,
|
||||
);
|
||||
h.rendering.clear();
|
||||
assert.equal(
|
||||
h.rendering.followTargetFor(h.hit('points', 'cyclone:ep152026:center')),
|
||||
null,
|
||||
);
|
||||
h.rendering.destroy();
|
||||
});
|
||||
Reference in new issue
Block a user