microboard-temp 0.5.136 → 0.5.138
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/cjs/browser.js +195 -110
- package/dist/cjs/index.js +195 -110
- package/dist/cjs/node.js +195 -110
- package/dist/esm/browser.js +195 -110
- package/dist/esm/index.js +195 -110
- package/dist/esm/node.js +195 -110
- package/dist/types/Camera/Camera.d.ts +1 -0
- package/dist/types/Items/Transformation/Transformation.d.ts +2 -1
- package/dist/types/Items/Transformation/TransformationOperations.d.ts +15 -2
- package/dist/types/Settings.d.ts +3 -5
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -7302,6 +7302,20 @@ class TransformationCommand {
|
|
|
7302
7302
|
getReverse() {
|
|
7303
7303
|
const op = this.operation;
|
|
7304
7304
|
switch (this.operation.method) {
|
|
7305
|
+
case "applyMatrix": {
|
|
7306
|
+
const op2 = this.operation;
|
|
7307
|
+
return mapItemsByOperation(this.transformation, () => ({
|
|
7308
|
+
...op2,
|
|
7309
|
+
matrix: {
|
|
7310
|
+
translateX: -op2.matrix.translateX,
|
|
7311
|
+
translateY: -op2.matrix.translateY,
|
|
7312
|
+
scaleX: 1 / op2.matrix.scaleX,
|
|
7313
|
+
scaleY: 1 / op2.matrix.scaleY,
|
|
7314
|
+
shearX: 0,
|
|
7315
|
+
shearY: 0
|
|
7316
|
+
}
|
|
7317
|
+
}));
|
|
7318
|
+
}
|
|
7305
7319
|
case "translateTo":
|
|
7306
7320
|
return mapItemsByOperation(this.transformation, (transformation) => {
|
|
7307
7321
|
return {
|
|
@@ -7383,7 +7397,19 @@ class TransformationCommand {
|
|
|
7383
7397
|
return transformation.map((currTrans) => {
|
|
7384
7398
|
const op2 = operation.items[currTrans.getId()];
|
|
7385
7399
|
let reverseOp;
|
|
7386
|
-
if (op2.method === "
|
|
7400
|
+
if (op2.method === "applyMatrix") {
|
|
7401
|
+
reverseOp = {
|
|
7402
|
+
...op2,
|
|
7403
|
+
matrix: {
|
|
7404
|
+
translateX: -op2.matrix.translateX,
|
|
7405
|
+
translateY: -op2.matrix.translateY,
|
|
7406
|
+
scaleX: 1 / op2.matrix.scaleX,
|
|
7407
|
+
scaleY: 1 / op2.matrix.scaleY,
|
|
7408
|
+
shearX: 0,
|
|
7409
|
+
shearY: 0
|
|
7410
|
+
}
|
|
7411
|
+
};
|
|
7412
|
+
} else if (op2.method === "scaleByTranslateBy") {
|
|
7387
7413
|
reverseOp = {
|
|
7388
7414
|
...op2,
|
|
7389
7415
|
scale: { x: 1 / op2.scale.x, y: 1 / op2.scale.y },
|
|
@@ -7554,6 +7580,10 @@ class Transformation {
|
|
|
7554
7580
|
apply(op) {
|
|
7555
7581
|
this.previous = this.matrix.copy();
|
|
7556
7582
|
switch (op.method) {
|
|
7583
|
+
case "applyMatrix":
|
|
7584
|
+
this.matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7585
|
+
this.matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7586
|
+
break;
|
|
7557
7587
|
case "translateTo":
|
|
7558
7588
|
this.applyTranslateTo(op.x, op.y);
|
|
7559
7589
|
break;
|
|
@@ -7614,7 +7644,10 @@ class Transformation {
|
|
|
7614
7644
|
this.matrix.translate(translate.x, translate.y);
|
|
7615
7645
|
}
|
|
7616
7646
|
applyTransformMany(op) {
|
|
7617
|
-
if (op.method === "
|
|
7647
|
+
if (op.method === "applyMatrix") {
|
|
7648
|
+
this.matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7649
|
+
this.matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7650
|
+
} else if (op.method === "scaleByTranslateBy") {
|
|
7618
7651
|
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7619
7652
|
} else if (op.method === "scaleBy") {
|
|
7620
7653
|
this.applyScaleBy(op.x, op.y);
|
|
@@ -7681,66 +7714,75 @@ class Transformation {
|
|
|
7681
7714
|
getId() {
|
|
7682
7715
|
return this.id;
|
|
7683
7716
|
}
|
|
7684
|
-
|
|
7685
|
-
if (!this.id) {}
|
|
7717
|
+
emitMatrix(matrix, timeStamp) {
|
|
7686
7718
|
this.emit({
|
|
7687
7719
|
class: "Transformation",
|
|
7688
|
-
method: "
|
|
7720
|
+
method: "applyMatrix",
|
|
7689
7721
|
item: [this.id],
|
|
7690
|
-
|
|
7691
|
-
y,
|
|
7722
|
+
matrix,
|
|
7692
7723
|
timeStamp
|
|
7693
7724
|
});
|
|
7694
7725
|
}
|
|
7726
|
+
translateTo(x, y, timeStamp) {
|
|
7727
|
+
if (!this.id) {}
|
|
7728
|
+
this.emitMatrix({
|
|
7729
|
+
translateX: x - this.matrix.translateX,
|
|
7730
|
+
translateY: y - this.matrix.translateY,
|
|
7731
|
+
scaleX: 1,
|
|
7732
|
+
scaleY: 1,
|
|
7733
|
+
shearX: 0,
|
|
7734
|
+
shearY: 0
|
|
7735
|
+
}, timeStamp);
|
|
7736
|
+
}
|
|
7695
7737
|
translateBy(x, y, timeStamp) {
|
|
7696
7738
|
if (!this.id) {}
|
|
7697
7739
|
if (x === 0 && y === 0) {
|
|
7698
7740
|
return;
|
|
7699
7741
|
}
|
|
7700
|
-
this.
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
});
|
|
7742
|
+
this.emitMatrix({
|
|
7743
|
+
translateX: x,
|
|
7744
|
+
translateY: y,
|
|
7745
|
+
scaleX: 1,
|
|
7746
|
+
scaleY: 1,
|
|
7747
|
+
shearX: 0,
|
|
7748
|
+
shearY: 0
|
|
7749
|
+
}, timeStamp);
|
|
7708
7750
|
}
|
|
7709
7751
|
scaleTo(x, y, timeStamp) {
|
|
7710
|
-
this.
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
});
|
|
7752
|
+
this.emitMatrix({
|
|
7753
|
+
translateX: 0,
|
|
7754
|
+
translateY: 0,
|
|
7755
|
+
scaleX: x / this.matrix.scaleX,
|
|
7756
|
+
scaleY: y / this.matrix.scaleY,
|
|
7757
|
+
shearX: 0,
|
|
7758
|
+
shearY: 0
|
|
7759
|
+
}, timeStamp);
|
|
7718
7760
|
}
|
|
7719
7761
|
scaleBy(x, y, timeStamp) {
|
|
7720
7762
|
if (x === 0 && y === 0) {
|
|
7721
7763
|
return;
|
|
7722
7764
|
}
|
|
7723
|
-
this.
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
});
|
|
7765
|
+
this.emitMatrix({
|
|
7766
|
+
translateX: 0,
|
|
7767
|
+
translateY: 0,
|
|
7768
|
+
scaleX: x,
|
|
7769
|
+
scaleY: y,
|
|
7770
|
+
shearX: 0,
|
|
7771
|
+
shearY: 0
|
|
7772
|
+
}, timeStamp);
|
|
7731
7773
|
}
|
|
7732
7774
|
scaleByTranslateBy(scale, translate, timeStamp) {
|
|
7733
7775
|
if (scale.x === 0 && scale.y === 0 && translate.x === 0 && translate.y === 0) {
|
|
7734
7776
|
return;
|
|
7735
7777
|
}
|
|
7736
|
-
this.
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
scale,
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
});
|
|
7778
|
+
this.emitMatrix({
|
|
7779
|
+
translateX: translate.x,
|
|
7780
|
+
translateY: translate.y,
|
|
7781
|
+
scaleX: scale.x,
|
|
7782
|
+
scaleY: scale.y,
|
|
7783
|
+
shearX: 0,
|
|
7784
|
+
shearY: 0
|
|
7785
|
+
}, timeStamp);
|
|
7744
7786
|
}
|
|
7745
7787
|
rotateTo(degree, timeStamp) {
|
|
7746
7788
|
this.emit({
|
|
@@ -7760,27 +7802,28 @@ class Transformation {
|
|
|
7760
7802
|
timeStamp
|
|
7761
7803
|
});
|
|
7762
7804
|
}
|
|
7763
|
-
scaleToRelativeTo(x, y,
|
|
7764
|
-
this.
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
});
|
|
7805
|
+
scaleToRelativeTo(x, y, _point, timeStamp) {
|
|
7806
|
+
this.emitMatrix({
|
|
7807
|
+
translateX: 0,
|
|
7808
|
+
translateY: 0,
|
|
7809
|
+
scaleX: x / this.matrix.scaleX,
|
|
7810
|
+
scaleY: y / this.matrix.scaleY,
|
|
7811
|
+
shearX: 0,
|
|
7812
|
+
shearY: 0
|
|
7813
|
+
}, timeStamp);
|
|
7773
7814
|
}
|
|
7774
7815
|
scaleByRelativeTo(x, y, point, timeStamp) {
|
|
7775
|
-
this.
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
x,
|
|
7780
|
-
y,
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7816
|
+
const { scaleX: sx0, scaleY: sy0, translateX: tx0, translateY: ty0 } = this.matrix;
|
|
7817
|
+
const newSx = sx0 * x;
|
|
7818
|
+
const newSy = sy0 * y;
|
|
7819
|
+
this.emitMatrix({
|
|
7820
|
+
translateX: -point.x * newSx + point.x - tx0,
|
|
7821
|
+
translateY: -point.y * newSy + point.y - ty0,
|
|
7822
|
+
scaleX: x,
|
|
7823
|
+
scaleY: y,
|
|
7824
|
+
shearX: 0,
|
|
7825
|
+
shearY: 0
|
|
7826
|
+
}, timeStamp);
|
|
7784
7827
|
}
|
|
7785
7828
|
setIsLocked(isLocked, timestamp) {
|
|
7786
7829
|
if (isLocked) {
|
|
@@ -37079,7 +37122,11 @@ class Connector2 extends BaseItem {
|
|
|
37079
37122
|
this.transformation.subject.subscribe((_sub, op) => {
|
|
37080
37123
|
if (op.method === "transformMany") {
|
|
37081
37124
|
const operation = op.items[this.getId()];
|
|
37082
|
-
if (operation.method === "
|
|
37125
|
+
if (operation.method === "applyMatrix") {
|
|
37126
|
+
if (operation.matrix.scaleX !== 1 || operation.matrix.scaleY !== 1) {
|
|
37127
|
+
this.scalePoints();
|
|
37128
|
+
}
|
|
37129
|
+
} else if (operation.method === "scaleByTranslateBy" && (operation.scale.x !== 1 || operation.scale.y !== 1)) {
|
|
37083
37130
|
this.scalePoints();
|
|
37084
37131
|
}
|
|
37085
37132
|
}
|
|
@@ -49326,6 +49373,7 @@ class Camera {
|
|
|
49326
49373
|
trackingAnimationId = null;
|
|
49327
49374
|
trackingTarget = null;
|
|
49328
49375
|
lastTrackingTime = null;
|
|
49376
|
+
springVelocity = { translateX: 0, translateY: 0, scaleX: 0, scaleY: 0, shearX: 0, shearY: 0 };
|
|
49329
49377
|
constructor(boardPointer = new Pointer) {
|
|
49330
49378
|
this.boardPointer = boardPointer;
|
|
49331
49379
|
this.subject.subscribe((_camera) => {
|
|
@@ -49495,46 +49543,56 @@ class Camera {
|
|
|
49495
49543
|
}
|
|
49496
49544
|
this.isTrackingAnimation = true;
|
|
49497
49545
|
this.lastTrackingTime = null;
|
|
49498
|
-
const
|
|
49499
|
-
const
|
|
49546
|
+
const STIFFNESS = 150;
|
|
49547
|
+
const DAMPING = 28;
|
|
49548
|
+
const SNAP_PX = 0.5;
|
|
49500
49549
|
const SNAP_SCALE = 0.0005;
|
|
49550
|
+
const SNAP_VEL = 1;
|
|
49551
|
+
const springStep = (pos, tgt, vel, dt) => {
|
|
49552
|
+
const acc = STIFFNESS * (tgt - pos) - DAMPING * vel;
|
|
49553
|
+
const newVel = vel + acc * dt;
|
|
49554
|
+
return [pos + newVel * dt, newVel];
|
|
49555
|
+
};
|
|
49501
49556
|
const loop = () => {
|
|
49502
|
-
const
|
|
49503
|
-
if (!
|
|
49557
|
+
const tgt = this.trackingTarget;
|
|
49558
|
+
if (!tgt) {
|
|
49504
49559
|
this.trackingAnimationId = null;
|
|
49505
49560
|
this.isTrackingAnimation = false;
|
|
49506
49561
|
return;
|
|
49507
49562
|
}
|
|
49508
49563
|
const now = performance.now();
|
|
49509
|
-
const dt = this.lastTrackingTime !== null ?
|
|
49564
|
+
const dt = Math.min(this.lastTrackingTime !== null ? now - this.lastTrackingTime : 16, 50) / 1000;
|
|
49510
49565
|
this.lastTrackingTime = now;
|
|
49511
|
-
const
|
|
49512
|
-
const
|
|
49513
|
-
const
|
|
49514
|
-
const
|
|
49515
|
-
const
|
|
49516
|
-
const
|
|
49517
|
-
const
|
|
49518
|
-
|
|
49519
|
-
|
|
49520
|
-
|
|
49521
|
-
|
|
49522
|
-
|
|
49523
|
-
|
|
49524
|
-
|
|
49566
|
+
const v = this.springVelocity;
|
|
49567
|
+
const [tx, vtx] = springStep(this.matrix.translateX, tgt.translateX, v.translateX, dt);
|
|
49568
|
+
const [ty, vty] = springStep(this.matrix.translateY, tgt.translateY, v.translateY, dt);
|
|
49569
|
+
const [sx, vsx] = springStep(this.matrix.scaleX, tgt.scaleX, v.scaleX, dt);
|
|
49570
|
+
const [sy, vsy] = springStep(this.matrix.scaleY, tgt.scaleY, v.scaleY, dt);
|
|
49571
|
+
const [hx, vhx] = springStep(this.matrix.shearX, tgt.shearX, v.shearX, dt);
|
|
49572
|
+
const [hy, vhy] = springStep(this.matrix.shearY, tgt.shearY, v.shearY, dt);
|
|
49573
|
+
this.matrix.translateX = tx;
|
|
49574
|
+
this.matrix.translateY = ty;
|
|
49575
|
+
this.matrix.scaleX = sx;
|
|
49576
|
+
this.matrix.scaleY = sy;
|
|
49577
|
+
this.matrix.shearX = hx;
|
|
49578
|
+
this.matrix.shearY = hy;
|
|
49579
|
+
this.springVelocity = { translateX: vtx, translateY: vty, scaleX: vsx, scaleY: vsy, shearX: vhx, shearY: vhy };
|
|
49580
|
+
this.subject.publish(this);
|
|
49581
|
+
const settled = Math.abs(tgt.translateX - tx) < SNAP_PX && Math.abs(tgt.translateY - ty) < SNAP_PX && Math.abs(tgt.scaleX - sx) < SNAP_SCALE && Math.abs(vtx) < SNAP_VEL && Math.abs(vty) < SNAP_VEL;
|
|
49582
|
+
if (settled) {
|
|
49583
|
+
this.matrix.translateX = tgt.translateX;
|
|
49584
|
+
this.matrix.translateY = tgt.translateY;
|
|
49585
|
+
this.matrix.scaleX = tgt.scaleX;
|
|
49586
|
+
this.matrix.scaleY = tgt.scaleY;
|
|
49587
|
+
this.matrix.shearX = tgt.shearX;
|
|
49588
|
+
this.matrix.shearY = tgt.shearY;
|
|
49525
49589
|
this.subject.publish(this);
|
|
49590
|
+
this.springVelocity = { translateX: 0, translateY: 0, scaleX: 0, scaleY: 0, shearX: 0, shearY: 0 };
|
|
49526
49591
|
this.trackingTarget = null;
|
|
49527
49592
|
this.trackingAnimationId = null;
|
|
49528
49593
|
this.isTrackingAnimation = false;
|
|
49529
49594
|
return;
|
|
49530
49595
|
}
|
|
49531
|
-
this.matrix.translateX += dTx * factor;
|
|
49532
|
-
this.matrix.translateY += dTy * factor;
|
|
49533
|
-
this.matrix.scaleX += dSx * factor;
|
|
49534
|
-
this.matrix.scaleY += dSy * factor;
|
|
49535
|
-
this.matrix.shearX += dHx * factor;
|
|
49536
|
-
this.matrix.shearY += dHy * factor;
|
|
49537
|
-
this.subject.publish(this);
|
|
49538
49596
|
this.trackingAnimationId = safeRequestAnimationFrame(loop) || null;
|
|
49539
49597
|
};
|
|
49540
49598
|
this.trackingAnimationId = safeRequestAnimationFrame(loop) || null;
|
|
@@ -49546,6 +49604,7 @@ class Camera {
|
|
|
49546
49604
|
}
|
|
49547
49605
|
this.trackingTarget = null;
|
|
49548
49606
|
this.lastTrackingTime = null;
|
|
49607
|
+
this.springVelocity = { translateX: 0, translateY: 0, scaleX: 0, scaleY: 0, shearX: 0, shearY: 0 };
|
|
49549
49608
|
this.isTrackingAnimation = false;
|
|
49550
49609
|
}
|
|
49551
49610
|
useSavedSnapshot(optionalMatrix) {
|
|
@@ -51811,26 +51870,23 @@ function getRichTextTranslation({
|
|
|
51811
51870
|
item.editor.setMaxWidth(item.getWidth() / item.transformation.getScale().x * matrix.scaleX);
|
|
51812
51871
|
return {
|
|
51813
51872
|
class: "Transformation",
|
|
51814
|
-
method: "
|
|
51873
|
+
method: "applyMatrix",
|
|
51815
51874
|
item: [item.getId()],
|
|
51816
|
-
|
|
51817
|
-
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
51875
|
+
matrix: { translateX: matrix.translateX, translateY: 0, scaleX: matrix.scaleX, scaleY: matrix.scaleX, shearX: 0, shearY: 0 }
|
|
51818
51876
|
};
|
|
51819
51877
|
} else if (isHeight) {
|
|
51820
51878
|
return {
|
|
51821
51879
|
class: "Transformation",
|
|
51822
|
-
method: "
|
|
51880
|
+
method: "applyMatrix",
|
|
51823
51881
|
item: [item.getId()],
|
|
51824
|
-
|
|
51825
|
-
scale: { x: 1, y: 1 }
|
|
51882
|
+
matrix: { translateX, translateY, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
|
|
51826
51883
|
};
|
|
51827
51884
|
} else {
|
|
51828
51885
|
return {
|
|
51829
51886
|
class: "Transformation",
|
|
51830
|
-
method: "
|
|
51887
|
+
method: "applyMatrix",
|
|
51831
51888
|
item: [item.getId()],
|
|
51832
|
-
|
|
51833
|
-
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
51889
|
+
matrix: { translateX, translateY, scaleX: matrix.scaleX, scaleY: matrix.scaleX, shearX: 0, shearY: 0 }
|
|
51834
51890
|
};
|
|
51835
51891
|
}
|
|
51836
51892
|
}
|
|
@@ -51846,26 +51902,23 @@ function getAINodeTranslation({
|
|
|
51846
51902
|
item.text.editor.setMaxWidth(item.text.getWidth() / item.transformation.getScale().x * matrix.scaleX);
|
|
51847
51903
|
return {
|
|
51848
51904
|
class: "Transformation",
|
|
51849
|
-
method: "
|
|
51905
|
+
method: "applyMatrix",
|
|
51850
51906
|
item: [item.getId()],
|
|
51851
|
-
|
|
51852
|
-
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
51907
|
+
matrix: { translateX: matrix.translateX, translateY: 0, scaleX: matrix.scaleX, scaleY: matrix.scaleX, shearX: 0, shearY: 0 }
|
|
51853
51908
|
};
|
|
51854
51909
|
} else if (isHeight) {
|
|
51855
51910
|
return {
|
|
51856
51911
|
class: "Transformation",
|
|
51857
|
-
method: "
|
|
51912
|
+
method: "applyMatrix",
|
|
51858
51913
|
item: [item.getId()],
|
|
51859
|
-
|
|
51860
|
-
scale: { x: 1, y: 1 }
|
|
51914
|
+
matrix: { translateX, translateY, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
|
|
51861
51915
|
};
|
|
51862
51916
|
} else {
|
|
51863
51917
|
return {
|
|
51864
51918
|
class: "Transformation",
|
|
51865
|
-
method: "
|
|
51919
|
+
method: "applyMatrix",
|
|
51866
51920
|
item: [item.getId()],
|
|
51867
|
-
|
|
51868
|
-
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
51921
|
+
matrix: { translateX, translateY, scaleX: matrix.scaleX, scaleY: matrix.scaleX, shearX: 0, shearY: 0 }
|
|
51869
51922
|
};
|
|
51870
51923
|
}
|
|
51871
51924
|
}
|
|
@@ -51881,10 +51934,9 @@ function getItemTranslation({
|
|
|
51881
51934
|
if (item instanceof Sticker && (isWidth || isHeight)) {
|
|
51882
51935
|
return {
|
|
51883
51936
|
class: "Transformation",
|
|
51884
|
-
method: "
|
|
51937
|
+
method: "applyMatrix",
|
|
51885
51938
|
item: [item.getId()],
|
|
51886
|
-
|
|
51887
|
-
scale: { x: 1, y: 1 }
|
|
51939
|
+
matrix: { translateX, translateY, scaleX: 1, scaleY: 1, shearX: 0, shearY: 0 }
|
|
51888
51940
|
};
|
|
51889
51941
|
} else {
|
|
51890
51942
|
if (item instanceof Frame2 && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
|
|
@@ -51892,10 +51944,9 @@ function getItemTranslation({
|
|
|
51892
51944
|
}
|
|
51893
51945
|
return {
|
|
51894
51946
|
class: "Transformation",
|
|
51895
|
-
method: "
|
|
51947
|
+
method: "applyMatrix",
|
|
51896
51948
|
item: [item.getId()],
|
|
51897
|
-
|
|
51898
|
-
scale: { x: matrix.scaleX, y: matrix.scaleY }
|
|
51949
|
+
matrix: { translateX, translateY, scaleX: matrix.scaleX, scaleY: matrix.scaleY, shearX: 0, shearY: 0 }
|
|
51899
51950
|
};
|
|
51900
51951
|
}
|
|
51901
51952
|
}
|
|
@@ -54860,6 +54911,24 @@ function mergeTransformationOperations(opA, opB) {
|
|
|
54860
54911
|
}
|
|
54861
54912
|
const method = opA.method;
|
|
54862
54913
|
switch (method) {
|
|
54914
|
+
case "applyMatrix":
|
|
54915
|
+
if (opB.method !== method) {
|
|
54916
|
+
return;
|
|
54917
|
+
}
|
|
54918
|
+
return {
|
|
54919
|
+
class: "Transformation",
|
|
54920
|
+
method: "applyMatrix",
|
|
54921
|
+
item: opA.item,
|
|
54922
|
+
matrix: {
|
|
54923
|
+
translateX: opA.matrix.translateX + opB.matrix.translateX,
|
|
54924
|
+
translateY: opA.matrix.translateY + opB.matrix.translateY,
|
|
54925
|
+
scaleX: opA.matrix.scaleX * opB.matrix.scaleX,
|
|
54926
|
+
scaleY: opA.matrix.scaleY * opB.matrix.scaleY,
|
|
54927
|
+
shearX: 0,
|
|
54928
|
+
shearY: 0
|
|
54929
|
+
},
|
|
54930
|
+
timeStamp: opB.timeStamp
|
|
54931
|
+
};
|
|
54863
54932
|
case "translateBy":
|
|
54864
54933
|
if (opB.method !== method) {
|
|
54865
54934
|
return;
|
|
@@ -54971,7 +55040,23 @@ function mergeItems(opA, opB) {
|
|
|
54971
55040
|
const items = {};
|
|
54972
55041
|
Object.keys(opB.items).forEach((itemId) => {
|
|
54973
55042
|
if (opA.items[itemId] !== undefined) {
|
|
54974
|
-
if (opA.items[itemId].method === "
|
|
55043
|
+
if (opA.items[itemId].method === "applyMatrix" && opB.items[itemId].method === "applyMatrix") {
|
|
55044
|
+
const a2 = opA.items[itemId].matrix;
|
|
55045
|
+
const b = opB.items[itemId].matrix;
|
|
55046
|
+
items[itemId] = {
|
|
55047
|
+
class: "Transformation",
|
|
55048
|
+
method: "applyMatrix",
|
|
55049
|
+
item: [itemId],
|
|
55050
|
+
matrix: {
|
|
55051
|
+
translateX: a2.translateX + b.translateX,
|
|
55052
|
+
translateY: a2.translateY + b.translateY,
|
|
55053
|
+
scaleX: a2.scaleX * b.scaleX,
|
|
55054
|
+
scaleY: a2.scaleY * b.scaleY,
|
|
55055
|
+
shearX: 0,
|
|
55056
|
+
shearY: 0
|
|
55057
|
+
}
|
|
55058
|
+
};
|
|
55059
|
+
} else if (opA.items[itemId].method === "scaleByTranslateBy") {
|
|
54975
55060
|
const newTransformation = resolve2(opA.items[itemId].scale, opA.items[itemId].translate, opB.items[itemId]);
|
|
54976
55061
|
items[itemId] = {
|
|
54977
55062
|
class: "Transformation",
|