diff --git a/src/components/my-map/drawing.ts b/src/components/my-map/drawing.ts index f8496d3..59ef7c7 100644 --- a/src/components/my-map/drawing.ts +++ b/src/components/my-map/drawing.ts @@ -85,6 +85,7 @@ function configureDrawingLayerStyle( drawType: DrawTypeEnum, drawColor: string, drawMany: boolean, + hideDrawLabels: boolean, feature: FeatureLike, ) { drawColor = feature.get("color") || drawColor; @@ -95,7 +96,10 @@ function configureDrawingLayerStyle( radius: 12, fill: new Fill({ color: drawColor }), }), - text: drawMany ? styleFeatureLabels(drawType, feature) : undefined, + text: + drawMany && !hideDrawLabels + ? styleFeatureLabels(drawType, feature) + : undefined, }); default: return [ @@ -107,7 +111,10 @@ function configureDrawingLayerStyle( color: drawColor, width: 3, }), - text: drawMany ? styleFeatureLabels(drawType, feature) : undefined, + text: + drawMany && !hideDrawLabels + ? styleFeatureLabels(drawType, feature) + : undefined, }), getVertices(drawColor), ]; @@ -120,11 +127,18 @@ export function configureDrawingLayer( drawType: DrawTypeEnum, drawColor: string, drawMany: boolean, + hideDrawLabels: boolean, ) { return new VectorLayer({ source: drawingSource, style: function (feature) { - return configureDrawingLayerStyle(drawType, drawColor, drawMany, feature); + return configureDrawingLayerStyle( + drawType, + drawColor, + drawMany, + hideDrawLabels, + feature, + ); }, }); } diff --git a/src/components/my-map/index.ts b/src/components/my-map/index.ts index 9bdf566..1f297fd 100644 --- a/src/components/my-map/index.ts +++ b/src/components/my-map/index.ts @@ -247,6 +247,9 @@ export class MyMap extends LitElement { @property({ type: String }) areaUnit: AreaUnitEnum = "m2"; + @property({ type: Boolean }) + hideDrawLabels = false; + @property({ type: Boolean }) showScale = false; @@ -526,6 +529,7 @@ export class MyMap extends LitElement { this.drawType, this.drawColor, this.drawMany, + this.hideDrawLabels, ); if (this.drawMode) { // Clear drawingSource to begin, even if drawGeojsonData is provided