SidePanel

SidePanel

Top-level Control for ol-side-panel - provides a responsive tabbed left side panel for OpenLayers.

Observable Properties

Name Type Description
activePane SidePanelPane The currently active pane - or null if no pane is active.

Constructor

new SidePanel()

Source:
Example
import { SidePanel } from 'ol-side-panel';

const sidePanel = new SidePanel();

map.addControl(sidePanel);

const layersPane = sidePanel.definePane({
  paneId: 'layers',
  name: "Layers",
  icon: '<i class="bi bi-layers-half"></i>'
});

const layersGreeting = document.createElement('p');
layersGreeting.innerHTML = "Hi there layers!";

layersPane.addWidgetElement(layersGreeting);

Extends

Methods

addWidgetElement(paneId, widgetElement) → {SidePanelWidget}

Source:
Add an HTML element to the named pane as a new SidePanelWidget.
Parameters:
Name Type Description
paneId String The identifier of the pane to add the widget to.
widgetElement external:Element
Returns:
A reference to the newly added widget.
Type
SidePanelWidget

definePane(args) → {SidePanelPane}

Source:
Defines a new pane.
Parameters:
Name Type Description
args Object pane args
Properties
Name Type Description
paneId String Locally unique identifier for the pane - used to refer to the pane within an instance of the ol-side-panel control.
name String | external:Element Name of the pane - User-facing name of this pane.
icon String | external:Element Icon of the pane - User-facing icon for this pane.
weight Number Weight of the pane - controls the order of the pane tabs with lower numbers appearing closer to the top and higher numbers appearing farther down. Panes with a weight >= 100 will have their icons appear at the bottom of the tab bar.
Returns:
A reference to the newly defined pane.
Type
SidePanelPane

getPaneById(paneId) → {SidePanelPane}

Source:
Get the pane with the specified identifier.
Parameters:
Name Type Description
paneId String The identifier of the pane to get - this is the same identifier that was passed into definePane.
Returns:
A reference to the pane.
Type
SidePanelPane

removePaneById(paneId)

Source:
Remove the pane with the specified identifier.
Parameters:
Name Type Description
paneId String The identifier of the pane to remove - this is the same identifier that was passed into definePane.

setMap(map)

Source:
Parameters:
Name Type Description
map external:Map The OpenLayers map instance this control is being added to.