microboard-temp 0.6.1 → 0.6.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/cjs/browser.js +296 -385
- package/dist/cjs/index.js +296 -385
- package/dist/cjs/node.js +296 -385
- package/dist/esm/browser.js +296 -385
- package/dist/esm/index.js +296 -385
- package/dist/esm/node.js +296 -385
- package/dist/types/Items/Transformation/Transformation.d.ts +42 -31
- package/dist/types/Items/Transformation/TransformationOperations.d.ts +4 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -7367,13 +7367,6 @@ class TransformationCommand {
|
|
|
7367
7367
|
};
|
|
7368
7368
|
});
|
|
7369
7369
|
}
|
|
7370
|
-
case "rotateTo":
|
|
7371
|
-
return mapItemsByOperation(this.transformation, (transformation) => {
|
|
7372
|
-
return {
|
|
7373
|
-
...this.operation,
|
|
7374
|
-
degree: transformation.getRotation()
|
|
7375
|
-
};
|
|
7376
|
-
});
|
|
7377
7370
|
case "scaleByTranslateBy": {
|
|
7378
7371
|
const op2 = this.operation;
|
|
7379
7372
|
const scaleTransformation = mapItemsByOperation(this.transformation, () => {
|
|
@@ -7395,6 +7388,13 @@ class TransformationCommand {
|
|
|
7395
7388
|
});
|
|
7396
7389
|
return scaleTransformation;
|
|
7397
7390
|
}
|
|
7391
|
+
case "rotateTo":
|
|
7392
|
+
return mapItemsByOperation(this.transformation, (transformation) => {
|
|
7393
|
+
return {
|
|
7394
|
+
...this.operation,
|
|
7395
|
+
degree: transformation.getRotation()
|
|
7396
|
+
};
|
|
7397
|
+
});
|
|
7398
7398
|
case "rotateBy": {
|
|
7399
7399
|
const op2 = this.operation;
|
|
7400
7400
|
return mapItemsByOperation(this.transformation, () => {
|
|
@@ -7484,7 +7484,7 @@ class Transformation {
|
|
|
7484
7484
|
id;
|
|
7485
7485
|
events;
|
|
7486
7486
|
subject = new SubjectOperation;
|
|
7487
|
-
|
|
7487
|
+
_matrix = new Matrix2;
|
|
7488
7488
|
previous = new Matrix2;
|
|
7489
7489
|
rotate = defaultData.rotate;
|
|
7490
7490
|
isLocked = false;
|
|
@@ -7492,29 +7492,73 @@ class Transformation {
|
|
|
7492
7492
|
this.id = id;
|
|
7493
7493
|
this.events = events;
|
|
7494
7494
|
}
|
|
7495
|
+
getMatrixData() {
|
|
7496
|
+
const { translateX, translateY, scaleX, scaleY, shearX, shearY } = this._matrix;
|
|
7497
|
+
return { translateX, translateY, scaleX, scaleY, shearX, shearY };
|
|
7498
|
+
}
|
|
7499
|
+
toMatrix() {
|
|
7500
|
+
return this._matrix.copy();
|
|
7501
|
+
}
|
|
7502
|
+
applyToContext(ctx) {
|
|
7503
|
+
this._matrix.applyToContext(ctx);
|
|
7504
|
+
}
|
|
7505
|
+
getTranslation() {
|
|
7506
|
+
return { x: this._matrix.translateX, y: this._matrix.translateY };
|
|
7507
|
+
}
|
|
7508
|
+
getScale() {
|
|
7509
|
+
return { x: this._matrix.scaleX, y: this._matrix.scaleY };
|
|
7510
|
+
}
|
|
7511
|
+
getRotation() {
|
|
7512
|
+
return this.rotate;
|
|
7513
|
+
}
|
|
7514
|
+
setLocal(xOrData, y, scaleX, scaleY) {
|
|
7515
|
+
this.previous = this._matrix.copy();
|
|
7516
|
+
if (typeof xOrData === "object") {
|
|
7517
|
+
if (xOrData.translateX !== undefined)
|
|
7518
|
+
this._matrix.translateX = xOrData.translateX;
|
|
7519
|
+
if (xOrData.translateY !== undefined)
|
|
7520
|
+
this._matrix.translateY = xOrData.translateY;
|
|
7521
|
+
if (xOrData.scaleX !== undefined)
|
|
7522
|
+
this._matrix.scaleX = xOrData.scaleX;
|
|
7523
|
+
if (xOrData.scaleY !== undefined)
|
|
7524
|
+
this._matrix.scaleY = xOrData.scaleY;
|
|
7525
|
+
} else {
|
|
7526
|
+
this._matrix.translateX = xOrData;
|
|
7527
|
+
this._matrix.translateY = y;
|
|
7528
|
+
if (scaleX !== undefined)
|
|
7529
|
+
this._matrix.scaleX = scaleX;
|
|
7530
|
+
if (scaleY !== undefined)
|
|
7531
|
+
this._matrix.scaleY = scaleY;
|
|
7532
|
+
}
|
|
7533
|
+
this.subject.publish(this, {
|
|
7534
|
+
class: "Transformation",
|
|
7535
|
+
method: "applyMatrix",
|
|
7536
|
+
items: [{ id: this.id, matrix: this.getMatrixData() }]
|
|
7537
|
+
});
|
|
7538
|
+
}
|
|
7495
7539
|
serialize() {
|
|
7496
7540
|
return {
|
|
7497
|
-
translateX: this.
|
|
7498
|
-
translateY: this.
|
|
7499
|
-
scaleX: this.
|
|
7500
|
-
scaleY: this.
|
|
7541
|
+
translateX: this._matrix.translateX,
|
|
7542
|
+
translateY: this._matrix.translateY,
|
|
7543
|
+
scaleX: this._matrix.scaleX,
|
|
7544
|
+
scaleY: this._matrix.scaleY,
|
|
7501
7545
|
rotate: this.rotate,
|
|
7502
7546
|
isLocked: this.isLocked
|
|
7503
7547
|
};
|
|
7504
7548
|
}
|
|
7505
7549
|
deserialize(data) {
|
|
7506
|
-
this.previous = this.
|
|
7550
|
+
this.previous = this._matrix.copy();
|
|
7507
7551
|
if (data.translateX) {
|
|
7508
|
-
this.
|
|
7552
|
+
this._matrix.translateX = data.translateX;
|
|
7509
7553
|
}
|
|
7510
7554
|
if (data.translateY) {
|
|
7511
|
-
this.
|
|
7555
|
+
this._matrix.translateY = data.translateY;
|
|
7512
7556
|
}
|
|
7513
7557
|
if (data.scaleX) {
|
|
7514
|
-
this.
|
|
7558
|
+
this._matrix.scaleX = data.scaleX;
|
|
7515
7559
|
}
|
|
7516
7560
|
if (data.scaleY) {
|
|
7517
|
-
this.
|
|
7561
|
+
this._matrix.scaleY = data.scaleY;
|
|
7518
7562
|
}
|
|
7519
7563
|
if (data.isLocked) {
|
|
7520
7564
|
this.isLocked = data.isLocked;
|
|
@@ -7531,7 +7575,7 @@ class Transformation {
|
|
|
7531
7575
|
return this;
|
|
7532
7576
|
}
|
|
7533
7577
|
copy(id) {
|
|
7534
|
-
const { translateX, translateY, scaleX, scaleY } = this.
|
|
7578
|
+
const { translateX, translateY, scaleX, scaleY } = this._matrix;
|
|
7535
7579
|
const { rotate } = this;
|
|
7536
7580
|
return new Transformation(id || "", this.events).deserialize({
|
|
7537
7581
|
translateX,
|
|
@@ -7542,6 +7586,17 @@ class Transformation {
|
|
|
7542
7586
|
isLocked: false
|
|
7543
7587
|
});
|
|
7544
7588
|
}
|
|
7589
|
+
getInverse() {
|
|
7590
|
+
const copy2 = this.copy();
|
|
7591
|
+
copy2._matrix.invert();
|
|
7592
|
+
return copy2;
|
|
7593
|
+
}
|
|
7594
|
+
getId() {
|
|
7595
|
+
return this.id;
|
|
7596
|
+
}
|
|
7597
|
+
setId(id) {
|
|
7598
|
+
this.id = id;
|
|
7599
|
+
}
|
|
7545
7600
|
emit(operation) {
|
|
7546
7601
|
if (this.events) {
|
|
7547
7602
|
const command = new TransformationCommand([this], operation);
|
|
@@ -7551,150 +7606,6 @@ class Transformation {
|
|
|
7551
7606
|
this.apply(operation);
|
|
7552
7607
|
}
|
|
7553
7608
|
}
|
|
7554
|
-
setId(id) {
|
|
7555
|
-
this.id = id;
|
|
7556
|
-
}
|
|
7557
|
-
apply(op) {
|
|
7558
|
-
this.previous = this.matrix.copy();
|
|
7559
|
-
switch (op.method) {
|
|
7560
|
-
case "applyMatrix": {
|
|
7561
|
-
const itemOp = op.items.find((i) => i.id === this.id);
|
|
7562
|
-
if (itemOp) {
|
|
7563
|
-
this.matrix.scale(itemOp.matrix.scaleX, itemOp.matrix.scaleY);
|
|
7564
|
-
this.matrix.translate(itemOp.matrix.translateX, itemOp.matrix.translateY);
|
|
7565
|
-
}
|
|
7566
|
-
break;
|
|
7567
|
-
}
|
|
7568
|
-
case "translateTo":
|
|
7569
|
-
this.applyTranslateTo(op.x, op.y);
|
|
7570
|
-
break;
|
|
7571
|
-
case "translateBy":
|
|
7572
|
-
this.applyTranslateBy(op.x, op.y);
|
|
7573
|
-
break;
|
|
7574
|
-
case "scaleTo":
|
|
7575
|
-
this.applyScaleTo(op.x, op.y);
|
|
7576
|
-
break;
|
|
7577
|
-
case "scaleBy":
|
|
7578
|
-
this.applyScaleBy(op.x, op.y);
|
|
7579
|
-
break;
|
|
7580
|
-
case "scaleToRelativeTo":
|
|
7581
|
-
this.applyScaleToRelativeTo(op.x, op.y, op.point);
|
|
7582
|
-
break;
|
|
7583
|
-
case "scaleByRelativeTo":
|
|
7584
|
-
this.applyScaleByRelativeTo(op.x, op.y, op.point);
|
|
7585
|
-
break;
|
|
7586
|
-
case "rotateTo":
|
|
7587
|
-
this.applyRotateTo(op.degree);
|
|
7588
|
-
break;
|
|
7589
|
-
case "rotateBy":
|
|
7590
|
-
this.applyRotateBy(op.degree);
|
|
7591
|
-
break;
|
|
7592
|
-
case "scaleByTranslateBy":
|
|
7593
|
-
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7594
|
-
break;
|
|
7595
|
-
case "transformMany":
|
|
7596
|
-
this.applyTransformMany(op.items[this.id]);
|
|
7597
|
-
break;
|
|
7598
|
-
case "locked":
|
|
7599
|
-
this.applyLocked(op.locked);
|
|
7600
|
-
break;
|
|
7601
|
-
case "unlocked":
|
|
7602
|
-
this.applyUnlocked(op.locked);
|
|
7603
|
-
break;
|
|
7604
|
-
default:
|
|
7605
|
-
return;
|
|
7606
|
-
}
|
|
7607
|
-
this.subject.publish(this, op);
|
|
7608
|
-
}
|
|
7609
|
-
applyTranslateTo(x, y) {
|
|
7610
|
-
this.matrix.translateX = x;
|
|
7611
|
-
this.matrix.translateY = y;
|
|
7612
|
-
}
|
|
7613
|
-
applyTranslateBy(x, y) {
|
|
7614
|
-
this.matrix.translate(x, y);
|
|
7615
|
-
}
|
|
7616
|
-
applyScaleTo(x, y) {
|
|
7617
|
-
this.matrix.scaleX = x;
|
|
7618
|
-
this.matrix.scaleY = y;
|
|
7619
|
-
}
|
|
7620
|
-
applyScaleBy(x, y) {
|
|
7621
|
-
this.matrix.scale(x, y);
|
|
7622
|
-
}
|
|
7623
|
-
applyScaleByTranslateBy(scale, translate) {
|
|
7624
|
-
this.matrix.scale(scale.x, scale.y);
|
|
7625
|
-
this.matrix.translate(translate.x, translate.y);
|
|
7626
|
-
}
|
|
7627
|
-
applyTransformMany(op) {
|
|
7628
|
-
if (op.method === "applyMatrix") {
|
|
7629
|
-
this.matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7630
|
-
this.matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7631
|
-
} else if (op.method === "scaleByTranslateBy") {
|
|
7632
|
-
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7633
|
-
} else if (op.method === "scaleBy") {
|
|
7634
|
-
this.applyScaleBy(op.x, op.y);
|
|
7635
|
-
} else if (op.method === "translateBy") {
|
|
7636
|
-
this.applyTranslateBy(op.x, op.y);
|
|
7637
|
-
} else if (op.method === "translateTo") {
|
|
7638
|
-
this.applyTranslateTo(op.x, op.y);
|
|
7639
|
-
}
|
|
7640
|
-
}
|
|
7641
|
-
applyScaleByRelativeTo(x, y, point) {
|
|
7642
|
-
const scaleX = this.matrix.scaleX * x;
|
|
7643
|
-
const scaleY = this.matrix.scaleY * y;
|
|
7644
|
-
this.matrix.translateX = -point.x * scaleX + point.x;
|
|
7645
|
-
this.matrix.translateY = -point.y * scaleY + point.y;
|
|
7646
|
-
this.matrix.scaleX = scaleX;
|
|
7647
|
-
this.matrix.scaleY = scaleY;
|
|
7648
|
-
}
|
|
7649
|
-
applyScaleToRelativeTo(x, y, point) {
|
|
7650
|
-
this.applyTranslateBy(-point.x, -point.y);
|
|
7651
|
-
this.applyScaleTo(x, y);
|
|
7652
|
-
this.applyTranslateBy(point.x, point.y);
|
|
7653
|
-
}
|
|
7654
|
-
applyRotateTo(degree) {
|
|
7655
|
-
if (degree > 0) {
|
|
7656
|
-
while (degree > 360) {
|
|
7657
|
-
degree -= 360;
|
|
7658
|
-
}
|
|
7659
|
-
if (degree === 360) {
|
|
7660
|
-
degree = 0;
|
|
7661
|
-
}
|
|
7662
|
-
} else {
|
|
7663
|
-
while (degree < -360) {
|
|
7664
|
-
degree += 360;
|
|
7665
|
-
}
|
|
7666
|
-
if (degree === -360) {
|
|
7667
|
-
degree = 0;
|
|
7668
|
-
}
|
|
7669
|
-
}
|
|
7670
|
-
this.rotate = degree;
|
|
7671
|
-
}
|
|
7672
|
-
applyRotateBy(degree) {
|
|
7673
|
-
this.applyRotateTo(this.rotate + degree);
|
|
7674
|
-
}
|
|
7675
|
-
applyLocked(locked) {
|
|
7676
|
-
this.isLocked = locked;
|
|
7677
|
-
}
|
|
7678
|
-
applyUnlocked(locked) {
|
|
7679
|
-
this.isLocked = locked;
|
|
7680
|
-
}
|
|
7681
|
-
getTranslation() {
|
|
7682
|
-
return { x: this.matrix.translateX, y: this.matrix.translateY };
|
|
7683
|
-
}
|
|
7684
|
-
getScale() {
|
|
7685
|
-
return { x: this.matrix.scaleX, y: this.matrix.scaleY };
|
|
7686
|
-
}
|
|
7687
|
-
getRotation() {
|
|
7688
|
-
return this.rotate;
|
|
7689
|
-
}
|
|
7690
|
-
getInverse() {
|
|
7691
|
-
const copy2 = this.copy();
|
|
7692
|
-
copy2.matrix.invert();
|
|
7693
|
-
return copy2;
|
|
7694
|
-
}
|
|
7695
|
-
getId() {
|
|
7696
|
-
return this.id;
|
|
7697
|
-
}
|
|
7698
7609
|
emitMatrix(matrix, timeStamp) {
|
|
7699
7610
|
this.emit({
|
|
7700
7611
|
class: "Transformation",
|
|
@@ -7706,8 +7617,8 @@ class Transformation {
|
|
|
7706
7617
|
translateTo(x, y, timeStamp) {
|
|
7707
7618
|
if (!this.id) {}
|
|
7708
7619
|
this.emitMatrix({
|
|
7709
|
-
translateX: x - this.
|
|
7710
|
-
translateY: y - this.
|
|
7620
|
+
translateX: x - this._matrix.translateX,
|
|
7621
|
+
translateY: y - this._matrix.translateY,
|
|
7711
7622
|
scaleX: 1,
|
|
7712
7623
|
scaleY: 1,
|
|
7713
7624
|
shearX: 0,
|
|
@@ -7732,8 +7643,8 @@ class Transformation {
|
|
|
7732
7643
|
this.emitMatrix({
|
|
7733
7644
|
translateX: 0,
|
|
7734
7645
|
translateY: 0,
|
|
7735
|
-
scaleX: x / this.
|
|
7736
|
-
scaleY: y / this.
|
|
7646
|
+
scaleX: x / this._matrix.scaleX,
|
|
7647
|
+
scaleY: y / this._matrix.scaleY,
|
|
7737
7648
|
shearX: 0,
|
|
7738
7649
|
shearY: 0
|
|
7739
7650
|
}, timeStamp);
|
|
@@ -7786,14 +7697,14 @@ class Transformation {
|
|
|
7786
7697
|
this.emitMatrix({
|
|
7787
7698
|
translateX: 0,
|
|
7788
7699
|
translateY: 0,
|
|
7789
|
-
scaleX: x / this.
|
|
7790
|
-
scaleY: y / this.
|
|
7700
|
+
scaleX: x / this._matrix.scaleX,
|
|
7701
|
+
scaleY: y / this._matrix.scaleY,
|
|
7791
7702
|
shearX: 0,
|
|
7792
7703
|
shearY: 0
|
|
7793
7704
|
}, timeStamp);
|
|
7794
7705
|
}
|
|
7795
7706
|
scaleByRelativeTo(x, y, point, timeStamp) {
|
|
7796
|
-
const { scaleX: sx0, scaleY: sy0, translateX: tx0, translateY: ty0 } = this.
|
|
7707
|
+
const { scaleX: sx0, scaleY: sy0, translateX: tx0, translateY: ty0 } = this._matrix;
|
|
7797
7708
|
const newSx = sx0 * x;
|
|
7798
7709
|
const newSy = sy0 * y;
|
|
7799
7710
|
this.emitMatrix({
|
|
@@ -7824,6 +7735,130 @@ class Transformation {
|
|
|
7824
7735
|
});
|
|
7825
7736
|
}
|
|
7826
7737
|
}
|
|
7738
|
+
apply(op) {
|
|
7739
|
+
this.previous = this._matrix.copy();
|
|
7740
|
+
switch (op.method) {
|
|
7741
|
+
case "applyMatrix": {
|
|
7742
|
+
const itemOp = op.items.find((i) => i.id === this.id);
|
|
7743
|
+
if (itemOp) {
|
|
7744
|
+
this._matrix.scale(itemOp.matrix.scaleX, itemOp.matrix.scaleY);
|
|
7745
|
+
this._matrix.translate(itemOp.matrix.translateX, itemOp.matrix.translateY);
|
|
7746
|
+
}
|
|
7747
|
+
break;
|
|
7748
|
+
}
|
|
7749
|
+
case "translateTo":
|
|
7750
|
+
this.applyTranslateTo(op.x, op.y);
|
|
7751
|
+
break;
|
|
7752
|
+
case "translateBy":
|
|
7753
|
+
this.applyTranslateBy(op.x, op.y);
|
|
7754
|
+
break;
|
|
7755
|
+
case "scaleTo":
|
|
7756
|
+
this.applyScaleTo(op.x, op.y);
|
|
7757
|
+
break;
|
|
7758
|
+
case "scaleBy":
|
|
7759
|
+
this.applyScaleBy(op.x, op.y);
|
|
7760
|
+
break;
|
|
7761
|
+
case "scaleToRelativeTo":
|
|
7762
|
+
this.applyScaleToRelativeTo(op.x, op.y, op.point);
|
|
7763
|
+
break;
|
|
7764
|
+
case "scaleByRelativeTo":
|
|
7765
|
+
this.applyScaleByRelativeTo(op.x, op.y, op.point);
|
|
7766
|
+
break;
|
|
7767
|
+
case "scaleByTranslateBy":
|
|
7768
|
+
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7769
|
+
break;
|
|
7770
|
+
case "rotateTo":
|
|
7771
|
+
this.applyRotateTo(op.degree);
|
|
7772
|
+
break;
|
|
7773
|
+
case "rotateBy":
|
|
7774
|
+
this.applyRotateBy(op.degree);
|
|
7775
|
+
break;
|
|
7776
|
+
case "transformMany":
|
|
7777
|
+
this.applyTransformMany(op.items[this.id]);
|
|
7778
|
+
break;
|
|
7779
|
+
case "locked":
|
|
7780
|
+
this.applyLocked(op.locked);
|
|
7781
|
+
break;
|
|
7782
|
+
case "unlocked":
|
|
7783
|
+
this.applyUnlocked(op.locked);
|
|
7784
|
+
break;
|
|
7785
|
+
default:
|
|
7786
|
+
return;
|
|
7787
|
+
}
|
|
7788
|
+
this.subject.publish(this, op);
|
|
7789
|
+
}
|
|
7790
|
+
applyTranslateTo(x, y) {
|
|
7791
|
+
this._matrix.translateX = x;
|
|
7792
|
+
this._matrix.translateY = y;
|
|
7793
|
+
}
|
|
7794
|
+
applyTranslateBy(x, y) {
|
|
7795
|
+
this._matrix.translate(x, y);
|
|
7796
|
+
}
|
|
7797
|
+
applyScaleTo(x, y) {
|
|
7798
|
+
this._matrix.scaleX = x;
|
|
7799
|
+
this._matrix.scaleY = y;
|
|
7800
|
+
}
|
|
7801
|
+
applyScaleBy(x, y) {
|
|
7802
|
+
this._matrix.scale(x, y);
|
|
7803
|
+
}
|
|
7804
|
+
applyScaleByTranslateBy(scale, translate) {
|
|
7805
|
+
this._matrix.scale(scale.x, scale.y);
|
|
7806
|
+
this._matrix.translate(translate.x, translate.y);
|
|
7807
|
+
}
|
|
7808
|
+
applyTransformMany(op) {
|
|
7809
|
+
if (op.method === "applyMatrix") {
|
|
7810
|
+
this._matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7811
|
+
this._matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7812
|
+
} else if (op.method === "scaleByTranslateBy") {
|
|
7813
|
+
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7814
|
+
} else if (op.method === "scaleBy") {
|
|
7815
|
+
this.applyScaleBy(op.x, op.y);
|
|
7816
|
+
} else if (op.method === "translateBy") {
|
|
7817
|
+
this.applyTranslateBy(op.x, op.y);
|
|
7818
|
+
} else if (op.method === "translateTo") {
|
|
7819
|
+
this.applyTranslateTo(op.x, op.y);
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
applyScaleByRelativeTo(x, y, point) {
|
|
7823
|
+
const scaleX = this._matrix.scaleX * x;
|
|
7824
|
+
const scaleY = this._matrix.scaleY * y;
|
|
7825
|
+
this._matrix.translateX = -point.x * scaleX + point.x;
|
|
7826
|
+
this._matrix.translateY = -point.y * scaleY + point.y;
|
|
7827
|
+
this._matrix.scaleX = scaleX;
|
|
7828
|
+
this._matrix.scaleY = scaleY;
|
|
7829
|
+
}
|
|
7830
|
+
applyScaleToRelativeTo(x, y, point) {
|
|
7831
|
+
this.applyTranslateBy(-point.x, -point.y);
|
|
7832
|
+
this.applyScaleTo(x, y);
|
|
7833
|
+
this.applyTranslateBy(point.x, point.y);
|
|
7834
|
+
}
|
|
7835
|
+
applyRotateTo(degree) {
|
|
7836
|
+
if (degree > 0) {
|
|
7837
|
+
while (degree > 360) {
|
|
7838
|
+
degree -= 360;
|
|
7839
|
+
}
|
|
7840
|
+
if (degree === 360) {
|
|
7841
|
+
degree = 0;
|
|
7842
|
+
}
|
|
7843
|
+
} else {
|
|
7844
|
+
while (degree < -360) {
|
|
7845
|
+
degree += 360;
|
|
7846
|
+
}
|
|
7847
|
+
if (degree === -360) {
|
|
7848
|
+
degree = 0;
|
|
7849
|
+
}
|
|
7850
|
+
}
|
|
7851
|
+
this.rotate = degree;
|
|
7852
|
+
}
|
|
7853
|
+
applyRotateBy(degree) {
|
|
7854
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7855
|
+
}
|
|
7856
|
+
applyLocked(locked) {
|
|
7857
|
+
this.isLocked = locked;
|
|
7858
|
+
}
|
|
7859
|
+
applyUnlocked(locked) {
|
|
7860
|
+
this.isLocked = locked;
|
|
7861
|
+
}
|
|
7827
7862
|
}
|
|
7828
7863
|
// src/Items/DrawingContext.ts
|
|
7829
7864
|
class DrawingContext {
|
|
@@ -19252,12 +19287,11 @@ class Comment {
|
|
|
19252
19287
|
});
|
|
19253
19288
|
}
|
|
19254
19289
|
transform() {
|
|
19255
|
-
const
|
|
19256
|
-
if (
|
|
19257
|
-
this.anchor = new Point(
|
|
19290
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
19291
|
+
if (translateX && translateY) {
|
|
19292
|
+
this.anchor = new Point(translateX, translateY);
|
|
19258
19293
|
} else {
|
|
19259
|
-
|
|
19260
|
-
matrix.translateY = this.anchor.y;
|
|
19294
|
+
this.transformation.setLocal(this.anchor.x, this.anchor.y);
|
|
19261
19295
|
}
|
|
19262
19296
|
}
|
|
19263
19297
|
getUnreadMessages(userId = ANONYMOUS_ID) {
|
|
@@ -19366,7 +19400,7 @@ class Comment {
|
|
|
19366
19400
|
render(context) {}
|
|
19367
19401
|
renderHTML(documentFactory) {
|
|
19368
19402
|
const div = documentFactory.createElement("comment-item");
|
|
19369
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
19403
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
19370
19404
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
19371
19405
|
div.style.transformOrigin = "top left";
|
|
19372
19406
|
div.style.transform = transform;
|
|
@@ -21892,7 +21926,7 @@ class BaseItem extends Mbr {
|
|
|
21892
21926
|
}
|
|
21893
21927
|
renderHTML(documentFactory) {
|
|
21894
21928
|
const div = documentFactory.createElement("base-item");
|
|
21895
|
-
const { translateX, translateY } = this.transformation.
|
|
21929
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
21896
21930
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
21897
21931
|
div.style.backgroundColor = "#b2b0c3";
|
|
21898
21932
|
div.id = this.getId();
|
|
@@ -22034,7 +22068,7 @@ class RichText extends BaseItem {
|
|
|
22034
22068
|
mbr.right += 20;
|
|
22035
22069
|
mbr.bottom += 20;
|
|
22036
22070
|
}
|
|
22037
|
-
const linkMbr = mbr.getTransformed(this.transformation.
|
|
22071
|
+
const linkMbr = mbr.getTransformed(this.transformation.toMatrix());
|
|
22038
22072
|
if (linkMbr.isUnderPoint(point3)) {
|
|
22039
22073
|
return { hyperLink, linkMbr };
|
|
22040
22074
|
}
|
|
@@ -22231,12 +22265,13 @@ class RichText extends BaseItem {
|
|
|
22231
22265
|
return this.shrinkWidth;
|
|
22232
22266
|
}
|
|
22233
22267
|
getTransformedContainer() {
|
|
22234
|
-
let matrix = this.transformation.matrix;
|
|
22235
22268
|
if (this.insideOf === "Frame") {
|
|
22269
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
22236
22270
|
const scaleY = this.getMbr().getHeight() * 2 / 10;
|
|
22237
|
-
matrix = new Matrix2(
|
|
22271
|
+
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
22272
|
+
return this.container.getTransformed(matrix);
|
|
22238
22273
|
}
|
|
22239
|
-
return this.container.getTransformed(
|
|
22274
|
+
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22240
22275
|
}
|
|
22241
22276
|
emitWithoutApplying = (op) => {
|
|
22242
22277
|
if (this.board.events) {
|
|
@@ -22597,7 +22632,7 @@ class RichText extends BaseItem {
|
|
|
22597
22632
|
ctx.translate(this.left, this.top);
|
|
22598
22633
|
const shouldScale = !this.isInShape && !this.autoSize;
|
|
22599
22634
|
if (shouldScale) {
|
|
22600
|
-
const { scaleX, scaleY } = this.transformation.
|
|
22635
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22601
22636
|
ctx.scale(scaleX, scaleY);
|
|
22602
22637
|
}
|
|
22603
22638
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
@@ -22730,7 +22765,7 @@ class RichText extends BaseItem {
|
|
|
22730
22765
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22731
22766
|
};
|
|
22732
22767
|
const elements = this.editor.editor.children.map(renderNode);
|
|
22733
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
22768
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22734
22769
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
22735
22770
|
const transformedWidth = this.getTransformedContainer().getWidth();
|
|
22736
22771
|
const transformedHeight = this.getTransformedContainer().getHeight();
|
|
@@ -35962,17 +35997,17 @@ class AINode extends BaseItem {
|
|
|
35962
35997
|
}
|
|
35963
35998
|
transformPath() {
|
|
35964
35999
|
const { left, right, top, bottom } = this.text.getTransformedContainer();
|
|
35965
|
-
const { scaleX, scaleY } = this.transformation.
|
|
36000
|
+
const { scaleX, scaleY, translateX: nodeTranslateX, translateY: nodeTranslateY } = this.transformation.getMatrixData();
|
|
35966
36001
|
const minScale = Math.min(scaleX, scaleY);
|
|
35967
36002
|
const leftOffset = 20 * minScale;
|
|
35968
36003
|
const topOffset = 20 * minScale;
|
|
35969
36004
|
const nodeRight = right + 80 * minScale;
|
|
35970
36005
|
const nodeBottom = bottom + (bottom - top > 400 ? 60 : 40) * minScale;
|
|
35971
36006
|
if (!this.path || this.text.left < this.path.getMbr().left + leftOffset && this.text.top < this.path.getMbr().top + topOffset) {
|
|
35972
|
-
this.text.left =
|
|
35973
|
-
this.text.top =
|
|
36007
|
+
this.text.left = nodeTranslateX + leftOffset;
|
|
36008
|
+
this.text.top = nodeTranslateY + topOffset;
|
|
35974
36009
|
}
|
|
35975
|
-
this.path = createNodePath(new Mbr(left, top, nodeRight, nodeBottom), this.transformation.
|
|
36010
|
+
this.path = createNodePath(new Mbr(left, top, nodeRight, nodeBottom), this.transformation.toMatrix());
|
|
35976
36011
|
const scaledSize = BUTTON_SIZE * minScale;
|
|
35977
36012
|
this.buttonMbr = new Mbr(nodeRight - scaledSize * 2, nodeBottom - scaledSize * 2, nodeRight - scaledSize, nodeBottom - scaledSize);
|
|
35978
36013
|
}
|
|
@@ -36133,7 +36168,7 @@ class AINode extends BaseItem {
|
|
|
36133
36168
|
}
|
|
36134
36169
|
renderHTML(documentFactory) {
|
|
36135
36170
|
const div = documentFactory.createElement("ainode-item");
|
|
36136
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
36171
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
36137
36172
|
const mbr = this.getMbr();
|
|
36138
36173
|
const width = mbr.getWidth();
|
|
36139
36174
|
const height = mbr.getHeight();
|
|
@@ -37606,7 +37641,7 @@ class Connector2 extends BaseItem {
|
|
|
37606
37641
|
}
|
|
37607
37642
|
renderHTML(documentFactory) {
|
|
37608
37643
|
const div = documentFactory.createElement("connector-item");
|
|
37609
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
37644
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
37610
37645
|
const mbr = this.getMbr();
|
|
37611
37646
|
const width = mbr.getWidth();
|
|
37612
37647
|
const height = mbr.getHeight();
|
|
@@ -37671,7 +37706,7 @@ class Connector2 extends BaseItem {
|
|
|
37671
37706
|
return div;
|
|
37672
37707
|
}
|
|
37673
37708
|
renderPathHTML(documentFactory, path2) {
|
|
37674
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
37709
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
37675
37710
|
const pathElement = path2.renderHTML(documentFactory);
|
|
37676
37711
|
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
37677
37712
|
paths.forEach((element4) => {
|
|
@@ -37693,8 +37728,7 @@ class Connector2 extends BaseItem {
|
|
|
37693
37728
|
text5.transformation = undefined;
|
|
37694
37729
|
const mbr = this.getMbr();
|
|
37695
37730
|
const transformation = new Transformation;
|
|
37696
|
-
transformation.
|
|
37697
|
-
transformation.matrix.translateY = mbr.top;
|
|
37731
|
+
transformation.setLocal(mbr.left, mbr.top);
|
|
37698
37732
|
return {
|
|
37699
37733
|
itemType: "Connector",
|
|
37700
37734
|
transformation: transformation.serialize(),
|
|
@@ -37774,7 +37808,7 @@ class Connector2 extends BaseItem {
|
|
|
37774
37808
|
previous2.translateX = 0;
|
|
37775
37809
|
previous2.translateY = 0;
|
|
37776
37810
|
previous2.invert();
|
|
37777
|
-
const currUnscaled = this.transformation.
|
|
37811
|
+
const currUnscaled = this.transformation.toMatrix();
|
|
37778
37812
|
currUnscaled.translateX = 0;
|
|
37779
37813
|
currUnscaled.translateY = 0;
|
|
37780
37814
|
const delta = previous2.multiplyByMatrix(currUnscaled);
|
|
@@ -37801,7 +37835,7 @@ class Connector2 extends BaseItem {
|
|
|
37801
37835
|
previous2.scaleX = 1;
|
|
37802
37836
|
previous2.scaleY = 1;
|
|
37803
37837
|
previous2.invert();
|
|
37804
|
-
const currUnscaled = this.transformation.
|
|
37838
|
+
const currUnscaled = this.transformation.toMatrix();
|
|
37805
37839
|
currUnscaled.scaleX = 1;
|
|
37806
37840
|
currUnscaled.scaleY = 1;
|
|
37807
37841
|
const delta = previous2.multiplyByMatrix(currUnscaled);
|
|
@@ -39768,7 +39802,7 @@ class Shape extends BaseItem {
|
|
|
39768
39802
|
}
|
|
39769
39803
|
renderHTML(documentFactory) {
|
|
39770
39804
|
const div = documentFactory.createElement("shape-item");
|
|
39771
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
39805
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
39772
39806
|
const mbr = this.getMbr();
|
|
39773
39807
|
const width = mbr.getWidth();
|
|
39774
39808
|
const height = mbr.getHeight();
|
|
@@ -39857,8 +39891,8 @@ class Shape extends BaseItem {
|
|
|
39857
39891
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
39858
39892
|
this.textContainer = Shapes[this.shapeType].textBounds.copy();
|
|
39859
39893
|
this.text.setContainer(this.textContainer.copy());
|
|
39860
|
-
this.textContainer.transform(this.transformation.
|
|
39861
|
-
this.path.transform(this.transformation.
|
|
39894
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
39895
|
+
this.path.transform(this.transformation.toMatrix());
|
|
39862
39896
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
39863
39897
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
39864
39898
|
this.path.setBorderColor(this.borderColor);
|
|
@@ -39873,7 +39907,7 @@ class Shape extends BaseItem {
|
|
|
39873
39907
|
const anchorPoints = Shapes[this.shapeType].anchorPoints;
|
|
39874
39908
|
const points = [];
|
|
39875
39909
|
for (const anchorPoint of anchorPoints) {
|
|
39876
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
39910
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
39877
39911
|
}
|
|
39878
39912
|
return points;
|
|
39879
39913
|
}
|
|
@@ -40043,10 +40077,9 @@ class Sticker extends BaseItem {
|
|
|
40043
40077
|
}
|
|
40044
40078
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
40045
40079
|
this.textContainer = StickerShape.textBounds.copy();
|
|
40046
|
-
|
|
40047
|
-
this.stickerPath.transform(matrix);
|
|
40080
|
+
this.stickerPath.transform(this.transformation.toMatrix());
|
|
40048
40081
|
this.text.setContainer(this.textContainer.copy());
|
|
40049
|
-
this.textContainer.transform(this.transformation.
|
|
40082
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
40050
40083
|
this.stickerPath.setBackgroundColor(this.backgroundColor);
|
|
40051
40084
|
this.saveStickerData();
|
|
40052
40085
|
}
|
|
@@ -40147,7 +40180,7 @@ class Sticker extends BaseItem {
|
|
|
40147
40180
|
}
|
|
40148
40181
|
renderHTML(documentFactory) {
|
|
40149
40182
|
const div = documentFactory.createElement("sticker-item");
|
|
40150
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
40183
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
40151
40184
|
const transform = `translate(${Math.round(translateX)}px, ${Math.round(translateY)}px) scale(${scaleX}, ${scaleY})`;
|
|
40152
40185
|
const itemMbr = this.getMbr();
|
|
40153
40186
|
const height2 = itemMbr.getHeight();
|
|
@@ -40228,7 +40261,7 @@ class Sticker extends BaseItem {
|
|
|
40228
40261
|
const anchorPoints = StickerShape.anchorPoints;
|
|
40229
40262
|
const points = [];
|
|
40230
40263
|
for (const anchorPoint of anchorPoints) {
|
|
40231
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
40264
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
40232
40265
|
}
|
|
40233
40266
|
return points;
|
|
40234
40267
|
}
|
|
@@ -40242,20 +40275,7 @@ class Sticker extends BaseItem {
|
|
|
40242
40275
|
if (line.end.y < line.start.y) {
|
|
40243
40276
|
y -= l * height;
|
|
40244
40277
|
}
|
|
40245
|
-
this.transformation.
|
|
40246
|
-
class: "Transformation",
|
|
40247
|
-
method: "translateTo",
|
|
40248
|
-
item: [this.id],
|
|
40249
|
-
x,
|
|
40250
|
-
y
|
|
40251
|
-
});
|
|
40252
|
-
this.transformation.apply({
|
|
40253
|
-
class: "Transformation",
|
|
40254
|
-
method: "scaleTo",
|
|
40255
|
-
item: [this.id],
|
|
40256
|
-
x: l,
|
|
40257
|
-
y: l
|
|
40258
|
-
});
|
|
40278
|
+
this.transformation.setLocal(x, y, l, l);
|
|
40259
40279
|
this.saveStickerData();
|
|
40260
40280
|
}
|
|
40261
40281
|
applyTransformToCenter(pt, newWidth) {
|
|
@@ -40263,35 +40283,9 @@ class Sticker extends BaseItem {
|
|
|
40263
40283
|
const scale = newWidth / width;
|
|
40264
40284
|
const w = width * scale;
|
|
40265
40285
|
const h2 = height * scale;
|
|
40266
|
-
this.transformation.
|
|
40267
|
-
class: "Transformation",
|
|
40268
|
-
method: "translateTo",
|
|
40269
|
-
item: [this.id],
|
|
40270
|
-
x: pt.x - w / 2,
|
|
40271
|
-
y: pt.y - h2 / 2
|
|
40272
|
-
});
|
|
40273
|
-
this.transformation.apply({
|
|
40274
|
-
class: "Transformation",
|
|
40275
|
-
method: "scaleTo",
|
|
40276
|
-
item: [this.id],
|
|
40277
|
-
x: scale,
|
|
40278
|
-
y: scale
|
|
40279
|
-
});
|
|
40286
|
+
this.transformation.setLocal(pt.x - w / 2, pt.y - h2 / 2, scale, scale);
|
|
40280
40287
|
} else {
|
|
40281
|
-
this.transformation.
|
|
40282
|
-
class: "Transformation",
|
|
40283
|
-
method: "translateTo",
|
|
40284
|
-
item: [this.id],
|
|
40285
|
-
x: pt.x - width / 2,
|
|
40286
|
-
y: pt.y - height / 2
|
|
40287
|
-
});
|
|
40288
|
-
this.transformation.apply({
|
|
40289
|
-
class: "Transformation",
|
|
40290
|
-
method: "scaleTo",
|
|
40291
|
-
item: [this.id],
|
|
40292
|
-
x: 1,
|
|
40293
|
-
y: 1
|
|
40294
|
-
});
|
|
40288
|
+
this.transformation.setLocal(pt.x - width / 2, pt.y - height / 2, 1, 1);
|
|
40295
40289
|
}
|
|
40296
40290
|
}
|
|
40297
40291
|
doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
|
|
@@ -40597,7 +40591,7 @@ class Frame2 extends BaseItem {
|
|
|
40597
40591
|
const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
|
|
40598
40592
|
if (!res) {
|
|
40599
40593
|
return {
|
|
40600
|
-
matrix: this.transformation.
|
|
40594
|
+
matrix: this.transformation.toMatrix(),
|
|
40601
40595
|
mbr: this.getMbr()
|
|
40602
40596
|
};
|
|
40603
40597
|
}
|
|
@@ -40696,8 +40690,9 @@ class Frame2 extends BaseItem {
|
|
|
40696
40690
|
return this;
|
|
40697
40691
|
}
|
|
40698
40692
|
getSavedProportionsMatrix() {
|
|
40699
|
-
const
|
|
40700
|
-
const
|
|
40693
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
40694
|
+
const newScale = Math.min(scaleX, scaleY);
|
|
40695
|
+
const newMatrix = this.transformation.toMatrix();
|
|
40701
40696
|
newMatrix.scaleX = newScale;
|
|
40702
40697
|
newMatrix.scaleY = newScale;
|
|
40703
40698
|
return newMatrix;
|
|
@@ -40711,8 +40706,8 @@ class Frame2 extends BaseItem {
|
|
|
40711
40706
|
this.textContainer.transform(newMatrix);
|
|
40712
40707
|
this.transformation.applyScaleTo(newMatrix.scaleX, newMatrix.scaleY);
|
|
40713
40708
|
} else {
|
|
40714
|
-
this.path.transform(this.transformation.
|
|
40715
|
-
this.textContainer.transform(this.transformation.
|
|
40709
|
+
this.path.transform(this.transformation.toMatrix());
|
|
40710
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
40716
40711
|
}
|
|
40717
40712
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
40718
40713
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
@@ -40768,7 +40763,7 @@ class Frame2 extends BaseItem {
|
|
|
40768
40763
|
const anchorPoints = Frames[this.shapeType].anchorPoints;
|
|
40769
40764
|
const points = [];
|
|
40770
40765
|
for (const anchorPoint of anchorPoints) {
|
|
40771
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
40766
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
40772
40767
|
}
|
|
40773
40768
|
return points;
|
|
40774
40769
|
}
|
|
@@ -40944,7 +40939,7 @@ class Frame2 extends BaseItem {
|
|
|
40944
40939
|
div.style.borderColor = this.borderColor;
|
|
40945
40940
|
div.style.borderWidth = `${this.borderWidth}px`;
|
|
40946
40941
|
div.style.borderStyle = this.borderStyle;
|
|
40947
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
40942
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
40948
40943
|
const transform = `translate(${Math.round(translateX)}px, ${Math.round(translateY)}px) scale(1, 1)`;
|
|
40949
40944
|
const width2 = this.getMbr().getWidth();
|
|
40950
40945
|
const height2 = this.getMbr().getHeight();
|
|
@@ -41257,13 +41252,13 @@ class VideoItem extends BaseItem {
|
|
|
41257
41252
|
this.shootLoadCallbacks();
|
|
41258
41253
|
};
|
|
41259
41254
|
updateMbr() {
|
|
41260
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41255
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41261
41256
|
this.left = translateX;
|
|
41262
41257
|
this.top = translateY;
|
|
41263
41258
|
this.right = this.left + this.videoDimension.width * scaleX;
|
|
41264
41259
|
this.bottom = this.top + this.videoDimension.height * scaleY;
|
|
41265
41260
|
const playBtnSize = 50;
|
|
41266
|
-
const scaledPlayBtn = playBtnSize * this.transformation.
|
|
41261
|
+
const scaledPlayBtn = playBtnSize * this.transformation.getMatrixData().scaleX;
|
|
41267
41262
|
this.playBtnMbr = new Mbr(this.left + this.getWidth() / 2 - scaledPlayBtn / 2, this.top + this.getHeight() / 2 - scaledPlayBtn / 2, this.right - this.getWidth() / 2 + scaledPlayBtn / 2, this.bottom - this.getHeight() / 2 + scaledPlayBtn / 2);
|
|
41268
41263
|
}
|
|
41269
41264
|
render(context) {
|
|
@@ -41279,7 +41274,7 @@ class VideoItem extends BaseItem {
|
|
|
41279
41274
|
return;
|
|
41280
41275
|
}
|
|
41281
41276
|
ctx.save();
|
|
41282
|
-
this.transformation.
|
|
41277
|
+
this.transformation.applyToContext(ctx);
|
|
41283
41278
|
ctx.drawImage(this.preview, 0, 0);
|
|
41284
41279
|
if (this.shouldShowControls && this.previewUrl) {
|
|
41285
41280
|
ctx.restore();
|
|
@@ -41300,7 +41295,7 @@ class VideoItem extends BaseItem {
|
|
|
41300
41295
|
}
|
|
41301
41296
|
renderHTML(documentFactory) {
|
|
41302
41297
|
const div = documentFactory.createElement("video-item");
|
|
41303
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41298
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41304
41299
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
41305
41300
|
div.style.backgroundImage = this.previewUrl ? `url(${this.previewUrl})` : `url(${createPlaceholderImage(this.videoDimension.width, this.videoDimension.height).src})`;
|
|
41306
41301
|
div.id = this.getId();
|
|
@@ -41758,7 +41753,7 @@ class AudioItem extends BaseItem {
|
|
|
41758
41753
|
this.shootLoadCallbacks();
|
|
41759
41754
|
};
|
|
41760
41755
|
updateMbr() {
|
|
41761
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41756
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41762
41757
|
this.left = translateX;
|
|
41763
41758
|
this.top = translateY;
|
|
41764
41759
|
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
@@ -41788,7 +41783,7 @@ class AudioItem extends BaseItem {
|
|
|
41788
41783
|
}
|
|
41789
41784
|
renderHTML(documentFactory) {
|
|
41790
41785
|
const div = documentFactory.createElement("audio-item");
|
|
41791
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41786
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41792
41787
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
41793
41788
|
div.id = this.getId();
|
|
41794
41789
|
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
@@ -42140,7 +42135,7 @@ class Placeholder extends BaseItem {
|
|
|
42140
42135
|
const anchorPoints = Shapes[this.shapeType].anchorPoints;
|
|
42141
42136
|
const points = [];
|
|
42142
42137
|
for (const anchorPoint of anchorPoints) {
|
|
42143
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
42138
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
42144
42139
|
}
|
|
42145
42140
|
return points;
|
|
42146
42141
|
}
|
|
@@ -42158,7 +42153,7 @@ class Placeholder extends BaseItem {
|
|
|
42158
42153
|
}
|
|
42159
42154
|
transformPath() {
|
|
42160
42155
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
42161
|
-
this.path.transform(this.transformation.
|
|
42156
|
+
this.path.transform(this.transformation.toMatrix());
|
|
42162
42157
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
42163
42158
|
this.path.setBorderColor("transparent");
|
|
42164
42159
|
}
|
|
@@ -42354,7 +42349,7 @@ class ImageItem extends BaseItem {
|
|
|
42354
42349
|
this.subject.publish(this);
|
|
42355
42350
|
};
|
|
42356
42351
|
updateMbr() {
|
|
42357
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42352
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42358
42353
|
const rotation = this.transformation.getRotation();
|
|
42359
42354
|
const width2 = this.image.width * scaleX;
|
|
42360
42355
|
const height2 = this.image.height * scaleY;
|
|
@@ -42397,10 +42392,11 @@ class ImageItem extends BaseItem {
|
|
|
42397
42392
|
};
|
|
42398
42393
|
}
|
|
42399
42394
|
setCoordinates() {
|
|
42400
|
-
|
|
42401
|
-
this.
|
|
42402
|
-
this.
|
|
42403
|
-
this.
|
|
42395
|
+
const { translateX: coordX, translateY: coordY, scaleX: coordScaleX, scaleY: coordScaleY } = this.transformation.getMatrixData();
|
|
42396
|
+
this.left = coordX;
|
|
42397
|
+
this.top = coordY;
|
|
42398
|
+
this.right = this.left + this.image.width * coordScaleX;
|
|
42399
|
+
this.bottom = this.top + this.image.height * coordScaleY;
|
|
42404
42400
|
this.subject.publish(this);
|
|
42405
42401
|
}
|
|
42406
42402
|
shootBeforeLoadCallbacks() {
|
|
@@ -42467,7 +42463,7 @@ class ImageItem extends BaseItem {
|
|
|
42467
42463
|
}
|
|
42468
42464
|
const ctx = context.ctx;
|
|
42469
42465
|
ctx.save();
|
|
42470
|
-
this.transformation.
|
|
42466
|
+
this.transformation.applyToContext(ctx);
|
|
42471
42467
|
const rotation = this.transformation.getRotation();
|
|
42472
42468
|
if (rotation !== 0) {
|
|
42473
42469
|
const imgWidth = this.image.width || 0;
|
|
@@ -42485,7 +42481,7 @@ class ImageItem extends BaseItem {
|
|
|
42485
42481
|
}
|
|
42486
42482
|
renderHTML(documentFactory) {
|
|
42487
42483
|
const div = documentFactory.createElement("image-item");
|
|
42488
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42484
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42489
42485
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
42490
42486
|
div.style.backgroundImage = `url(${this.storageLink})`;
|
|
42491
42487
|
div.id = this.getId();
|
|
@@ -42638,7 +42634,7 @@ class Drawing extends BaseItem {
|
|
|
42638
42634
|
untransformedMbr.top -= offset;
|
|
42639
42635
|
untransformedMbr.right += offset;
|
|
42640
42636
|
untransformedMbr.bottom += offset;
|
|
42641
|
-
const mbr = untransformedMbr.getTransformed(this.transformation.
|
|
42637
|
+
const mbr = untransformedMbr.getTransformed(this.transformation.toMatrix());
|
|
42642
42638
|
this.left = mbr.left;
|
|
42643
42639
|
this.top = mbr.top;
|
|
42644
42640
|
this.right = mbr.right;
|
|
@@ -42685,7 +42681,7 @@ class Drawing extends BaseItem {
|
|
|
42685
42681
|
}
|
|
42686
42682
|
updateLines() {
|
|
42687
42683
|
this.lines = [];
|
|
42688
|
-
const matrix = this.transformation.
|
|
42684
|
+
const matrix = this.transformation.toMatrix();
|
|
42689
42685
|
if (this.points.length < 2) {
|
|
42690
42686
|
return;
|
|
42691
42687
|
}
|
|
@@ -42733,7 +42729,7 @@ class Drawing extends BaseItem {
|
|
|
42733
42729
|
ctx.lineWidth = this.strokeWidth;
|
|
42734
42730
|
ctx.lineCap = "round";
|
|
42735
42731
|
ctx.setLineDash(this.linePattern);
|
|
42736
|
-
this.transformation.
|
|
42732
|
+
this.transformation.applyToContext(ctx);
|
|
42737
42733
|
ctx.stroke(this.path2d.nativePath);
|
|
42738
42734
|
ctx.restore();
|
|
42739
42735
|
if (this.getLinkTo()) {
|
|
@@ -42743,7 +42739,7 @@ class Drawing extends BaseItem {
|
|
|
42743
42739
|
}
|
|
42744
42740
|
renderHTML(documentFactory) {
|
|
42745
42741
|
const div = documentFactory.createElement("drawing-item");
|
|
42746
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42742
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42747
42743
|
const mbr = this.getMbr();
|
|
42748
42744
|
const width2 = mbr.getWidth();
|
|
42749
42745
|
const height2 = mbr.getHeight();
|
|
@@ -42932,8 +42928,9 @@ class Drawing extends BaseItem {
|
|
|
42932
42928
|
return null;
|
|
42933
42929
|
}
|
|
42934
42930
|
isPointNearLine(point5, threshold = 10) {
|
|
42935
|
-
const
|
|
42936
|
-
const
|
|
42931
|
+
const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
|
|
42932
|
+
const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
|
|
42933
|
+
const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
|
|
42937
42934
|
const transformedMouse = new Point(transformedMouseX, transformedMouseY);
|
|
42938
42935
|
for (let i = 0;i < this.points.length - 1; i++) {
|
|
42939
42936
|
const p1 = this.points[i];
|
|
@@ -44260,40 +44257,16 @@ class AddFrame extends BoardTool {
|
|
|
44260
44257
|
this.applyTranslateBy(-this.frame.getMbr().getWidth() / 2, -this.frame.getMbr().getHeight() / 2);
|
|
44261
44258
|
}
|
|
44262
44259
|
applyScaleTo(x, y) {
|
|
44263
|
-
this.frame.transformation.
|
|
44264
|
-
class: "Transformation",
|
|
44265
|
-
method: "scaleTo",
|
|
44266
|
-
item: [this.frame.getId()],
|
|
44267
|
-
x,
|
|
44268
|
-
y
|
|
44269
|
-
});
|
|
44260
|
+
this.frame.transformation.setLocal({ scaleX: x, scaleY: y });
|
|
44270
44261
|
}
|
|
44271
44262
|
applyScaleBy(x, y) {
|
|
44272
|
-
this.frame.transformation.
|
|
44273
|
-
class: "Transformation",
|
|
44274
|
-
method: "scaleBy",
|
|
44275
|
-
item: [this.frame.getId()],
|
|
44276
|
-
x,
|
|
44277
|
-
y
|
|
44278
|
-
});
|
|
44263
|
+
this.frame.transformation.scaleBy(x, y);
|
|
44279
44264
|
}
|
|
44280
44265
|
applyTranslateTo(x, y) {
|
|
44281
|
-
this.frame.transformation.
|
|
44282
|
-
class: "Transformation",
|
|
44283
|
-
method: "translateTo",
|
|
44284
|
-
item: [this.frame.getId()],
|
|
44285
|
-
x,
|
|
44286
|
-
y
|
|
44287
|
-
});
|
|
44266
|
+
this.frame.transformation.setLocal(x, y);
|
|
44288
44267
|
}
|
|
44289
44268
|
applyTranslateBy(x, y) {
|
|
44290
|
-
this.frame.transformation.
|
|
44291
|
-
class: "Transformation",
|
|
44292
|
-
method: "translateBy",
|
|
44293
|
-
item: [this.frame.getId()],
|
|
44294
|
-
x,
|
|
44295
|
-
y
|
|
44296
|
-
});
|
|
44269
|
+
this.frame.transformation.translateBy(x, y);
|
|
44297
44270
|
}
|
|
44298
44271
|
applyAddChildren(children) {
|
|
44299
44272
|
const childrenIds = children.map((child) => {
|
|
@@ -44361,20 +44334,7 @@ class AddShape extends BoardTool {
|
|
|
44361
44334
|
initTransformation(sx, sy) {
|
|
44362
44335
|
sx = sx || this.bounds.getWidth() / 100;
|
|
44363
44336
|
sy = sy || this.bounds.getHeight() / 100;
|
|
44364
|
-
this.shape.transformation.
|
|
44365
|
-
class: "Transformation",
|
|
44366
|
-
method: "translateTo",
|
|
44367
|
-
item: [this.shape.getId()],
|
|
44368
|
-
x: this.bounds.left,
|
|
44369
|
-
y: this.bounds.top
|
|
44370
|
-
});
|
|
44371
|
-
this.shape.transformation.apply({
|
|
44372
|
-
class: "Transformation",
|
|
44373
|
-
method: "scaleTo",
|
|
44374
|
-
item: [this.shape.getId()],
|
|
44375
|
-
x: sx,
|
|
44376
|
-
y: sy
|
|
44377
|
-
});
|
|
44337
|
+
this.shape.transformation.setLocal(this.bounds.left, this.bounds.top, sx, sy);
|
|
44378
44338
|
}
|
|
44379
44339
|
leftButtonDown() {
|
|
44380
44340
|
if (this.type === "None") {
|
|
@@ -44909,7 +44869,7 @@ class ExportSnapshot extends Tool {
|
|
|
44909
44869
|
}
|
|
44910
44870
|
rectMoveTo(x, y) {
|
|
44911
44871
|
this.transformation.translateTo(x, y);
|
|
44912
|
-
this.mbr.transform(this.transformation.
|
|
44872
|
+
this.mbr.transform(this.transformation.toMatrix());
|
|
44913
44873
|
this.board.tools.publish();
|
|
44914
44874
|
}
|
|
44915
44875
|
resize() {
|
|
@@ -47100,20 +47060,7 @@ class ShapeTool extends CustomTool {
|
|
|
47100
47060
|
initTransformation(sx, sy) {
|
|
47101
47061
|
sx = sx || this.bounds.getWidth() / 100;
|
|
47102
47062
|
sy = sy || this.bounds.getHeight() / 100;
|
|
47103
|
-
this.item.transformation.
|
|
47104
|
-
class: "Transformation",
|
|
47105
|
-
method: "translateTo",
|
|
47106
|
-
item: [this.item.getId()],
|
|
47107
|
-
x: this.bounds.left,
|
|
47108
|
-
y: this.bounds.top
|
|
47109
|
-
});
|
|
47110
|
-
this.item.transformation.apply({
|
|
47111
|
-
class: "Transformation",
|
|
47112
|
-
method: "scaleTo",
|
|
47113
|
-
item: [this.item.getId()],
|
|
47114
|
-
x: sx,
|
|
47115
|
-
y: sy
|
|
47116
|
-
});
|
|
47063
|
+
this.item.transformation.setLocal(this.bounds.left, this.bounds.top, sx, sy);
|
|
47117
47064
|
}
|
|
47118
47065
|
pointerDown() {
|
|
47119
47066
|
this.isDown = true;
|
|
@@ -47184,22 +47131,10 @@ class StickerTool extends CustomTool {
|
|
|
47184
47131
|
}
|
|
47185
47132
|
pointerDown() {
|
|
47186
47133
|
const point5 = this.board.pointer.point;
|
|
47187
|
-
this.item.transformation.
|
|
47188
|
-
class: "Transformation",
|
|
47189
|
-
method: "translateTo",
|
|
47190
|
-
item: [this.item.getId()],
|
|
47191
|
-
x: point5.x - this.settings.width / 2,
|
|
47192
|
-
y: point5.y - this.settings.height / 2
|
|
47193
|
-
});
|
|
47134
|
+
this.item.transformation.setLocal(point5.x - this.settings.width / 2, point5.y - this.settings.height / 2);
|
|
47194
47135
|
const width2 = this.item.getWidth();
|
|
47195
47136
|
const height3 = this.item.getHeight();
|
|
47196
|
-
this.item.transformation.
|
|
47197
|
-
class: "Transformation",
|
|
47198
|
-
method: "scaleBy",
|
|
47199
|
-
item: [this.item.getId()],
|
|
47200
|
-
x: width2 / this.settings.width,
|
|
47201
|
-
y: height3 / this.settings.height
|
|
47202
|
-
});
|
|
47137
|
+
this.item.transformation.scaleBy(width2 / this.settings.width, height3 / this.settings.height);
|
|
47203
47138
|
const addedItem = this.board.add(this.item);
|
|
47204
47139
|
this.board.selection.removeAll();
|
|
47205
47140
|
this.board.selection.add(addedItem);
|
|
@@ -47817,7 +47752,7 @@ class Star2 extends BaseItem {
|
|
|
47817
47752
|
}
|
|
47818
47753
|
transformPath() {
|
|
47819
47754
|
this.path = starPath.copy();
|
|
47820
|
-
this.path.transform(this.transformation.
|
|
47755
|
+
this.path.transform(this.transformation.toMatrix());
|
|
47821
47756
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
47822
47757
|
this.path.setBorderColor(this.borderColor);
|
|
47823
47758
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -47845,7 +47780,7 @@ class Star2 extends BaseItem {
|
|
|
47845
47780
|
}
|
|
47846
47781
|
renderHTML(documentFactory) {
|
|
47847
47782
|
const div = documentFactory.createElement("star-item");
|
|
47848
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47783
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
47849
47784
|
const mbr = this.getMbr();
|
|
47850
47785
|
const unscaledWidth = mbr.getWidth() / scaleX;
|
|
47851
47786
|
const unscaledHeight = mbr.getHeight() / scaleY;
|
|
@@ -47932,13 +47867,7 @@ class AddCounter extends StickerTool {
|
|
|
47932
47867
|
const x = (left + right) / 2 - COUNTER_DIMENSIONS.width / 2;
|
|
47933
47868
|
const y = (top + bottom) / 2 - COUNTER_DIMENSIONS.height / 2;
|
|
47934
47869
|
const counter2 = new Counter(this.board, "");
|
|
47935
|
-
counter2.transformation.
|
|
47936
|
-
class: "Transformation",
|
|
47937
|
-
method: "translateTo",
|
|
47938
|
-
item: [counter2.getId()],
|
|
47939
|
-
x,
|
|
47940
|
-
y
|
|
47941
|
-
});
|
|
47870
|
+
counter2.transformation.setLocal(x, y);
|
|
47942
47871
|
const addedCounter = this.board.add(counter2);
|
|
47943
47872
|
this.board.selection.add(addedCounter);
|
|
47944
47873
|
}
|
|
@@ -47978,7 +47907,7 @@ class Counter extends BaseItem {
|
|
|
47978
47907
|
}
|
|
47979
47908
|
}
|
|
47980
47909
|
updateMbr() {
|
|
47981
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47910
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
47982
47911
|
this.left = translateX;
|
|
47983
47912
|
this.top = translateY;
|
|
47984
47913
|
this.right = this.left + COUNTER_DIMENSIONS.width * scaleX;
|
|
@@ -48175,7 +48104,7 @@ class Card extends BaseItem {
|
|
|
48175
48104
|
}
|
|
48176
48105
|
renderHTML(documentFactory) {
|
|
48177
48106
|
const div = super.renderHTML(documentFactory);
|
|
48178
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48107
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48179
48108
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48180
48109
|
div.style.backgroundImage = `url(${this.imageToRender?.src || this.backsideUrl})`;
|
|
48181
48110
|
div.id = this.getId();
|
|
@@ -48189,7 +48118,7 @@ class Card extends BaseItem {
|
|
|
48189
48118
|
return div;
|
|
48190
48119
|
}
|
|
48191
48120
|
updateMbr() {
|
|
48192
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48121
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48193
48122
|
const rotation = this.transformation.getRotation();
|
|
48194
48123
|
const height3 = this.dimensions.height * scaleY;
|
|
48195
48124
|
const width2 = this.dimensions.width * scaleX;
|
|
@@ -48340,24 +48269,12 @@ class Deck extends BaseItem {
|
|
|
48340
48269
|
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
|
|
48341
48270
|
if (canAddItem) {
|
|
48342
48271
|
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
48343
|
-
foundItem.transformation.
|
|
48344
|
-
class: "Transformation",
|
|
48345
|
-
method: "translateTo",
|
|
48346
|
-
item: [this.id],
|
|
48347
|
-
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48348
|
-
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48349
|
-
});
|
|
48272
|
+
foundItem.transformation.setLocal(this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET), this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0));
|
|
48350
48273
|
if (firstCard) {
|
|
48351
|
-
const { scaleX, scaleY } = foundItem.transformation.
|
|
48352
|
-
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.
|
|
48274
|
+
const { scaleX, scaleY } = foundItem.transformation.getMatrixData();
|
|
48275
|
+
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.getMatrixData();
|
|
48353
48276
|
if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
|
|
48354
|
-
foundItem.transformation.
|
|
48355
|
-
class: "Transformation",
|
|
48356
|
-
method: "scaleTo",
|
|
48357
|
-
item: [this.id],
|
|
48358
|
-
x: targetScaleX,
|
|
48359
|
-
y: targetScaleY
|
|
48360
|
-
});
|
|
48277
|
+
foundItem.transformation.setLocal({ scaleX: targetScaleX, scaleY: targetScaleY });
|
|
48361
48278
|
}
|
|
48362
48279
|
}
|
|
48363
48280
|
this.board.selection.remove(foundItem);
|
|
@@ -48459,7 +48376,7 @@ class Deck extends BaseItem {
|
|
|
48459
48376
|
this.subject.publish(this);
|
|
48460
48377
|
}
|
|
48461
48378
|
updateMbr() {
|
|
48462
|
-
const { translateX, translateY } = this.transformation.
|
|
48379
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
48463
48380
|
const items = this.index.list();
|
|
48464
48381
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
48465
48382
|
this.left = translateX;
|
|
@@ -48533,7 +48450,7 @@ class Deck extends BaseItem {
|
|
|
48533
48450
|
if (!topCard) {
|
|
48534
48451
|
return div;
|
|
48535
48452
|
}
|
|
48536
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48453
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48537
48454
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
48538
48455
|
const topCardElement = topCard.renderHTML(documentFactory);
|
|
48539
48456
|
div.appendChild(topCardElement);
|
|
@@ -48688,13 +48605,7 @@ function createDeck(event, board) {
|
|
|
48688
48605
|
const onlyCards = board.selection.items.isAllItemsType("Card");
|
|
48689
48606
|
if (onlyCards) {
|
|
48690
48607
|
const deck = new Deck(board, "");
|
|
48691
|
-
deck.transformation.
|
|
48692
|
-
class: "Transformation",
|
|
48693
|
-
method: "translateTo",
|
|
48694
|
-
item: [deck.getId()],
|
|
48695
|
-
x: cardsOrDecks[cardsOrDecks.length - 1].left,
|
|
48696
|
-
y: cardsOrDecks[cardsOrDecks.length - 1].top
|
|
48697
|
-
});
|
|
48608
|
+
deck.transformation.setLocal(cardsOrDecks[cardsOrDecks.length - 1].left, cardsOrDecks[cardsOrDecks.length - 1].top);
|
|
48698
48609
|
const addedDeck = board.add(deck);
|
|
48699
48610
|
board.selection.items.removeAll();
|
|
48700
48611
|
addedDeck.addChildItems(cardsOrDecks);
|
|
@@ -48781,7 +48692,7 @@ class Dice extends BaseItem {
|
|
|
48781
48692
|
}
|
|
48782
48693
|
transformPath() {
|
|
48783
48694
|
this.path = createRoundedRectanglePath(this).copy();
|
|
48784
|
-
this.path.transform(this.transformation.
|
|
48695
|
+
this.path.transform(this.transformation.toMatrix());
|
|
48785
48696
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48786
48697
|
this.path.setBorderColor(this.borderColor);
|
|
48787
48698
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -49003,7 +48914,7 @@ class Dice extends BaseItem {
|
|
|
49003
48914
|
}
|
|
49004
48915
|
renderHTML(documentFactory) {
|
|
49005
48916
|
const div = super.renderHTML(documentFactory);
|
|
49006
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48917
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
49007
48918
|
const mbr = this.getMbr();
|
|
49008
48919
|
const width2 = mbr.getWidth();
|
|
49009
48920
|
const height3 = mbr.getHeight();
|
|
@@ -49254,7 +49165,7 @@ class Screen extends BaseItem {
|
|
|
49254
49165
|
}
|
|
49255
49166
|
transformPath() {
|
|
49256
49167
|
this.path = screenPath.copy();
|
|
49257
|
-
this.path.transform(this.transformation.
|
|
49168
|
+
this.path.transform(this.transformation.toMatrix());
|
|
49258
49169
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
49259
49170
|
this.path.setBorderColor(this.borderColor);
|
|
49260
49171
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -51870,8 +51781,8 @@ function handleMultipleItemsResize({
|
|
|
51870
51781
|
let itemX = item.getMbr().left;
|
|
51871
51782
|
let itemY = item.getMbr().top;
|
|
51872
51783
|
if (item.itemType === "Drawing") {
|
|
51873
|
-
itemX = item.transformation.
|
|
51874
|
-
itemY = item.transformation.
|
|
51784
|
+
itemX = item.transformation.getMatrixData().translateX;
|
|
51785
|
+
itemY = item.transformation.getMatrixData().translateY;
|
|
51875
51786
|
}
|
|
51876
51787
|
const deltaX = itemX - initMbr.left;
|
|
51877
51788
|
const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
|