Stack sprite layers by draw order, flights on top

Each sprite layer's icon or dot set is now made at a draw order taken
from SPRITE_LAYER_ORDER through the renderer's per-set drawOrder:
flights over military, vessels, directions, transit, bikeshare, FIRMS
and CCTV, whichever layer was turned on first. Picks name the topmost
first. The orders are negative, so selection highlights, route
endpoints, the tracked plane and every other set at the default order
still draw over all sprite layers, as they did before.

The raise-to-top restorer, the sprite registry and the primitive-name
lookups are gone, which takes spriteOrder.js off the viewer-access list.
Before, the restorer raised the layers to the bottom of the scene in the
order they were enabled, so flights usually ended up under the others.
This commit is contained in:
Sameh Khamis committed 2026-11-09 14:32:50 -08:00
1 parent 657ef94f77
commit c073064507
40 files changed
+271 -562

No files matched your search

-3
View File
@@ -10,7 +10,6 @@ export function createLifecycle({
options,
}) {
const { state } = vesselState;
const { restoreSpriteOrder, restoreSpriteOrderOnEnable } = services.sprites;
const { releaseContinuousRender } = services.render;
const { ensureGeoidReady } = services.geoid;
const { registerPickOwner, unregisterPickOwner } = services.picking;
@@ -157,7 +156,6 @@ export function createLifecycle({
);
components.selection.installInteraction(viewer);
components.rendering.installRuntime(viewer);
restoreSpriteOrder(viewer);
},
enable(viewer) {
@@ -190,7 +188,6 @@ export function createLifecycle({
registerPickOwner('ais-live-vessels', (pickedId) =>
state.records.byMmsi.has(pickedId),
);
restoreSpriteOrderOnEnable('ais', activeViewer);
// Vessels are asked for by view, so ask again when the view moves away.
removeViewListener();
const moveEnd = activeViewer?.camera?.moveEnd;
+1 -1
View File
@@ -32,7 +32,7 @@ function services() {
clearOverlaySource: noop,
},
geoid: {},
sprites: { registerSpriteSet: noop },
sprites: {},
focus: {
focusNowMs: (now) => now,
getFocusTarget: () => null,
+1 -1
View File
@@ -34,7 +34,7 @@ function setup({ focusPassIsNeeded = () => false } = {}) {
clearOverlaySource: noop,
},
geoid: {},
sprites: { registerSpriteSet: noop },
sprites: {},
focus: {
focusNowMs: () => clock,
getFocusTarget: () => null,
+4 -12
View File
@@ -92,8 +92,7 @@ export function createRendering({
visualRecords = new WeakMap();
}
const { registerSpriteSet } = services.sprites;
let warnedNoSpriteOrder = false;
const { spriteDrawOrder } = services.sprites;
const {
forgetSpriteFocus,
focusNowMs,
@@ -138,20 +137,13 @@ export function createRendering({
const set = drawOf(viewer).icons({
id: `ais-vessels:${++instances}`,
horizonCull: true,
drawOrder: spriteDrawOrder?.('ais') ?? 0,
});
// Columns of no rows put the set's host in the scene now, where the
// sprite order finds it, rather than with its first vessel.
// Columns of no rows put the set's host in the scene now, rather than
// with its first vessel.
set.setColumns?.({ ids: [] });
state.icons = createVesselIconBook(set);
state.icons.show = state.feed.enabled;
if (registerSpriteSet) registerSpriteSet('ais', set.id);
else if (!warnedNoSpriteOrder) {
// Drawn still, but not raised over the other sprite layers.
warnedNoSpriteOrder = true;
console.warn(
'[Data:ais-live-vessels] the host has no registerSpriteSet; ships keep their draw order',
);
}
}
/** Let the icon draw set go (the layer is destroyed). */