From 9b8f45e62b69ef056d4241bf7dcfb4bee3a80748 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sat, 14 Nov 2026 13:21:59 -0800 Subject: [PATCH] fix(cctv): turning the layer on no longer flashes every camera before the view pass The icon set was created shown, and the pass that hides cameras beyond the horizon and thins crowded areas runs only from enable(), after init has waited on the health check. Every frame drawn in that wait showed the whole catalogue. The set now starts hidden; enable() culls, then shows it. --- src/layers/cctv/rendering.js | 5 +++++ src/layers/cctv/rendering.test.mjs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/layers/cctv/rendering.js b/src/layers/cctv/rendering.js index f82eeed7a..b0e964c1b 100644 --- a/src/layers/cctv/rendering.js +++ b/src/layers/cctv/rendering.js @@ -128,6 +128,11 @@ export function createRendering({ const set = drawOf(viewer).icons({ id: `cctv:${++iconSets}:icons`, horizonCull: true, + // Hidden until enable() has thinned and culled them + // (refreshHorizonCulling, then refreshCoverageStyles shows the set): + // shown from the start, every camera in the catalogue drew while the + // layer waited on its health check. + show: false, drawOrder: services.sprites?.spriteDrawOrder?.('cctv') ?? 0, }); // Columns of no rows put the set's host in the scene now, rather than diff --git a/src/layers/cctv/rendering.test.mjs b/src/layers/cctv/rendering.test.mjs index 936a7641f..00bdb3339 100644 --- a/src/layers/cctv/rendering.test.mjs +++ b/src/layers/cctv/rendering.test.mjs @@ -106,6 +106,9 @@ test('focus de-emphasis fades each icon from its own color', () => { }); assert.equal(drawn.focus, FOCUS_FACTOR); assert.equal(draw.set(setId).spec.horizonCull, true); + // Hidden until enable() has culled and thinned the cameras: the layer + // waits on its health check between drawing them and that pass. + assert.equal(draw.set(setId).show, false); } finally { unbind(); }