Skip to content

Commit 8053ed3

Browse files
committed
🐛 解决bug:意外的斩断线删除节点的操作 fix: #253
1 parent cf6b980 commit 8053ed3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/src/core/dataStruct/shape/Line.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ export class Line extends Shape {
160160
return { intersects: false };
161161
}
162162

163-
// 如果线段的一个端点恰好位于水平线上,则视为相交
163+
// 如果线段的一个端点恰好位于水平线上,则不视为相交 # 253
164164
if (this.start.y === y || this.end.y === y) {
165-
return { intersects: true, point: new Vector(this.start.x, y) };
165+
return { intersects: false };
166166
}
167167

168168
// 计算线段在y轴方向上的变化率(斜率)
@@ -186,9 +186,9 @@ export class Line extends Shape {
186186
return { intersects: false };
187187
}
188188

189-
// 如果线段的一个端点恰好位于垂直线上,则视为相交
189+
// 如果线段的一个端点恰好位于垂直线上,则不视为相交 # 253
190190
if (this.start.x === x || this.end.x === x) {
191-
return { intersects: true, point: new Vector(x, this.start.y) };
191+
return { intersects: false };
192192
}
193193

194194
// 计算线段在x轴方向上的变化率(倒数斜率)

app/src/core/dataStruct/shape/Rectangle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ export class Rectangle extends Shape {
304304
* 判断点是否在矩形内
305305
*/
306306
public isPointIn(point: Vector): boolean {
307-
const collision_x = this.left <= point.x && this.right >= point.x;
308-
const collision_y = this.top <= point.y && this.bottom >= point.y;
307+
const collision_x = this.left < point.x && point.x < this.right;
308+
const collision_y = this.top < point.y && point.y < this.bottom;
309309
return collision_x && collision_y;
310310
}
311311

0 commit comments

Comments
 (0)