watergis / maplibre-gl-legend

This module adds legend control which is able to create legend panel from mapbox style to maplibre-gl-legend
https://maplibre-gl-legend.water-gis.com/
MIT License
31 stars 7 forks source link

MaplibreLegendControl for UMD version is not constructor. #11

Closed smellman closed 1 year ago

smellman commented 1 year ago

Describe the bug MaplibreLegendControl for UMD version is not constructor.

To Reproduce Steps to reproduce the behavior:

  1. Download html from https://gist.github.com/smellman/5a1ff75bd877eb62025c44a5cb0e75be
  2. Open html file in your browser.
  3. See error in debug tool

Expected behavior It to be a constructor.

Desktop (please complete the following information):

Captain-Oski commented 1 year ago

I support this Issue, image

JinIgarashi commented 1 year ago

@smellman and @Captain-Oski , I am very sorry for inconvenience. README's usage of CDN was wrong, it missed module name of MaplibreLegendControl..

map.addControl(
                    new MaplibreLegendControl.MaplibreLegendControl(targets, {
                        showDefault: true,
                        showCheckbox: true,
                        onlyRendered: true,
                        reverseOrder: true
                    }),
                    'bottom-left'
                );

I also added an example HTML for UMD module (index_umd.html). Please check it.