maplibre-gl-layer-control 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,7 @@ A comprehensive layer control for MapLibre GL with advanced styling capabilities
11
11
  - ✅ **Auto-detection** - Automatically detects layer properties (opacity, visibility) and generates friendly names
12
12
  - ✅ **Layer visibility toggle** - Checkbox control for each layer
13
13
  - ✅ **Layer opacity control** - Smooth opacity slider with type-aware property mapping
14
+ - ✅ **Layer symbols** - Visual type indicators (colored shapes) next to layer names, auto-detected from layer paint properties
14
15
  - ✅ **Resizable panel** - Adjustable panel width (240-420px) with keyboard support
15
16
  - ✅ **Advanced style editor** - Per-layer-type styling controls:
16
17
  - **Fill layers**: color, opacity, outline-color
@@ -153,6 +154,11 @@ function MapComponent() {
153
154
  | `panelWidth` | `number` | `320` | Initial panel width in pixels |
154
155
  | `panelMinWidth` | `number` | `240` | Minimum panel width |
155
156
  | `panelMaxWidth` | `number` | `420` | Maximum panel width |
157
+ | `panelMaxHeight` | `number` | `600` | Maximum panel height (scrollable when exceeded) |
158
+ | `showStyleEditor` | `boolean` | `true` | Show gear icon for style editor |
159
+ | `showOpacitySlider` | `boolean` | `true` | Show opacity slider for layers |
160
+ | `showLayerSymbol` | `boolean` | `true` | Show layer type symbols (colored icons) next to layer names |
161
+ | `excludeDrawnLayers` | `boolean` | `true` | Exclude layers from drawing libraries (Geoman, Mapbox GL Draw, etc.) |
156
162
 
157
163
  ### LayerState
158
164
 
@@ -173,6 +179,33 @@ See the [examples](./examples) folder for complete working examples:
173
179
  - **[background-legend](./examples/background-legend)** - Background layer visibility control
174
180
  - **[react](./examples/react)** - React integration example
175
181
 
182
+ ### Layer Symbols
183
+
184
+ The layer control displays visual symbols (colored icons) next to each layer name to indicate the layer type. Symbols are automatically generated based on the layer's type and paint properties:
185
+
186
+ | Layer Type | Symbol |
187
+ |------------|--------|
188
+ | `fill` | Colored rectangle with border |
189
+ | `line` | Horizontal line |
190
+ | `circle` | Colored circle |
191
+ | `symbol` | Marker/pin icon |
192
+ | `raster` | Gradient rectangle |
193
+ | `heatmap` | Orange-red gradient |
194
+ | `hillshade` | Gray gradient |
195
+ | `fill-extrusion` | 3D rectangle |
196
+ | `background` | Rectangle with inner border |
197
+ | Background group | Stacked layers icon |
198
+
199
+ The symbol color is automatically extracted from the layer's paint properties (e.g., `fill-color`, `line-color`, `circle-color`). If a color cannot be determined, a neutral gray is used.
200
+
201
+ To disable layer symbols:
202
+
203
+ ```typescript
204
+ const layerControl = new LayerControl({
205
+ showLayerSymbol: false
206
+ });
207
+ ```
208
+
176
209
  ### Background Layer Legend
177
210
 
178
211
  When using the `layers` option to specify specific layers, all other layers are grouped under a "Background" entry. The Background layer includes a **gear icon** that opens a detailed legend panel showing: