Scale, fade and show icons by eye distance

Cesium icon sets now draw an item's scaleByDistance, fadeByDistance and
displayRange, as point sets already draw their curves, and drop them again
when a restyle in place leaves them out. An empty display range shows the
icon nowhere; a curve whose far end is not past its near one is left out
rather than refused mid-update. Cesium eases between a curve's ends rather
than interpolating linearly, as it always has for points.

The reference renderer now scales an item's pick size by its distance curve
and leaves out items faded or scaled to nothing, and the draw.icons.distance
conformance check covers all three fields.
This commit is contained in:
Sameh Khamis committed 2026-11-06 22:25:07 -08:00
1 parent 1aa280b43f
commit ee6b9e49aa
5 files changed
+147 -6

No files matched your search

+45
View File
@@ -1221,6 +1221,51 @@ export function portChecks() {
set.dispose();
},
),
check(
'draw.icons.distance',
'icons scale, fade and show by eye distance',
async (h, r) => {
await overAustin(h, r);
const set = r.draw.icons({ id: 'conf:icons-distance' });
const pos = h.toEcef({ ...AUSTIN, height: 0 });
const icon = (extra = {}) => ({
id: 'one',
pos,
image: DOT,
size: [16, 16],
...extra,
});
set.set([icon()]);
await drawn(h, r);
await settled(r);
const s = r.query.project(pos);
ok(s, 'the icon projects');
const at = (dx) => r.query.pick(s.x + dx, s.y);
const mine = (hit) => hit?.set === 'conf:icons-distance';
ok(mine(at(0)) && !mine(at(20)), 'drawn at its size');
// The eye is 2 km off: held at the curve's near value.
const curve = (value) => ({
near: 1e4,
nearValue: value,
far: 1e7,
farValue: value,
});
set.upsert([icon({ scaleByDistance: curve(4) })]);
await drawn(h, r);
await settled(r);
ok(mine(at(20)), 'scaled up by distance: picked 20 px off');
set.upsert([icon({ fadeByDistance: curve(0) })]);
await drawn(h, r);
ok(!mine(at(0)), 'faded out by distance: not drawn');
set.upsert([icon({ displayRange: [0, 100] })]);
await drawn(h, r);
ok(!mine(at(0)), 'out of its display range: not drawn');
set.upsert([icon({ displayRange: [0, 1e6] })]);
await drawn(h, r);
ok(mine(at(0)), 'in its display range: drawn');
set.dispose();
},
),
check(
'draw.columns',
'column updates are rows: sized, picked, removed',