Update ellipse.tsx

This commit is contained in:
Steve Ruiz 2021-08-11 15:55:26 +01:00
parent b737a42ca9
commit ed4cab6fd4

View file

@ -211,13 +211,14 @@ export class Ellipse extends TLDrawShapeUtil<EllipseShape> {
// .map((int) => int.points[0]) // .map((int) => int.points[0])
// .sort((a, b) => Vec.dist(b, origin) - Vec.dist(a, origin))[0] // .sort((a, b) => Vec.dist(b, origin) - Vec.dist(a, origin))[0]
const intersection = Intersect.ray let intersection = Intersect.ray
.ellipse(origin, direction, center, shape.radius[0], shape.radius[1], shape.rotation || 0) .ellipse(origin, direction, center, shape.radius[0], shape.radius[1], shape.rotation || 0)
.points.sort((a, b) => Vec.dist(a, origin) - Vec.dist(b, origin))[0] .points.sort((a, b) => Vec.dist(a, origin) - Vec.dist(b, origin))[0]
if (!intersection) { if (!intersection) {
console.log('could not find an intersection') intersection = Intersect.lineSegment
return undefined .ellipse(point, center, center, shape.radius[0], shape.radius[1], shape.rotation || 0)
.points.sort((a, b) => Vec.dist(a, point) - Vec.dist(b, point))[0]
} }
// The anchor is a point between the handle and the intersection // The anchor is a point between the handle and the intersection