Skip to content

Commit

Permalink
Avoid setting unchanged tooltip for lines
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Mar 2, 2024
1 parent c27a776 commit 4525624
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions leaflet/src/lines/lines-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ export default class LinesLayer extends FeatureGroup {

if (line.name && line.id != null) { // We don't want a popup for lines that we are drawing right now
const quoted = quoteHtml(line.name);
if (this.linesById[line.id]._tooltip) {
this.linesById[line.id].setTooltipContent(quoted);
} else {
if (!this.linesById[line.id]._tooltip) {
this.linesById[line.id].bindTooltip(quoted, { ...tooltipOptions, sticky: true, offset: [ 20, 0 ] });
} else if (this.linesById[line.id]._tooltip!.getContent() !== quoted) {
this.linesById[line.id].setTooltipContent(quoted);
}
} else if (this.linesById[line.id]._tooltip) {
this.linesById[line.id].unbindTooltip();
Expand Down

0 comments on commit 4525624

Please sign in to comment.