Source: map/tools/LayerLegendButton.js

import { UiElement } from '../../ui/UiElement.js';
import { LayerLegendOverview } from '../utils/LayerLegendOverview.js';

export { LayerLegendButton };

/**
 * Simple button to open the layer legend overview
 *
 * @author rhess <robin.hess@awi.de>
 * 
 * @memberof vef.map.tools
 */
class LayerLegendButton extends UiElement {

    constructor(map, position, layerTree) {
        super();

        this.map = map;
        this.position = position || "top-left";
        this.overview_ = new LayerLegendOverview(null, layerTree);

        // initialize element
        const element = this.getElement();
        element.classList.add("vef-tool");
        element.innerHTML = "<i class='vef vef-legend-small'></i>"
        element.title = "Show Layer Legends";
        element.addEventListener("click", () => this.overview_.open());

        this.map.addTool(this, this.position);
    }
}