Rebuild a draw set for an option change only where the option is built in

Changing pickable, blend or clampTo through setOptions rebuilt a set of
every kind, so a models set loaded each glTF again and blinked. Now blend
rebuilds points only, pickable rebuilds only shapes and lines (whose ground
primitives build it in), and clampTo rebuilds everything but models, which
clamp nothing. The other kinds read those options at pick time.
This commit is contained in:
Sameh Khamis committed 2026-11-06 22:10:46 -08:00
1 parent af449184ca
commit f24b66d80d
2 files changed
+106 -4

No files matched your search

+8 -4
View File
@@ -189,11 +189,15 @@ export function createCesiumDraw({ scene, report }) {
const pickable = spec.pickable !== false;
Object.assign(spec, options);
// What clamped items clamp to, how points blend, and whether ground
// primitives pick, are built into them.
// primitives pick, are built into them. Models clamp nothing, only
// points build in the blend, and only shapes and lines have ground
// primitives: other kinds are not rebuilt for those (models would
// load again).
if (
spec.clampTo !== clampTo ||
spec.blend !== blend ||
(spec.pickable !== false) !== pickable
(kind !== 'models' && spec.clampTo !== clampTo) ||
(kind === 'points' && spec.blend !== blend) ||
((kind === 'shapes' || kind === 'lines') &&
(spec.pickable !== false) !== pickable)
)
rebuild();
// A set that stops picking lets its old ground go now: still drawn