(changed, replay)
| 636 | } |
| 637 | |
| 638 | update(changed, replay) { |
| 639 | const options = this.options.setContext(this.getContext()); |
| 640 | const active = this._active; |
| 641 | let properties; |
| 642 | let tooltipItems = []; |
| 643 | |
| 644 | if (!active.length) { |
| 645 | if (this.opacity !== 0) { |
| 646 | properties = { |
| 647 | opacity: 0 |
| 648 | }; |
| 649 | } |
| 650 | } else { |
| 651 | const position = positioners[options.position].call(this, active, this._eventPosition); |
| 652 | tooltipItems = this._createItems(options); |
| 653 | |
| 654 | this.title = this.getTitle(tooltipItems, options); |
| 655 | this.beforeBody = this.getBeforeBody(tooltipItems, options); |
| 656 | this.body = this.getBody(tooltipItems, options); |
| 657 | this.afterBody = this.getAfterBody(tooltipItems, options); |
| 658 | this.footer = this.getFooter(tooltipItems, options); |
| 659 | |
| 660 | const size = this._size = getTooltipSize(this, options); |
| 661 | const positionAndSize = Object.assign({}, position, size); |
| 662 | const alignment = determineAlignment(this.chart, options, positionAndSize); |
| 663 | const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, this.chart); |
| 664 | |
| 665 | this.xAlign = alignment.xAlign; |
| 666 | this.yAlign = alignment.yAlign; |
| 667 | |
| 668 | properties = { |
| 669 | opacity: 1, |
| 670 | x: backgroundPoint.x, |
| 671 | y: backgroundPoint.y, |
| 672 | width: size.width, |
| 673 | height: size.height, |
| 674 | caretX: position.x, |
| 675 | caretY: position.y |
| 676 | }; |
| 677 | } |
| 678 | |
| 679 | this._tooltipItems = tooltipItems; |
| 680 | this.$context = undefined; |
| 681 | |
| 682 | if (properties) { |
| 683 | this._resolveAnimations().update(this, properties); |
| 684 | } |
| 685 | |
| 686 | if (changed && options.external) { |
| 687 | options.external.call(this, {chart: this.chart, tooltip: this, replay}); |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | drawCaret(tooltipPoint, ctx, size, options) { |
| 692 | const caretPosition = this.getCaretPosition(tooltipPoint, size, options); |
no test coverage detected