Skip to content

Commit

Permalink
Fix mismatch between hit boxes and drawn items in legend plugin (#11352)
Browse files Browse the repository at this point in the history
* Fix mismatch between hit boxes and drawn items in legend plugin

* fixes padding calculation
  • Loading branch information
stockiNail committed Jun 20, 2023
1 parent 1c2dd68 commit 57bbd82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/plugin.legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class Legend extends Element {
cursor.x += width + padding;
} else if (typeof legendItem.text !== 'string') {
const fontLineHeight = labelFont.lineHeight;
cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight);
cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight) + padding;
} else {
cursor.y += lineHeight;
}
Expand Down Expand Up @@ -575,7 +575,7 @@ function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
}

function calculateLegendItemHeight(legendItem, fontLineHeight) {
const labelHeight = legendItem.text ? legendItem.text.length + 0.5 : 0;
const labelHeight = legendItem.text ? legendItem.text.length : 0;
return fontLineHeight * labelHeight;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 57bbd82

Please sign in to comment.