Skip to content

Commit

Permalink
Ignore items outside chart area for interaction (#9171)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed May 27, 2021
1 parent f486610 commit 77cfac1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/core.interaction.js
Expand Up @@ -166,6 +166,9 @@ function getNearestItems(chart, position, axis, intersect, useFinalPosition) {
}

const center = element.getCenterPoint(useFinalPosition);
if (!_isPointInArea(center, chart.chartArea, chart._minPadding)) {
return;
}
const distance = distanceMetric(position, center);
if (distance < minDistance) {
items = [{element, datasetIndex, index}];
Expand Down

0 comments on commit 77cfac1

Please sign in to comment.