From f47bf8e6916c534911ee71d0736b74606485c2f3 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Sat, 15 Jan 2022 15:50:27 +0000 Subject: [PATCH] Use HTML tooltip for marker display when it exists --- src/leaflet/marker/GenericMarker.ts | 2 +- src/util/areas.ts | 2 +- src/util/circles.ts | 2 +- src/util/lines.ts | 2 +- src/util/points.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/leaflet/marker/GenericMarker.ts b/src/leaflet/marker/GenericMarker.ts index 7c57a42..355be3f 100644 --- a/src/leaflet/marker/GenericMarker.ts +++ b/src/leaflet/marker/GenericMarker.ts @@ -32,7 +32,7 @@ export class GenericMarker extends Marker { this.options.icon = new GenericIcon({ icon: options.icon, - label: options.tooltip, + label: options.tooltipHTML || options.tooltip, iconSize: options.dimensions, isHtml: !!options.tooltipHTML, }); diff --git a/src/util/areas.ts b/src/util/areas.ts index 063b0c9..4fbbed0 100644 --- a/src/util/areas.ts +++ b/src/util/areas.ts @@ -33,7 +33,7 @@ export const createArea = (options: LiveAtlasAreaMarker, converter: Function): L } if (options.tooltip) { - area.bindTooltip(() => options.tooltip as string, tooltipOptions); + area.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions); } return area; diff --git a/src/util/circles.ts b/src/util/circles.ts index 6926633..39bfe7a 100644 --- a/src/util/circles.ts +++ b/src/util/circles.ts @@ -33,7 +33,7 @@ export const createCircle = (options: LiveAtlasCircleMarker, converter: Function } if (options.tooltip) { - circle.bindTooltip(() => options.tooltip as string, tooltipOptions); + circle.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions); } return circle; diff --git a/src/util/lines.ts b/src/util/lines.ts index 50bc7dc..c3e6a6e 100644 --- a/src/util/lines.ts +++ b/src/util/lines.ts @@ -31,7 +31,7 @@ export const createLine = (options: LiveAtlasLineMarker, converter: Function): L } if (options.tooltip) { - line.bindTooltip(() => options.tooltip as string, tooltipOptions); + line.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions); } return line; diff --git a/src/util/points.ts b/src/util/points.ts index fa6e13e..f5e93ec 100644 --- a/src/util/points.ts +++ b/src/util/points.ts @@ -56,7 +56,7 @@ export const updatePointMarker = (marker: Marker | undefined, options: LiveAtlas if(icon && icon instanceof GenericIcon) { icon.update({ icon: options.icon, - label: options.tooltip, + label: options.tooltipHTML || options.tooltip, iconSize: options.dimensions, isHtml: !!options.tooltipHTML, });