File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
app/src/core/dataStruct/shape Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff 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轴方向上的变化率(倒数斜率)
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments