remove time from draw
This commit is contained in:
parent
f342cb9ea1
commit
92b8df4b51
2 changed files with 3 additions and 9 deletions
|
@ -269,7 +269,7 @@ export class Draw extends TLDrawShapeUtil<DrawShape> {
|
||||||
|
|
||||||
const [x1, y1] = Vec.round(Vec.sub([bounds.minX, bounds.minY], shape.point))
|
const [x1, y1] = Vec.round(Vec.sub([bounds.minX, bounds.minY], shape.point))
|
||||||
|
|
||||||
const points = shape.points.map(([x0, y0, p, t]) => Vec.round([x0 - x1, y0 - y1]).concat(p, t))
|
const points = shape.points.map(([x0, y0, p]) => Vec.round([x0 - x1, y0 - y1]).concat(p))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
points,
|
points,
|
||||||
|
|
|
@ -15,7 +15,6 @@ export class DrawSession implements Session {
|
||||||
snapshot: DrawSnapshot
|
snapshot: DrawSnapshot
|
||||||
isLocked?: boolean
|
isLocked?: boolean
|
||||||
lockedDirection?: 'horizontal' | 'vertical'
|
lockedDirection?: 'horizontal' | 'vertical'
|
||||||
startTime: number
|
|
||||||
|
|
||||||
constructor(data: Data, id: string, point: number[]) {
|
constructor(data: Data, id: string, point: number[]) {
|
||||||
this.origin = point
|
this.origin = point
|
||||||
|
@ -28,7 +27,6 @@ export class DrawSession implements 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 = []
|
this.points = []
|
||||||
this.startTime = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start = () => void null
|
start = () => void null
|
||||||
|
@ -38,8 +36,7 @@ export class DrawSession implements Session {
|
||||||
|
|
||||||
// Roundabout way of preventing the "dot" from showing while drawing
|
// Roundabout way of preventing the "dot" from showing while drawing
|
||||||
if (this.points.length === 0) {
|
if (this.points.length === 0) {
|
||||||
this.startTime = Date.now()
|
this.points.push([0, 0, pressure])
|
||||||
this.points.push([0, 0, pressure, 0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drawing while holding shift will "lock" the pen to either the
|
// Drawing while holding shift will "lock" the pen to either the
|
||||||
|
@ -83,10 +80,7 @@ export class DrawSession implements Session {
|
||||||
this.previous = point
|
this.previous = point
|
||||||
|
|
||||||
// The new adjusted point
|
// The new adjusted point
|
||||||
const newPoint = Vec.round(Vec.sub(this.previous, this.origin)).concat(
|
const newPoint = Vec.round(Vec.sub(this.previous, this.origin)).concat(pressure)
|
||||||
pressure,
|
|
||||||
Date.now() - this.startTime
|
|
||||||
)
|
|
||||||
|
|
||||||
// Don't add duplicate points. Be sure to
|
// Don't add duplicate points. Be sure to
|
||||||
// test against the previous *adjusted* point.
|
// test against the previous *adjusted* point.
|
||||||
|
|
Loading…
Reference in a new issue