Update DrawSession.ts (#272)

This commit is contained in:
Steve Ruiz 2021-11-12 22:19:50 +00:00 committed by GitHub
parent 59d085b5ac
commit ec9a40b800
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@ export class DrawSession extends Session {
// when the draw session ends; if the user hasn't added additional // when the draw session ends; if the user hasn't added additional
// points, this single point will be interpreted as a "dot" shape. // points, this single point will be interpreted as a "dot" shape.
this.points = [[0, 0, point[2] || 0.5]] this.points = [[0, 0, point[2] || 0.5]]
this.shiftedPoints = [...this.points]
} }
start = () => void null start = () => void null
@ -122,10 +123,7 @@ export class DrawSession extends Session {
// If the new top left is the same as the previous top left, // If the new top left is the same as the previous top left,
// we don't need to shift anything: we just shift the new point // we don't need to shift anything: we just shift the new point
// and add it to the shifted points array. // and add it to the shifted points array.
points = [ points = [...this.shiftedPoints, Vec.sub(newPoint, delta).concat(newPoint[2])]
...this.shiftedPoints,
Vec.sub(newPoint, Vec.sub(topLeft, this.origin)).concat(newPoint[2]),
]
} }
this.shiftedPoints = points this.shiftedPoints = points