(model: TooltipModel)
| 58 | } |
| 59 | |
| 60 | getPositionInRect(model: TooltipModel) { |
| 61 | const { target } = model; |
| 62 | |
| 63 | const startX = this.rect.x + model.x; |
| 64 | const startY = this.rect.y + model.y; |
| 65 | let x = startX + target.radius + target.width + this.offsetX; |
| 66 | let y = startY + this.offsetY; |
| 67 | |
| 68 | const { overflowX, overflowY } = this.isTooltipContainerOverflow(x, y); |
| 69 | const { width, height } = this.tooltipContainerEl.getBoundingClientRect(); |
| 70 | |
| 71 | if (overflowX) { |
| 72 | x = |
| 73 | startX - (width + target.radius + this.offsetX) > 0 |
| 74 | ? startX - (width + target.radius + this.offsetX) |
| 75 | : startX + this.offsetX; |
| 76 | } |
| 77 | |
| 78 | if (overflowY) { |
| 79 | y = |
| 80 | startY + target.height - (height + this.offsetY) > 0 |
| 81 | ? startY + target.height - (height + this.offsetY) |
| 82 | : y; |
| 83 | } |
| 84 | |
| 85 | return { x, y }; |
| 86 | } |
| 87 | |
| 88 | setTooltipPosition(model: TooltipModel) { |
| 89 | const { x, y } = this.getPositionInRect(model); |
no test coverage detected