Skip to content

Commit 57bbd82

Browse files
authored
Fix mismatch between hit boxes and drawn items in legend plugin (#11352)
* Fix mismatch between hit boxes and drawn items in legend plugin * fixes padding calculation
1 parent 1c2dd68 commit 57bbd82

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/plugins/plugin.legend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export class Legend extends Element {
428428
cursor.x += width + padding;
429429
} else if (typeof legendItem.text !== 'string') {
430430
const fontLineHeight = labelFont.lineHeight;
431-
cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight);
431+
cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight) + padding;
432432
} else {
433433
cursor.y += lineHeight;
434434
}
@@ -575,7 +575,7 @@ function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
575575
}
576576

577577
function calculateLegendItemHeight(legendItem, fontLineHeight) {
578-
const labelHeight = legendItem.text ? legendItem.text.length + 0.5 : 0;
578+
const labelHeight = legendItem.text ? legendItem.text.length : 0;
579579
return fontLineHeight * labelHeight;
580580
}
581581

-1.57 KB
Loading

0 commit comments

Comments
 (0)