GeoLeaf Core API - v3.0.0
    Preparing search index...

    Interface LabelButtonManagerApi

    The 🏷️ toggle buttons the layer manager injects next to each labelled layer.

    Mounted on the global as GeoLeaf._LabelButtonManager. ⚠️ There is no sync() member, despite what docs/labels/LABEL_BUTTON_MANAGER.md documents: the surface is LabelButtonManagerApi.syncImmediate plus the private _doSync, and every real caller uses the former. The phantom went unnoticed because the global declares _LabelButtonManager?: unknown, so no call through it is type-checked (B-13).

    interface LabelButtonManagerApi {
        createButton(
            layerId: string,
            controlsContainer: HTMLElement,
        ): HTMLElement | null;
        _doSync(layerId: string): void;
        _getState(layerId: string): LabelButtonSyncState;
        _applyState(button: HTMLButtonElement, state: LabelButtonSyncState): void;
        syncImmediate(layerId: string): void;
        removeButtons(): void;
    }
    Index

    Methods

    • Builds the toggle button for a layer and attaches it to the controls container.

      Called by the layer manager on first render of a layer item.

      Parameters

      • layerId: string

        Layer the button drives.

      • controlsContainer: HTMLElement

        Element the button is appended to.

      Returns HTMLElement | null

      The button, or null when the layer carries no label configuration.

      // Called by Layer Manager during first render
      const button = GeoLeaf._LabelButtonManager.createButton("poi-restaurants", controlsContainer);
    • Re-reads a layer's state and repaints its button now, bypassing the debounce.

      The urgent path, for changes the user just caused — a visibility toggle, a theme switch. The debounced counterpart is the private _doSync.

      Parameters

      • layerId: string

        Layer whose button is repainted.

      Returns void

      // Called after layer visibility toggle (urgent)
      GeoLeaf._LabelButtonManager.syncImmediate("poi-restaurants");
    • Removes every injected button and releases their listeners.

      ⚠️ Not cosmetic: each button carries two listeners that nothing else releases, so a destroy without this leaves clickable toggles wired to a torn-down singleton.

      Returns void