Recreate tooltips on marker update

This commit is contained in:
James Lyne 2022-01-15 16:00:19 +00:00
parent f47bf8e691
commit 5391b2a34c
3 changed files with 32 additions and 3 deletions

View File

@ -62,7 +62,16 @@ export const updateArea = (area: LiveAtlasPolyline | LiveAtlasPolygon | undefine
area.closePopup(); area.closePopup();
area.unbindPopup(); area.unbindPopup();
area.bindPopup(() => createPopup(options, 'AreaPopup')); area.closeTooltip();
area.unbindTooltip();
if (options.popup) {
area.bindPopup(() => createPopup(options, 'AreaPopup'));
}
if (options.tooltip) {
area.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions);
}
if(dirty) { if(dirty) {
area.redraw(); area.redraw();

View File

@ -48,7 +48,17 @@ export const updateCircle = (circle: LiveAtlasPolyline | LiveAtlasPolygon | unde
circle.closePopup(); circle.closePopup();
circle.unbindPopup(); circle.unbindPopup();
circle.bindPopup(() => createPopup(options, 'CirclePopup')); circle.closeTooltip();
circle.unbindTooltip();
if (options.popup) {
circle.bindPopup(() => createPopup(options, 'AreaPopup'));
}
if (options.tooltip) {
circle.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions);
}
circle.setStyle(options.style); circle.setStyle(options.style);
circle.setLatLngs(getCirclePoints(options, converter, outline)); circle.setLatLngs(getCirclePoints(options, converter, outline));
circle.redraw(); circle.redraw();

View File

@ -44,7 +44,17 @@ export const updateLine = (line: LiveAtlasPolyline | undefined, options: LiveAtl
line.closePopup(); line.closePopup();
line.unbindPopup(); line.unbindPopup();
line.bindPopup(() => createPopup(options, 'LinePopup')); line.closeTooltip();
line.unbindTooltip();
if (options.popup) {
line.bindPopup(() => createPopup(options, 'AreaPopup'));
}
if (options.tooltip) {
line.bindTooltip(() => options.tooltipHTML || options.tooltip, tooltipOptions);
}
line.setStyle(options.style); line.setStyle(options.style);
line.setLatLngs(options.points.map(projectPointsMapCallback, converter)); line.setLatLngs(options.points.map(projectPointsMapCallback, converter));
line.redraw(); line.redraw();