MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / isCover

Method isCover

src/common/overlay/levelRenderer/Shape.js:553–574  ·  view source on GitHub ↗

* @function LevelRenderer.Shape.prototype.isCover * @description 判断鼠标位置是否在图形内。 * * @param {number} x - x。 * @param {number} y - y。

(x, y)

Source from the content-addressed store, hash-verified

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 /**

Callers 2

ShapeSpec.jsFile · 0.80
findHoverMethod · 0.80

Calls 2

getRectMethod · 0.95
isInsideMethod · 0.80

Tested by

no test coverage detected