MCPcopy
hub / github.com/chartjs/Chart.js / _updateAnimationTarget

Method _updateAnimationTarget

src/plugins/plugin.tooltip.js:1006–1030  ·  src/plugins/plugin.tooltip.js::Tooltip._updateAnimationTarget

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

(options)

Source from the content-addressed store, hash-verified

1004 * @private
1005 */
1006 _updateAnimationTarget(options) {
1007 const chart = this.chart;
1008 const anims = this.$animations;
1009 const animX = anims && anims.x;
1010 const animY = anims && anims.y;
1011 if (animX || animY) {
1012 const position = positioners[options.position].call(this, this._active, this._eventPosition);
1013 if (!position) {
1014 return;
1015 }
1016 const size = this._size = getTooltipSize(this, options);
1017 const positionAndSize = Object.assign({}, position, this._size);
1018 const alignment = determineAlignment(chart, options, positionAndSize);
1019 const point = getBackgroundPoint(options, positionAndSize, alignment, chart);
1020 if (animX._to !== point.x || animY._to !== point.y) {
1021 this.xAlign = alignment.xAlign;
1022 this.yAlign = alignment.yAlign;
1023 this.width = size.width;
1024 this.height = size.height;
1025 this.caretX = position.x;
1026 this.caretY = position.y;
1027 this._resolveAnimations().update(this, point);
1028 }
1029 }
1030 }
1031
1032 /**
1033 * 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