SDK JS
    Preparing search index...

    An embeddable, framework-agnostic MapLibre slice control (a maplibregl.IControl) — an interactive BOUNDED clipping volume cutting through the scene's Bitruvius 3D layers.

    "New slice" arms placement; the next map click drops the slice box through the clicked point (on 3D content when SliceWidgetOptions.pickPosition is provided, else on the terrain/basemap), facing the camera. The cut affects ONLY the box footprint — bounded by the plane's width and the cut depth (shown as a ground outline), unbounded vertically so buildings are cut floor-to-roof. Four on-map handles adjust it live:

    • ✥ move — slide the plane along its normal.
    • ⟷ width — drag the plane's edge to widen/narrow the cut.
    • ⇥ depth — drag the footprint's back edge to deepen/shorten the cut.
    • ⟳ rotate — orbit the plane's heading.

    Panel sliders mirror heading/tilt/width/depth, plus Flip (swap kept side), an enable toggle, and Reset. On each change it pushes the plane set to the scene's clipping controller and dispatches a DOM CustomEvent('slicechange', { detail: SliceState, bubbles: true }).

    The slice affects Bitruvius 3D layers only — the basemap, MapLibre terrain, and native MapLibre layers are not clipped.

    import { SliceWidget } from '@bitruvius/sdk-maplibre';
    map.addControl(new SliceWidget({ layers: [buildings, pointCloud] }), 'top-right');

    SliceWidgetOptions for the configuration fields.

    Implements

    • IControl
    Index

    Constructors

    Accessors

    Methods

    • Default control position.

      Returns ControlPosition

    • MapLibre IControl hook — builds the DOM, wires the controller + map handlers.

      Parameters

      • map: Map$1

      Returns HTMLElement

    • MapLibre IControl hook — full teardown (handlers, handles, styles, owned controller).

      Returns void

    • Fold the panel to its round FAB, or expand it back.

      Parameters

      • collapsed: boolean

        true to fold to the FAB, false to expand.

      Returns void

      Safe to call before map.addControl — the state is remembered and applied when the DOM is built, matching the other widgets.