@excalidraw/laser-pointer
Advanced tools
Comparing version 1.0.1 to 1.2.0
@@ -194,4 +194,4 @@ function $parcel$exportWildcard(dest, source) { | ||
} | ||
getSize(pressure, index, totalLength, runningLength) { | ||
return this.options.size * this.options.sizeMapping({ | ||
getSize(sizeOverride, pressure, index, totalLength, runningLength) { | ||
return (sizeOverride ?? this.options.size) * this.options.sizeMapping({ | ||
pressure: pressure, | ||
@@ -203,3 +203,3 @@ runningLength: runningLength, | ||
} | ||
getStrokeOutline() { | ||
getStrokeOutline(sizeOverride) { | ||
if (this.isFresh) return []; | ||
@@ -220,3 +220,3 @@ let points = [ | ||
0 | ||
], theta), this.getSize(c[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
ps.push($7635cb696243d7e2$export$e16d8520af44a096(c, $7635cb696243d7e2$export$1c8884ee32bdf443([ | ||
@@ -226,3 +226,3 @@ 1, | ||
0 | ||
], this.getSize(c[2], 0, len, 0)))); | ||
], this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
return ps; | ||
@@ -243,3 +243,3 @@ } | ||
0 | ||
], theta), this.getSize(c[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
for(let theta = Math.PI + pAngle; theta <= Math.PI * 2 + pAngle; theta += Math.PI / 16)ps.push($7635cb696243d7e2$export$e16d8520af44a096(n, $7635cb696243d7e2$export$1c8884ee32bdf443($7635cb696243d7e2$export$855df823ceb9b81b([ | ||
@@ -249,3 +249,3 @@ 1, | ||
0 | ||
], theta), this.getSize(n[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, n[2], 0, len, 0)))); | ||
ps.push(ps[0]); | ||
@@ -266,3 +266,3 @@ return ps; | ||
speed = prevSpeed + (d - prevSpeed) * 0.2; | ||
const cSize = this.getSize(pressure, i, len, runningLength); | ||
const cSize = this.getSize(sizeOverride, pressure, i, len, runningLength); | ||
if (cSize === 0) { | ||
@@ -318,5 +318,5 @@ visibleStartIndex = i + 1; | ||
const ppdirPU = $7635cb696243d7e2$export$855df823ceb9b81b(dirPU, Math.PI / 2); | ||
const startCapSize = this.getSize(first[2], 0, len, 0); | ||
const startCapSize = this.getSize(sizeOverride, first[2], 0, len, 0); | ||
const startCap = []; | ||
const endCapSize = this.getSize(penultimate[2], len - 2, len, runningLength); | ||
const endCapSize = this.getSize(sizeOverride, penultimate[2], len - 2, len, runningLength); | ||
const endCap = []; | ||
@@ -323,0 +323,0 @@ for(let theta = 0; theta <= Math.PI; theta += Math.PI / 16)startCap.unshift($7635cb696243d7e2$export$e16d8520af44a096(first, $7635cb696243d7e2$export$855df823ceb9b81b($7635cb696243d7e2$export$1c8884ee32bdf443(ppdirFS, startCapSize), -theta))); |
@@ -178,4 +178,4 @@ function $parcel$export(e, n, v, s) { | ||
} | ||
getSize(pressure, index, totalLength, runningLength) { | ||
return this.options.size * this.options.sizeMapping({ | ||
getSize(sizeOverride, pressure, index, totalLength, runningLength) { | ||
return (sizeOverride ?? this.options.size) * this.options.sizeMapping({ | ||
pressure: pressure, | ||
@@ -187,3 +187,3 @@ runningLength: runningLength, | ||
} | ||
getStrokeOutline() { | ||
getStrokeOutline(sizeOverride) { | ||
if (this.isFresh) return []; | ||
@@ -204,3 +204,3 @@ let points = [ | ||
0 | ||
], theta), this.getSize(c[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
ps.push($8cd7efb5af385306$export$e16d8520af44a096(c, $8cd7efb5af385306$export$1c8884ee32bdf443([ | ||
@@ -210,3 +210,3 @@ 1, | ||
0 | ||
], this.getSize(c[2], 0, len, 0)))); | ||
], this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
return ps; | ||
@@ -227,3 +227,3 @@ } | ||
0 | ||
], theta), this.getSize(c[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, c[2], 0, len, 0)))); | ||
for(let theta = Math.PI + pAngle; theta <= Math.PI * 2 + pAngle; theta += Math.PI / 16)ps.push($8cd7efb5af385306$export$e16d8520af44a096(n, $8cd7efb5af385306$export$1c8884ee32bdf443($8cd7efb5af385306$export$855df823ceb9b81b([ | ||
@@ -233,3 +233,3 @@ 1, | ||
0 | ||
], theta), this.getSize(n[2], 0, len, 0)))); | ||
], theta), this.getSize(sizeOverride, n[2], 0, len, 0)))); | ||
ps.push(ps[0]); | ||
@@ -250,3 +250,3 @@ return ps; | ||
speed = prevSpeed + (d - prevSpeed) * 0.2; | ||
const cSize = this.getSize(pressure, i, len, runningLength); | ||
const cSize = this.getSize(sizeOverride, pressure, i, len, runningLength); | ||
if (cSize === 0) { | ||
@@ -302,5 +302,5 @@ visibleStartIndex = i + 1; | ||
const ppdirPU = $8cd7efb5af385306$export$855df823ceb9b81b(dirPU, Math.PI / 2); | ||
const startCapSize = this.getSize(first[2], 0, len, 0); | ||
const startCapSize = this.getSize(sizeOverride, first[2], 0, len, 0); | ||
const startCap = []; | ||
const endCapSize = this.getSize(penultimate[2], len - 2, len, runningLength); | ||
const endCapSize = this.getSize(sizeOverride, penultimate[2], len - 2, len, runningLength); | ||
const endCap = []; | ||
@@ -307,0 +307,0 @@ for(let theta = 0; theta <= Math.PI; theta += Math.PI / 16)startCap.unshift($8cd7efb5af385306$export$e16d8520af44a096(first, $8cd7efb5af385306$export$855df823ceb9b81b($8cd7efb5af385306$export$1c8884ee32bdf443(ppdirFS, startCapSize), -theta))); |
@@ -29,5 +29,5 @@ export type Point = [x: number, y: number, r: number]; | ||
stabilizeTail(): void; | ||
getStrokeOutline(): Point[]; | ||
getStrokeOutline(sizeOverride?: number | undefined): Point[]; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@excalidraw/laser-pointer", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "Generate outline for laser pointer tool", | ||
@@ -5,0 +5,0 @@ "source": "src/index.ts", |
@@ -93,5 +93,11 @@ import type { Point } from './math' | ||
private getSize(pressure: number, index: number, totalLength: number, runningLength: number) { | ||
private getSize( | ||
sizeOverride: number | undefined, | ||
pressure: number, | ||
index: number, | ||
totalLength: number, | ||
runningLength: number | ||
) { | ||
return ( | ||
this.options.size * | ||
(sizeOverride ?? this.options.size) * | ||
this.options.sizeMapping({ | ||
@@ -106,3 +112,3 @@ pressure: pressure, | ||
getStrokeOutline(): Point[] { | ||
getStrokeOutline(sizeOverride?: number | undefined): Point[] { | ||
if (this.isFresh) { | ||
@@ -130,6 +136,6 @@ return [] | ||
for (let theta = 0; theta <= Math.PI * 2; theta += Math.PI / 16) { | ||
ps.push(m.add(c, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(c[2], 0, len, 0)))) | ||
ps.push(m.add(c, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(sizeOverride, c[2], 0, len, 0)))) | ||
} | ||
ps.push(m.add(c, m.smul([1, 0, 0] as Point, this.getSize(c[2], 0, len, 0)))) | ||
ps.push(m.add(c, m.smul([1, 0, 0] as Point, this.getSize(sizeOverride, c[2], 0, len, 0)))) | ||
@@ -148,7 +154,7 @@ return ps | ||
for (let theta = pAngle; theta <= Math.PI + pAngle; theta += Math.PI / 16) { | ||
ps.push(m.add(c, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(c[2], 0, len, 0)))) | ||
ps.push(m.add(c, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(sizeOverride, c[2], 0, len, 0)))) | ||
} | ||
for (let theta = Math.PI + pAngle; theta <= Math.PI * 2 + pAngle; theta += Math.PI / 16) { | ||
ps.push(m.add(n, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(n[2], 0, len, 0)))) | ||
ps.push(m.add(n, m.smul(m.rot([1, 0, 0] as Point, theta), this.getSize(sizeOverride, n[2], 0, len, 0)))) | ||
} | ||
@@ -181,3 +187,3 @@ | ||
const cSize = this.getSize(pressure, i, len, runningLength) | ||
const cSize = this.getSize(sizeOverride, pressure, i, len, runningLength) | ||
@@ -267,6 +273,6 @@ if (cSize === 0) { | ||
const startCapSize = this.getSize(first[2], 0, len, 0) | ||
const startCapSize = this.getSize(sizeOverride, first[2], 0, len, 0) | ||
const startCap: Point[] = [] | ||
const endCapSize = this.getSize(penultimate[2], len - 2, len, runningLength) | ||
const endCapSize = this.getSize(sizeOverride, penultimate[2], len - 2, len, runningLength) | ||
const endCap: Point[] = [] | ||
@@ -273,0 +279,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
249165
5564
0