Fix error showing label on markers without an iconSize

This commit is contained in:
James Lyne 2022-02-23 23:23:10 +00:00
parent 3e1122d34d
commit 56b07aeaf7

View File

@ -109,13 +109,14 @@ export class GenericIcon extends Layer implements Icon<GenericIconOptions> {
} }
this._image?.removeEventListener('mouseover', this._onHover); 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 = 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) { if (this.options.isHtml) {
this._label.innerHTML = this.options.label; this._label.innerHTML = this.options.label;