MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _updateAnimationTarget

Method _updateAnimationTarget

src/plugins/plugin.tooltip.js:1064–1088  ·  view source on GitHub ↗

* Update x/y animation targets when _active elements are animating too * @private

(options)

Source from the content-addressed store, hash-verified

1062 * @private
1063 */
1064 _updateAnimationTarget(options) {
1065 const chart = this.chart;
1066 const anims = this.$animations;
1067 const animX = anims && anims.x;
1068 const animY = anims && anims.y;
1069 if (animX || animY) {
1070 const position = positioners[options.position].call(this, this._active, this._eventPosition);
1071 if (!position) {
1072 return;
1073 }
1074 const size = this._size = getTooltipSize(this, options);
1075 const positionAndSize = Object.assign({}, position, this._size);
1076 const alignment = determineAlignment(chart, options, positionAndSize);
1077 const point = getBackgroundPoint(options, positionAndSize, alignment, chart);
1078 if (animX._to !== point.x || animY._to !== point.y) {
1079 this.xAlign = alignment.xAlign;
1080 this.yAlign = alignment.yAlign;
1081 this.width = size.width;
1082 this.height = size.height;
1083 this.caretX = position.x;
1084 this.caretY = position.y;
1085 this._resolveAnimations().update(this, point);
1086 }
1087 }
1088 }
1089
1090 /**
1091 * Determine if the tooltip will draw anything

Callers 1

drawMethod · 0.95

Calls 5

_resolveAnimationsMethod · 0.95
getTooltipSizeFunction · 0.85
determineAlignmentFunction · 0.85
getBackgroundPointFunction · 0.85
updateMethod · 0.65

Tested by

no test coverage detected