G-code Preview — API Reference
    Preparing search index...
    interface PreviewControllerOptions {
        createWorker?: WorkerLike | (() => WorkerLike);
        parseDefaults?: WireParseOptions;
        renderer?: {
            adjacentLayers?: number;
            buildVolume?: BuildVolumeDef;
            cameraFov?: number;
            cameraMode?: CameraMode;
            chunksPerTick?: number;
            colorMode?: ColorMode;
            createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
            frameContent?: "object" | "all";
            geometryConcurrency?: number | "off" | "auto";
            geometryMemoryBudgetBytes?: number;
            ghostOpacity?: number;
            interactionQuality?: "off" | "auto";
            mode?: RendererMode;
            pixelRatio?: PixelRatioOption;
            progressivePreview?: ProgressivePreview;
            quality?: "auto" | QualityMode;
            qualityMode?: QualityPolicy;
            scheduleFrame?: (cb: () => void) => void;
            theme?: Theme;
            tube?: TubeOptions;
        };
    }
    Index
    createWorker?: WorkerLike | (() => WorkerLike)

    Custom worker factory (DD-005 slim/custom entries). Default: the batteries worker.

    parseDefaults?: WireParseOptions

    Applied to every parse unless overridden per-call.

    renderer?: {
        adjacentLayers?: number;
        buildVolume?: BuildVolumeDef;
        cameraFov?: number;
        cameraMode?: CameraMode;
        chunksPerTick?: number;
        colorMode?: ColorMode;
        createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
        frameContent?: "object" | "all";
        geometryConcurrency?: number | "off" | "auto";
        geometryMemoryBudgetBytes?: number;
        ghostOpacity?: number;
        interactionQuality?: "off" | "auto";
        mode?: RendererMode;
        pixelRatio?: PixelRatioOption;
        progressivePreview?: ProgressivePreview;
        quality?: "auto" | QualityMode;
        qualityMode?: QualityPolicy;
        scheduleFrame?: (cb: () => void) => void;
        theme?: Theme;
        tube?: TubeOptions;
    }

    Type Declaration

    • OptionaladjacentLayers?: number

      2D only: preceding "ghost" layers drawn beneath the active one (default 1, floor 0).

    • OptionalbuildVolume?: BuildVolumeDef
    • OptionalcameraFov?: number

      Perspective lens: vertical field of view in degrees (DD-032 §4.2), default 50. Framing reads it, so the framed content fits at any lens. Must be in [10, 120]: anything else throws RangeError from createPreviewController (never clamped). Kept across canvas rebinds. 3D only.

    • OptionalcameraMode?: CameraMode

      Camera projection (#150, DD-009 D3); default 'perspective'. 3D only.

    • OptionalchunksPerTick?: number
    • OptionalcolorMode?: ColorMode
    • OptionalcreateRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike

      Advanced/test injectables — pass-throughs of the renderer's own contract (3D only).

    • OptionalframeContent?: "object" | "all"

      Framing target (#306/#6): 'all' extrusion (default) or the printed 'object'. 3D only.

    • OptionalgeometryConcurrency?: number | "off" | "auto"

      Parallel tube-geometry build (DD-028). Default 'auto' (engages a capability+memory-aware pool for large tube builds in a browser); 'off' forces the synchronous path. 3D only.

    • OptionalgeometryMemoryBudgetBytes?: number

      Max in-flight tube-geometry bytes for the parallel build (DD-028 memory backpressure). 3D only.

    • OptionalghostOpacity?: number

      2D only: ghost-layer opacity (default 0.25).

    • OptionalinteractionQuality?: "off" | "auto"

      Interaction-aware quality (#306/2, DD-020): 'auto' reduces detail while moving. 3D only.

    • Optionalmode?: RendererMode

      Renderer implementation (DD-014 D5): '3d' (default) is the Three.js renderer; '2d' is the low-resource Canvas 2D layer view. The 3D renderer is loaded on demand, so a '2d' consumer's bundle never pulls Three.js. 3D-only options below are ignored (and disclosed) in '2d'.

    • OptionalpixelRatio?: PixelRatioOption

      Resting pixel ratio of the interactive canvas (drawing-buffer pixels per CSS pixel). Unset keeps the renderer's own ratio (1). A number in (0, 4], or 'device': the display's devicePixelRatio capped at 2, followed live as it changes (another monitor, browser zoom). Sharper on HiDPI screens, at a fill cost: a ratio of 2 shades 4× the fragments of 1. Anything else throws RangeError from createPreviewController (never clamped). Interaction quality still reduces it while the camera moves. The default capture() size does not change. Kept across canvas rebinds. 3D only.

    • OptionalprogressivePreview?: ProgressivePreview

      During-parse preview presentation (#60 curtain): 'lines' (default, stream the progressive line preview), 'hold' (keep progress events but reveal only the final coloured build — a single clean reveal), or 'off' (no progressive geometry or preview progress; drive your own loading treatment). parse-progress events flow in every mode. 3D only.

    • Optionalquality?: "auto" | QualityMode
    • OptionalqualityMode?: QualityPolicy

      Fidelity policy (DD-023 §4 D6): 'full' (complete representation, no auto-decimation / no tubes→lines), 'adaptive' (default; capability-aware auto reduction, disclosed), 'fast' (flat lines). Distinct from the geometry quality tier. 3D only.

    • OptionalscheduleFrame?: (cb: () => void) => void
    • Optionaltheme?: Theme

      Bounded declarative theme (#153, DD-009 D4). 3D only.

    • Optionaltube?: TubeOptions