SDK JS
    Preparing search index...

    Interface SunControlWidgetOptions

    Configuration for SunControlWidget. Every field is optional; the defaults give a fully-functional panel tracking the map center with the sun-path arc and animation shown.

    Provide either system (the preferred, fully-wired path — the widget drives an Atmosphere that updates the map light/sky and your 3D layers) or onChange (UI-only mode, where you apply the SunState yourself). With neither, the widget still renders and dispatches the DOM sunchange event, but nothing in the scene is relit.

    interface SunControlWidgetOptions {
        collapseBelow?: number;
        defaultCollapsed?: boolean;
        defaultDate?: Date;
        defaultEnabled?: boolean;
        defaultShadows?: boolean;
        location?: "map-center" | readonly [number, number];
        onChange?: (sun: SunState, date: Date) => void;
        shadowsAvailable?: boolean;
        showAnimate?: boolean;
        showSunPath?: boolean;
        system?: Atmosphere;
    }
    Index

    Properties

    collapseBelow?: number

    Collapse the panel to a single sun button when the map container is narrower than this, in CSS pixels. Default 420.

    defaultCollapsed?: boolean

    Start collapsed to the round ☀ button (expand on click; the header's ▢ re-collapses). A user-initiated collapse (this option, or clicking ▢) sticks — the responsive width handler only auto-expands widgets IT collapsed. Default false (expanded).

    defaultDate?: Date

    Initial instant to display (a UTC Date). Default: now.

    defaultEnabled?: boolean

    Initial on/off state for the master geo-sun switch when there is no system to read it from. Default true. When a system is provided, its enabled flag wins.

    defaultShadows?: boolean

    Initial state for the Shadows switch when there is no system to read it from. Default false. When a system is provided, its Atmosphere.shadows wins — the Atmosphere is the source of truth and the widget is a view onto it.

    location?: "map-center" | readonly [number, number]

    Where the sun is evaluated and displayed: a fixed [lng, lat] tuple in degrees, or 'map-center' to track the map center (re-derived on the map's moveend). Default 'map-center'.

    onChange?: (sun: SunState, date: Date) => void

    UI-only mode: invoked on every change with the freshly computed sun state and the instant it was computed for. Use this to apply lighting yourself when you do not pass a system.

    Type Declaration

      • (sun: SunState, date: Date): void
      • Parameters

        • sun: SunState

          The computed sun state (altitudeDeg/azimuthDeg in degrees — azimuthDeg is a compass bearing clockwise from north — the unit ENU directionEnu vector and the twilight phase; see Atmosphere's SunState).

        • date: Date

          The UTC instant the sun state was computed for.

        Returns void

    shadowsAvailable?: boolean

    Enable the Shadows toggle. Default false, in which case the toggle is shown disabled. Set true when the driven system has shadow-casting layers wired (see each layer's shadows option).

    showAnimate?: boolean

    Show the play / animate-through-the-day control. Default true, but it is only active when a system is provided (it is rendered disabled otherwise).

    showSunPath?: boolean

    Show the sun-path arc diagram. Default true.

    system?: Atmosphere

    The Atmosphere to drive (the preferred path) — it handles the MapLibre light/sky and the renderer sun for your 3D layers. Required for the play/animate button and the Shadows toggle to have any effect.