Update DrawSession.ts (#762)
This commit is contained in:
parent
ff471e0d6d
commit
0d3bfd4eeb
1 changed files with 13 additions and 6 deletions
|
@ -30,13 +30,20 @@ export class DrawSession extends BaseSession {
|
||||||
this.isExtending = initialPoints.length > 0
|
this.isExtending = initialPoints.length > 0
|
||||||
const newPoints: number[][] = []
|
const newPoints: number[][] = []
|
||||||
if (this.isExtending) {
|
if (this.isExtending) {
|
||||||
const prevPoint = initialPoints[initialPoints.length - 1]
|
|
||||||
newPoints.push(prevPoint, prevPoint)
|
|
||||||
// Continuing with shift
|
// Continuing with shift
|
||||||
const len = Math.ceil(Vec.dist(prevPoint, currentPoint) / 16)
|
const prevPoint = initialPoints[initialPoints.length - 1]
|
||||||
for (let i = 0; i < len; i++) {
|
if (prevPoint) {
|
||||||
const t = i / (len - 1)
|
newPoints.push(prevPoint, prevPoint)
|
||||||
newPoints.push(Vec.lrp(prevPoint, currentPoint, t).concat(prevPoint[2]))
|
const len = Math.floor(Vec.dist(prevPoint, currentPoint) / 16)
|
||||||
|
|
||||||
|
if (len > 1) {
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const t = i / (len - 1)
|
||||||
|
newPoints.push(Vec.lrp(prevPoint, currentPoint, t).concat(prevPoint[2]))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newPoints.push(currentPoint, currentPoint)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newPoints.push(currentPoint)
|
newPoints.push(currentPoint)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue