simulationjsv2 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graphics.js +6 -3
- package/package.json +1 -1
package/dist/graphics.js
CHANGED
|
@@ -546,15 +546,18 @@ export class Line2d extends SimulationElement2d {
|
|
|
546
546
|
return this.moveTo(pos, t, f);
|
|
547
547
|
}
|
|
548
548
|
setEnd(pos, t = 0, f) {
|
|
549
|
+
const tempPos = cloneBuf(pos);
|
|
550
|
+
vector2ToPixelRatio(tempPos);
|
|
551
|
+
vec2.sub(tempPos, this.getPos(), tempPos);
|
|
549
552
|
const diff = vector3();
|
|
550
|
-
vec2.sub(
|
|
553
|
+
vec2.sub(tempPos, this.to, diff);
|
|
551
554
|
return transitionValues((p) => {
|
|
552
555
|
this.to[0] += diff[0] * p;
|
|
553
556
|
this.to[1] += diff[1] * p;
|
|
554
557
|
this.vertexCache.updated();
|
|
555
558
|
}, () => {
|
|
556
|
-
this.to[0] =
|
|
557
|
-
this.to[1] =
|
|
559
|
+
this.to[0] = tempPos[0];
|
|
560
|
+
this.to[1] = tempPos[1];
|
|
558
561
|
this.vertexCache.updated();
|
|
559
562
|
}, t, f);
|
|
560
563
|
}
|