* @function LevelRenderer.Shape.prototype.isCover * @description 判断鼠标位置是否在图形内。 * * @param {number} x - x。 * @param {number} y - y。
(x, y)
| 551 | * @param {number} y - y。 |
| 552 | */ |
| 553 | isCover(x, y) { |
| 554 | var originPos = this.getTansform(x, y); |
| 555 | x = originPos[0]; |
| 556 | y = originPos[1]; |
| 557 | |
| 558 | // 快速预判并保留判断矩形 |
| 559 | var rect = this.style.__rect; |
| 560 | if (!rect) { |
| 561 | rect = this.style.__rect = this.getRect(this.style); |
| 562 | } |
| 563 | |
| 564 | if (x >= rect.x |
| 565 | && x <= (rect.x + rect.width) |
| 566 | && y >= rect.y |
| 567 | && y <= (rect.y + rect.height) |
| 568 | ) { |
| 569 | // 矩形内 |
| 570 | return SUtil.Util_area.isInside(this, this.style, x, y); |
| 571 | } |
| 572 | |
| 573 | return false; |
| 574 | } |
| 575 | |
| 576 | |
| 577 | /** |
no test coverage detected