Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Class LayerStateManager

    Index
    layerOrder: string[] = []

    Ordered list of layer paths (insertion order from scene graph walk)

    layers: Map<string, LayerInfo> = ...

    Map from path to LayerInfo

    lastClickedPath: string | null = null

    Path of the last clicked layer (anchor for Shift+click range)

    listeners: Set<LayerChangeListener> = ...

    Change listeners

    soloState: { path: string; previous: Map<string, boolean> } | null = null

    Toggle-restore solo capture (see solo); null when not soloed.

    • A sound node exposed as a layer: eye = mute, slider = gain, tooltip = licence. Every appearance field is a neutral placeholder — nothing here reaches a material — so the row can sit in the same list as the geometry.

      Parameters

      • node: SceneNode
      • effectiveLayerOrder: number | undefined

      Returns void

    • Set a sound layer's live gain (clamped to [0, 2]); a no-op on other layers.

      Parameters

      • path: string
      • gain: number

      Returns void

    • Select a layer with napari-style modifiers.

      • 'single': clear all, select this one
      • 'add': toggle this one (Ctrl+click)
      • 'range': select from lastClicked to this (Shift+click)

      Parameters

      Returns void

    • Toggle-restore solo ("hide all others"). The first call captures the current visibility set and shows only path; soloing the SAME path again restores the captured set (for layers that still exist); soloing a DIFFERENT path re-targets while keeping the original capture, so the eventual un-solo restores the true pre-solo state. A manual visibility change or a scene reload clears the capture. One notification per transition (never per-layer).

      Parameters

      • path: string

      Returns void

    • Set visibility for many layers with a SINGLE change notification (setVisible notifies per call, so an N-layer sweep would re-render the panel N times). Clears any solo capture — a batch visibility change supersedes the remembered pre-solo state.

      Parameters

      • entries: { path: string; visible: boolean }[]

      Returns void

    • Replace a layer's state with a freshly derived LayerInfo (per-layer reset). Preserves selected, and clears any solo capture — the reset rewrites visibility behind the capture's back, so a later un-solo restore would silently overwrite it (and soloedPath would lie about which layers are showing in the meantime). Notifies once. The live object is mutated in place, so references held by callers stay valid.

      Parameters

      Returns void

    • Set display range for a layer

      Parameters

      • path: string
      • min: number
      • max: number

      Returns void

    • Set opacity for a layer

      Parameters

      • path: string
      • opacity: number

      Returns void

    • Set colormap for a layer

      Parameters

      • path: string
      • colormap: string

      Returns void

    • Re-default the display window after the layer's colormap was toggled.

      The window maps the RENDERED VALUE to [0, 1], and toggling a colormap changes what that value is — so the sensible default changes with it:

      • colormap ON → the value is the scalar (gsplat amplitude / per-element scalar), whose useful window is its data range. Keeping the direct-colour identity here would push updateScalarRange(0, 1) onto amplitudes that live in ~[1e-4, 0.02] and render near-black (the #522 failure).
      • colormap OFF → the value is authored RGB, whose range IS [0, 1].

      A window carried over from the other mode is meaningless, so this deliberately overwrites a user-set one.

      The slider BOUNDS follow the mode too, landing on exactly what a natively authored layer of that mode gets at init. Merely widening them instead would leave the useful window as an unusable sliver of the track — a gsplat amplitude window of [1e-4, 0.02] inside [0, 1] bounds is 2% of it.

      Parameters

      • path: string
      • colormapOn: boolean

      Returns void

    • Set (or clear) a layer's authored cross-layer draw order.

      undefined CLEARS it, which is not the same authored state as setting 0: both resolve to band 0, but only the latter remains a stated value in the panel and authored-band diagnostics. Clearing must therefore also clear layerOrderExplicit, or liveLayerAttrs would keep emitting the stale value as this layer's own setter.

      Parameters

      • path: string
      • level: number | undefined

      Returns void

    • Set absorption (volumetric κ) for a layer

      Parameters

      • path: string
      • absorption: number

      Returns void

    • Apply a mutation to all selected layers. The mutator receives each selected LayerInfo to modify in place.

      Parameters

      Returns void