|
@@ -62,7 +62,13 @@ class DrawCanvas {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 区域检测
|
|
|
|
|
+ // 当拥有圆圈的坐标和尺寸(半径)信息,我们可以利用数学方式通过简单计算来检测在任意一个圆圈上的点击。我们所需要的就是获取到鼠标点击位置的坐标信息,并且跟所有的圆圈逐一进行相交检测:
|
|
|
|
|
+ // https://www.cnblogs.com/hanshuai/p/14385286.html
|
|
|
|
|
+ isIntersect(point, circle) {
|
|
|
|
|
+ return Math.sqrt((point.x-circle.x) ** 2 + (point.y - circle.y) ** 2) < circle.radius;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 画线
|
|
// 画线
|
|
|
drawLine(x = 0, y = 0) {
|
|
drawLine(x = 0, y = 0) {
|
|
|
if (!this._ctx || this._executionArr.type) return
|
|
if (!this._ctx || this._executionArr.type) return
|