From 56b07aeaf780741337fa4caca612cf81023d7740 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 23 Feb 2022 23:23:10 +0000 Subject: [PATCH] Fix error showing label on markers without an iconSize --- src/leaflet/icon/GenericIcon.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/leaflet/icon/GenericIcon.ts b/src/leaflet/icon/GenericIcon.ts index 9fc17f6..62ca0f3 100644 --- a/src/leaflet/icon/GenericIcon.ts +++ b/src/leaflet/icon/GenericIcon.ts @@ -109,13 +109,14 @@ export class GenericIcon extends Layer implements Icon { } this._image?.removeEventListener('mouseover', this._onHover); - - const size = point(this.options.iconSize as PointExpression), - sizeClass = [size.x, size.y].join('x'); - this._label = markerLabel.cloneNode(false) as HTMLSpanElement; - this._label.classList.add(/*'markerName_' + set.id,*/ `marker__label--${sizeClass}`); + if(this.options.iconSize) { + const size = point(this.options.iconSize as PointExpression), + sizeClass = [size.x, size.y].join('x'); + + this._label.classList.add(/*'markerName_' + set.id,*/ `marker__label--${sizeClass}`); + } if (this.options.isHtml) { this._label.innerHTML = this.options.label;