Tear down a picking session: event listeners (DOM + Three
EventDispatcher, all funneled through the session's EventGroup), the
PickingSystem, and the string/image loaders. Idempotent — every step
tolerates an already-disposed / absent collaborator.
Called from two places:
loadDataset disposes the previous session UP-FRONT (alongside
disposeOverlays), in lockstep with clearSceneContent(): the old
session's nodeMap references geometries the scene clear disposes,
so if the load fails mid-way the stale session (with a live
embedder-selection consumer) would otherwise keep firing picks
against disposed geometries until the next successful load.
initPicking below re-runs it defensively before (re)creating the
session, covering callers that reach init without the up-front
dispose (a second call is a cheap no-op).
Tear down a picking session: event listeners (DOM + Three EventDispatcher, all funneled through the session's EventGroup), the PickingSystem, and the string/image loaders. Idempotent — every step tolerates an already-disposed / absent collaborator.
Called from two places:
loadDatasetdisposes the previous session UP-FRONT (alongsidedisposeOverlays), in lockstep withclearSceneContent(): the old session's nodeMap references geometries the scene clear disposes, so if the load fails mid-way the stale session (with a live embedder-selection consumer) would otherwise keep firing picks against disposed geometries until the next successful load.initPickingbelow re-runs it defensively before (re)creating the session, covering callers that reach init without the up-front dispose (a second call is a cheap no-op).