(handleEnds: number[], visualInRange: BarVisual)
| 593 | } |
| 594 | |
| 595 | private _updateHandle(handleEnds: number[], visualInRange: BarVisual) { |
| 596 | if (!this._useHandle) { |
| 597 | return; |
| 598 | } |
| 599 | |
| 600 | const shapes = this._shapes; |
| 601 | const visualMapModel = this.visualMapModel; |
| 602 | const handleThumbs = shapes.handleThumbs; |
| 603 | const handleLabels = shapes.handleLabels; |
| 604 | const itemSize = visualMapModel.itemSize; |
| 605 | const dataExtent = visualMapModel.getExtent(); |
| 606 | const align = this._applyTransform('left', shapes.mainGroup); |
| 607 | |
| 608 | each([0, 1], function (handleIndex) { |
| 609 | const handleThumb = handleThumbs[handleIndex]; |
| 610 | handleThumb.setStyle('fill', visualInRange.handlesColor[handleIndex]); |
| 611 | handleThumb.y = handleEnds[handleIndex]; |
| 612 | |
| 613 | const val = linearMap(handleEnds[handleIndex], [0, itemSize[1]], dataExtent, true); |
| 614 | const symbolSize = this.getControllerVisual(val, 'symbolSize') as number; |
| 615 | |
| 616 | handleThumb.scaleX = handleThumb.scaleY = symbolSize / itemSize[0]; |
| 617 | handleThumb.x = itemSize[0] - symbolSize / 2; |
| 618 | |
| 619 | // Update handle label position. |
| 620 | const textPoint = graphic.applyTransform( |
| 621 | shapes.handleLabelPoints[handleIndex], |
| 622 | graphic.getTransform(handleThumb, this.group) |
| 623 | ); |
| 624 | |
| 625 | if (this._orient === 'horizontal') { |
| 626 | // If visualMap controls symbol size, an additional offset needs to be added to labels to avoid collision at minimum size. |
| 627 | // Offset reaches value of 0 at "maximum" position, so maximum position is not altered at all. |
| 628 | const minimumOffset = align === 'left' || align === 'top' |
| 629 | ? (itemSize[0] - symbolSize) / 2 |
| 630 | : (itemSize[0] - symbolSize) / -2; |
| 631 | |
| 632 | textPoint[1] += minimumOffset; |
| 633 | } |
| 634 | |
| 635 | handleLabels[handleIndex].setStyle({ |
| 636 | x: textPoint[0], |
| 637 | y: textPoint[1], |
| 638 | text: visualMapModel.formatValueText(this._dataInterval[handleIndex]), |
| 639 | verticalAlign: 'middle', |
| 640 | align: this._orient === 'vertical' ? this._applyTransform( |
| 641 | 'left', |
| 642 | shapes.mainGroup |
| 643 | ) as TextAlign : 'center' |
| 644 | }); |
| 645 | }, this); |
| 646 | } |
| 647 | |
| 648 | private _showIndicator( |
| 649 | cursorValue: number, |
no test coverage detected