Skip to content

Commit ffeb536

Browse files
committed
Extend comment
1 parent 3b92323 commit ffeb536

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/core/core.controller.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,22 @@ class Chart {
10341034
const me = this;
10351035
const options = me.options;
10361036
const hoverOptions = options.hover;
1037+
10371038
// If the event is replayed from `update`, we should evaluate with the final positions.
1039+
//
1040+
// The `replay`:
1041+
// It's the last event (excluding click) that has occured before `update`.
1042+
// So mouse has not moved. It's also over the chart, because there is a `replay`.
1043+
//
1044+
// The why:
1045+
// If animations are active, the elements haven't moved yet compared to state before update.
1046+
// But if they will, we are activating the elements that would be active, if this check
1047+
// was done after the animations have completed. => "final positions".
1048+
// If there is no animations, the "final" and "current" positions are equal.
1049+
// This is done so we do not have to evaluate the active elements each animation frame
1050+
// - it would be expensive.
10381051
const useFinalPosition = replay;
1052+
10391053
let changed = false;
10401054

10411055
// Find Active Elements for hover and tooltips

0 commit comments

Comments
 (0)