microboard-temp 0.5.23 → 0.5.25
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 +38 -15
- package/dist/cjs/index.js +38 -15
- package/dist/cjs/node.js +38 -15
- package/dist/esm/browser.js +38 -15
- package/dist/esm/index.js +38 -15
- package/dist/esm/node.js +38 -15
- package/dist/types/Items/BaseItem/BaseItem.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -7493,14 +7493,7 @@ class Transformation {
|
|
|
7493
7493
|
this.isLocked = data.isLocked;
|
|
7494
7494
|
}
|
|
7495
7495
|
if (data.rotate) {
|
|
7496
|
-
|
|
7497
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
7498
|
-
width: data.dimension.width,
|
|
7499
|
-
height: data.dimension.height
|
|
7500
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
7501
|
-
} else {
|
|
7502
|
-
this.matrix.rotateBy(data.rotate);
|
|
7503
|
-
}
|
|
7496
|
+
this.rotate = data.rotate;
|
|
7504
7497
|
}
|
|
7505
7498
|
this.subject.publish(this, {
|
|
7506
7499
|
class: "Transformation",
|
|
@@ -7635,10 +7628,9 @@ class Transformation {
|
|
|
7635
7628
|
}
|
|
7636
7629
|
}
|
|
7637
7630
|
this.rotate = degree;
|
|
7638
|
-
this.matrix.rotateBy(degree);
|
|
7639
7631
|
}
|
|
7640
7632
|
applyRotateBy(degree) {
|
|
7641
|
-
this.
|
|
7633
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7642
7634
|
}
|
|
7643
7635
|
applyLocked(locked) {
|
|
7644
7636
|
this.isLocked = locked;
|
|
@@ -21554,6 +21546,9 @@ class BaseItem extends Mbr {
|
|
|
21554
21546
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
21555
21547
|
});
|
|
21556
21548
|
}
|
|
21549
|
+
rotate(clockwise = true) {
|
|
21550
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
21551
|
+
}
|
|
21557
21552
|
emitNesting(children) {
|
|
21558
21553
|
const itemsToAdd = [];
|
|
21559
21554
|
const itemsToRemove = [];
|
|
@@ -21586,6 +21581,9 @@ class BaseItem extends Mbr {
|
|
|
21586
21581
|
}
|
|
21587
21582
|
return false;
|
|
21588
21583
|
}
|
|
21584
|
+
getMbr() {
|
|
21585
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
21586
|
+
}
|
|
21589
21587
|
applyAddChildren(childIds) {
|
|
21590
21588
|
if (!this.index) {
|
|
21591
21589
|
return;
|
|
@@ -47883,7 +47881,20 @@ class Card extends BaseItem {
|
|
|
47883
47881
|
const ctx = context.ctx;
|
|
47884
47882
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47885
47883
|
ctx.save();
|
|
47886
|
-
|
|
47884
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
47885
|
+
const width2 = this.getWidth();
|
|
47886
|
+
const height3 = this.getHeight();
|
|
47887
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
47888
|
+
centerX = left + width2 / 2;
|
|
47889
|
+
centerX = top + height3 / 2;
|
|
47890
|
+
}
|
|
47891
|
+
ctx.translate(centerX, centerY);
|
|
47892
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
47893
|
+
if (width2 > height3) {
|
|
47894
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
47895
|
+
} else {
|
|
47896
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
47897
|
+
}
|
|
47887
47898
|
ctx.restore();
|
|
47888
47899
|
}
|
|
47889
47900
|
}
|
|
@@ -47903,10 +47914,22 @@ class Card extends BaseItem {
|
|
|
47903
47914
|
}
|
|
47904
47915
|
updateMbr() {
|
|
47905
47916
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47906
|
-
|
|
47907
|
-
|
|
47908
|
-
|
|
47909
|
-
|
|
47917
|
+
const rotation = this.transformation.getRotation();
|
|
47918
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
47919
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
47920
|
+
if (rotation % 180 === 0) {
|
|
47921
|
+
this.left = translateX;
|
|
47922
|
+
this.top = translateY;
|
|
47923
|
+
this.right = this.left + width2;
|
|
47924
|
+
this.bottom = this.top + height3;
|
|
47925
|
+
} else {
|
|
47926
|
+
const centerX = translateX + width2 / 2;
|
|
47927
|
+
const centerY = translateY + height3 / 2;
|
|
47928
|
+
this.left = centerX - height3 / 2;
|
|
47929
|
+
this.top = centerY - width2 / 2;
|
|
47930
|
+
this.right = this.left + height3;
|
|
47931
|
+
this.bottom = this.top + width2;
|
|
47932
|
+
}
|
|
47910
47933
|
}
|
|
47911
47934
|
getPath() {
|
|
47912
47935
|
return new Path(this.getMbr().getLines());
|
package/dist/cjs/index.js
CHANGED
|
@@ -7493,14 +7493,7 @@ class Transformation {
|
|
|
7493
7493
|
this.isLocked = data.isLocked;
|
|
7494
7494
|
}
|
|
7495
7495
|
if (data.rotate) {
|
|
7496
|
-
|
|
7497
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
7498
|
-
width: data.dimension.width,
|
|
7499
|
-
height: data.dimension.height
|
|
7500
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
7501
|
-
} else {
|
|
7502
|
-
this.matrix.rotateBy(data.rotate);
|
|
7503
|
-
}
|
|
7496
|
+
this.rotate = data.rotate;
|
|
7504
7497
|
}
|
|
7505
7498
|
this.subject.publish(this, {
|
|
7506
7499
|
class: "Transformation",
|
|
@@ -7635,10 +7628,9 @@ class Transformation {
|
|
|
7635
7628
|
}
|
|
7636
7629
|
}
|
|
7637
7630
|
this.rotate = degree;
|
|
7638
|
-
this.matrix.rotateBy(degree);
|
|
7639
7631
|
}
|
|
7640
7632
|
applyRotateBy(degree) {
|
|
7641
|
-
this.
|
|
7633
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7642
7634
|
}
|
|
7643
7635
|
applyLocked(locked) {
|
|
7644
7636
|
this.isLocked = locked;
|
|
@@ -21554,6 +21546,9 @@ class BaseItem extends Mbr {
|
|
|
21554
21546
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
21555
21547
|
});
|
|
21556
21548
|
}
|
|
21549
|
+
rotate(clockwise = true) {
|
|
21550
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
21551
|
+
}
|
|
21557
21552
|
emitNesting(children) {
|
|
21558
21553
|
const itemsToAdd = [];
|
|
21559
21554
|
const itemsToRemove = [];
|
|
@@ -21586,6 +21581,9 @@ class BaseItem extends Mbr {
|
|
|
21586
21581
|
}
|
|
21587
21582
|
return false;
|
|
21588
21583
|
}
|
|
21584
|
+
getMbr() {
|
|
21585
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
21586
|
+
}
|
|
21589
21587
|
applyAddChildren(childIds) {
|
|
21590
21588
|
if (!this.index) {
|
|
21591
21589
|
return;
|
|
@@ -47883,7 +47881,20 @@ class Card extends BaseItem {
|
|
|
47883
47881
|
const ctx = context.ctx;
|
|
47884
47882
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47885
47883
|
ctx.save();
|
|
47886
|
-
|
|
47884
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
47885
|
+
const width2 = this.getWidth();
|
|
47886
|
+
const height3 = this.getHeight();
|
|
47887
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
47888
|
+
centerX = left + width2 / 2;
|
|
47889
|
+
centerX = top + height3 / 2;
|
|
47890
|
+
}
|
|
47891
|
+
ctx.translate(centerX, centerY);
|
|
47892
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
47893
|
+
if (width2 > height3) {
|
|
47894
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
47895
|
+
} else {
|
|
47896
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
47897
|
+
}
|
|
47887
47898
|
ctx.restore();
|
|
47888
47899
|
}
|
|
47889
47900
|
}
|
|
@@ -47903,10 +47914,22 @@ class Card extends BaseItem {
|
|
|
47903
47914
|
}
|
|
47904
47915
|
updateMbr() {
|
|
47905
47916
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47906
|
-
|
|
47907
|
-
|
|
47908
|
-
|
|
47909
|
-
|
|
47917
|
+
const rotation = this.transformation.getRotation();
|
|
47918
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
47919
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
47920
|
+
if (rotation % 180 === 0) {
|
|
47921
|
+
this.left = translateX;
|
|
47922
|
+
this.top = translateY;
|
|
47923
|
+
this.right = this.left + width2;
|
|
47924
|
+
this.bottom = this.top + height3;
|
|
47925
|
+
} else {
|
|
47926
|
+
const centerX = translateX + width2 / 2;
|
|
47927
|
+
const centerY = translateY + height3 / 2;
|
|
47928
|
+
this.left = centerX - height3 / 2;
|
|
47929
|
+
this.top = centerY - width2 / 2;
|
|
47930
|
+
this.right = this.left + height3;
|
|
47931
|
+
this.bottom = this.top + width2;
|
|
47932
|
+
}
|
|
47910
47933
|
}
|
|
47911
47934
|
getPath() {
|
|
47912
47935
|
return new Path(this.getMbr().getLines());
|
package/dist/cjs/node.js
CHANGED
|
@@ -8530,14 +8530,7 @@ class Transformation {
|
|
|
8530
8530
|
this.isLocked = data.isLocked;
|
|
8531
8531
|
}
|
|
8532
8532
|
if (data.rotate) {
|
|
8533
|
-
|
|
8534
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
8535
|
-
width: data.dimension.width,
|
|
8536
|
-
height: data.dimension.height
|
|
8537
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
8538
|
-
} else {
|
|
8539
|
-
this.matrix.rotateBy(data.rotate);
|
|
8540
|
-
}
|
|
8533
|
+
this.rotate = data.rotate;
|
|
8541
8534
|
}
|
|
8542
8535
|
this.subject.publish(this, {
|
|
8543
8536
|
class: "Transformation",
|
|
@@ -8672,10 +8665,9 @@ class Transformation {
|
|
|
8672
8665
|
}
|
|
8673
8666
|
}
|
|
8674
8667
|
this.rotate = degree;
|
|
8675
|
-
this.matrix.rotateBy(degree);
|
|
8676
8668
|
}
|
|
8677
8669
|
applyRotateBy(degree) {
|
|
8678
|
-
this.
|
|
8670
|
+
this.applyRotateTo(this.rotate + degree);
|
|
8679
8671
|
}
|
|
8680
8672
|
applyLocked(locked) {
|
|
8681
8673
|
this.isLocked = locked;
|
|
@@ -24026,6 +24018,9 @@ class BaseItem extends Mbr {
|
|
|
24026
24018
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
24027
24019
|
});
|
|
24028
24020
|
}
|
|
24021
|
+
rotate(clockwise = true) {
|
|
24022
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
24023
|
+
}
|
|
24029
24024
|
emitNesting(children) {
|
|
24030
24025
|
const itemsToAdd = [];
|
|
24031
24026
|
const itemsToRemove = [];
|
|
@@ -24058,6 +24053,9 @@ class BaseItem extends Mbr {
|
|
|
24058
24053
|
}
|
|
24059
24054
|
return false;
|
|
24060
24055
|
}
|
|
24056
|
+
getMbr() {
|
|
24057
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
24058
|
+
}
|
|
24061
24059
|
applyAddChildren(childIds) {
|
|
24062
24060
|
if (!this.index) {
|
|
24063
24061
|
return;
|
|
@@ -50356,7 +50354,20 @@ class Card extends BaseItem {
|
|
|
50356
50354
|
const ctx = context.ctx;
|
|
50357
50355
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
50358
50356
|
ctx.save();
|
|
50359
|
-
|
|
50357
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
50358
|
+
const width2 = this.getWidth();
|
|
50359
|
+
const height3 = this.getHeight();
|
|
50360
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
50361
|
+
centerX = left + width2 / 2;
|
|
50362
|
+
centerX = top + height3 / 2;
|
|
50363
|
+
}
|
|
50364
|
+
ctx.translate(centerX, centerY);
|
|
50365
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
50366
|
+
if (width2 > height3) {
|
|
50367
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
50368
|
+
} else {
|
|
50369
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
50370
|
+
}
|
|
50360
50371
|
ctx.restore();
|
|
50361
50372
|
}
|
|
50362
50373
|
}
|
|
@@ -50376,10 +50387,22 @@ class Card extends BaseItem {
|
|
|
50376
50387
|
}
|
|
50377
50388
|
updateMbr() {
|
|
50378
50389
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50390
|
+
const rotation = this.transformation.getRotation();
|
|
50391
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
50392
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
50393
|
+
if (rotation % 180 === 0) {
|
|
50394
|
+
this.left = translateX;
|
|
50395
|
+
this.top = translateY;
|
|
50396
|
+
this.right = this.left + width2;
|
|
50397
|
+
this.bottom = this.top + height3;
|
|
50398
|
+
} else {
|
|
50399
|
+
const centerX = translateX + width2 / 2;
|
|
50400
|
+
const centerY = translateY + height3 / 2;
|
|
50401
|
+
this.left = centerX - height3 / 2;
|
|
50402
|
+
this.top = centerY - width2 / 2;
|
|
50403
|
+
this.right = this.left + height3;
|
|
50404
|
+
this.bottom = this.top + width2;
|
|
50405
|
+
}
|
|
50383
50406
|
}
|
|
50384
50407
|
getPath() {
|
|
50385
50408
|
return new Path(this.getMbr().getLines());
|
package/dist/esm/browser.js
CHANGED
|
@@ -7330,14 +7330,7 @@ class Transformation {
|
|
|
7330
7330
|
this.isLocked = data.isLocked;
|
|
7331
7331
|
}
|
|
7332
7332
|
if (data.rotate) {
|
|
7333
|
-
|
|
7334
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
7335
|
-
width: data.dimension.width,
|
|
7336
|
-
height: data.dimension.height
|
|
7337
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
7338
|
-
} else {
|
|
7339
|
-
this.matrix.rotateBy(data.rotate);
|
|
7340
|
-
}
|
|
7333
|
+
this.rotate = data.rotate;
|
|
7341
7334
|
}
|
|
7342
7335
|
this.subject.publish(this, {
|
|
7343
7336
|
class: "Transformation",
|
|
@@ -7472,10 +7465,9 @@ class Transformation {
|
|
|
7472
7465
|
}
|
|
7473
7466
|
}
|
|
7474
7467
|
this.rotate = degree;
|
|
7475
|
-
this.matrix.rotateBy(degree);
|
|
7476
7468
|
}
|
|
7477
7469
|
applyRotateBy(degree) {
|
|
7478
|
-
this.
|
|
7470
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7479
7471
|
}
|
|
7480
7472
|
applyLocked(locked) {
|
|
7481
7473
|
this.isLocked = locked;
|
|
@@ -21400,6 +21392,9 @@ class BaseItem extends Mbr {
|
|
|
21400
21392
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
21401
21393
|
});
|
|
21402
21394
|
}
|
|
21395
|
+
rotate(clockwise = true) {
|
|
21396
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
21397
|
+
}
|
|
21403
21398
|
emitNesting(children) {
|
|
21404
21399
|
const itemsToAdd = [];
|
|
21405
21400
|
const itemsToRemove = [];
|
|
@@ -21432,6 +21427,9 @@ class BaseItem extends Mbr {
|
|
|
21432
21427
|
}
|
|
21433
21428
|
return false;
|
|
21434
21429
|
}
|
|
21430
|
+
getMbr() {
|
|
21431
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
21432
|
+
}
|
|
21435
21433
|
applyAddChildren(childIds) {
|
|
21436
21434
|
if (!this.index) {
|
|
21437
21435
|
return;
|
|
@@ -47729,7 +47727,20 @@ class Card extends BaseItem {
|
|
|
47729
47727
|
const ctx = context.ctx;
|
|
47730
47728
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47731
47729
|
ctx.save();
|
|
47732
|
-
|
|
47730
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
47731
|
+
const width2 = this.getWidth();
|
|
47732
|
+
const height3 = this.getHeight();
|
|
47733
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
47734
|
+
centerX = left + width2 / 2;
|
|
47735
|
+
centerX = top + height3 / 2;
|
|
47736
|
+
}
|
|
47737
|
+
ctx.translate(centerX, centerY);
|
|
47738
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
47739
|
+
if (width2 > height3) {
|
|
47740
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
47741
|
+
} else {
|
|
47742
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
47743
|
+
}
|
|
47733
47744
|
ctx.restore();
|
|
47734
47745
|
}
|
|
47735
47746
|
}
|
|
@@ -47749,10 +47760,22 @@ class Card extends BaseItem {
|
|
|
47749
47760
|
}
|
|
47750
47761
|
updateMbr() {
|
|
47751
47762
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47752
|
-
|
|
47753
|
-
|
|
47754
|
-
|
|
47755
|
-
|
|
47763
|
+
const rotation = this.transformation.getRotation();
|
|
47764
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
47765
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
47766
|
+
if (rotation % 180 === 0) {
|
|
47767
|
+
this.left = translateX;
|
|
47768
|
+
this.top = translateY;
|
|
47769
|
+
this.right = this.left + width2;
|
|
47770
|
+
this.bottom = this.top + height3;
|
|
47771
|
+
} else {
|
|
47772
|
+
const centerX = translateX + width2 / 2;
|
|
47773
|
+
const centerY = translateY + height3 / 2;
|
|
47774
|
+
this.left = centerX - height3 / 2;
|
|
47775
|
+
this.top = centerY - width2 / 2;
|
|
47776
|
+
this.right = this.left + height3;
|
|
47777
|
+
this.bottom = this.top + width2;
|
|
47778
|
+
}
|
|
47756
47779
|
}
|
|
47757
47780
|
getPath() {
|
|
47758
47781
|
return new Path(this.getMbr().getLines());
|
package/dist/esm/index.js
CHANGED
|
@@ -7323,14 +7323,7 @@ class Transformation {
|
|
|
7323
7323
|
this.isLocked = data.isLocked;
|
|
7324
7324
|
}
|
|
7325
7325
|
if (data.rotate) {
|
|
7326
|
-
|
|
7327
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
7328
|
-
width: data.dimension.width,
|
|
7329
|
-
height: data.dimension.height
|
|
7330
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
7331
|
-
} else {
|
|
7332
|
-
this.matrix.rotateBy(data.rotate);
|
|
7333
|
-
}
|
|
7326
|
+
this.rotate = data.rotate;
|
|
7334
7327
|
}
|
|
7335
7328
|
this.subject.publish(this, {
|
|
7336
7329
|
class: "Transformation",
|
|
@@ -7465,10 +7458,9 @@ class Transformation {
|
|
|
7465
7458
|
}
|
|
7466
7459
|
}
|
|
7467
7460
|
this.rotate = degree;
|
|
7468
|
-
this.matrix.rotateBy(degree);
|
|
7469
7461
|
}
|
|
7470
7462
|
applyRotateBy(degree) {
|
|
7471
|
-
this.
|
|
7463
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7472
7464
|
}
|
|
7473
7465
|
applyLocked(locked) {
|
|
7474
7466
|
this.isLocked = locked;
|
|
@@ -21393,6 +21385,9 @@ class BaseItem extends Mbr {
|
|
|
21393
21385
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
21394
21386
|
});
|
|
21395
21387
|
}
|
|
21388
|
+
rotate(clockwise = true) {
|
|
21389
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
21390
|
+
}
|
|
21396
21391
|
emitNesting(children) {
|
|
21397
21392
|
const itemsToAdd = [];
|
|
21398
21393
|
const itemsToRemove = [];
|
|
@@ -21425,6 +21420,9 @@ class BaseItem extends Mbr {
|
|
|
21425
21420
|
}
|
|
21426
21421
|
return false;
|
|
21427
21422
|
}
|
|
21423
|
+
getMbr() {
|
|
21424
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
21425
|
+
}
|
|
21428
21426
|
applyAddChildren(childIds) {
|
|
21429
21427
|
if (!this.index) {
|
|
21430
21428
|
return;
|
|
@@ -47722,7 +47720,20 @@ class Card extends BaseItem {
|
|
|
47722
47720
|
const ctx = context.ctx;
|
|
47723
47721
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47724
47722
|
ctx.save();
|
|
47725
|
-
|
|
47723
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
47724
|
+
const width2 = this.getWidth();
|
|
47725
|
+
const height3 = this.getHeight();
|
|
47726
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
47727
|
+
centerX = left + width2 / 2;
|
|
47728
|
+
centerX = top + height3 / 2;
|
|
47729
|
+
}
|
|
47730
|
+
ctx.translate(centerX, centerY);
|
|
47731
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
47732
|
+
if (width2 > height3) {
|
|
47733
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
47734
|
+
} else {
|
|
47735
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
47736
|
+
}
|
|
47726
47737
|
ctx.restore();
|
|
47727
47738
|
}
|
|
47728
47739
|
}
|
|
@@ -47742,10 +47753,22 @@ class Card extends BaseItem {
|
|
|
47742
47753
|
}
|
|
47743
47754
|
updateMbr() {
|
|
47744
47755
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47745
|
-
|
|
47746
|
-
|
|
47747
|
-
|
|
47748
|
-
|
|
47756
|
+
const rotation = this.transformation.getRotation();
|
|
47757
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
47758
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
47759
|
+
if (rotation % 180 === 0) {
|
|
47760
|
+
this.left = translateX;
|
|
47761
|
+
this.top = translateY;
|
|
47762
|
+
this.right = this.left + width2;
|
|
47763
|
+
this.bottom = this.top + height3;
|
|
47764
|
+
} else {
|
|
47765
|
+
const centerX = translateX + width2 / 2;
|
|
47766
|
+
const centerY = translateY + height3 / 2;
|
|
47767
|
+
this.left = centerX - height3 / 2;
|
|
47768
|
+
this.top = centerY - width2 / 2;
|
|
47769
|
+
this.right = this.left + height3;
|
|
47770
|
+
this.bottom = this.top + width2;
|
|
47771
|
+
}
|
|
47749
47772
|
}
|
|
47750
47773
|
getPath() {
|
|
47751
47774
|
return new Path(this.getMbr().getLines());
|
package/dist/esm/node.js
CHANGED
|
@@ -8107,14 +8107,7 @@ class Transformation {
|
|
|
8107
8107
|
this.isLocked = data.isLocked;
|
|
8108
8108
|
}
|
|
8109
8109
|
if (data.rotate) {
|
|
8110
|
-
|
|
8111
|
-
this.matrix.rotateByObjectCenter(data.rotate, {
|
|
8112
|
-
width: data.dimension.width,
|
|
8113
|
-
height: data.dimension.height
|
|
8114
|
-
}, { x: data.scaleX, y: data.scaleY });
|
|
8115
|
-
} else {
|
|
8116
|
-
this.matrix.rotateBy(data.rotate);
|
|
8117
|
-
}
|
|
8110
|
+
this.rotate = data.rotate;
|
|
8118
8111
|
}
|
|
8119
8112
|
this.subject.publish(this, {
|
|
8120
8113
|
class: "Transformation",
|
|
@@ -8249,10 +8242,9 @@ class Transformation {
|
|
|
8249
8242
|
}
|
|
8250
8243
|
}
|
|
8251
8244
|
this.rotate = degree;
|
|
8252
|
-
this.matrix.rotateBy(degree);
|
|
8253
8245
|
}
|
|
8254
8246
|
applyRotateBy(degree) {
|
|
8255
|
-
this.
|
|
8247
|
+
this.applyRotateTo(this.rotate + degree);
|
|
8256
8248
|
}
|
|
8257
8249
|
applyLocked(locked) {
|
|
8258
8250
|
this.isLocked = locked;
|
|
@@ -23860,6 +23852,9 @@ class BaseItem extends Mbr {
|
|
|
23860
23852
|
newData: { childIds: childrenArr.map((child) => child.getId()) }
|
|
23861
23853
|
});
|
|
23862
23854
|
}
|
|
23855
|
+
rotate(clockwise = true) {
|
|
23856
|
+
this.transformation.rotateBy(clockwise ? 90 : -90);
|
|
23857
|
+
}
|
|
23863
23858
|
emitNesting(children) {
|
|
23864
23859
|
const itemsToAdd = [];
|
|
23865
23860
|
const itemsToRemove = [];
|
|
@@ -23892,6 +23887,9 @@ class BaseItem extends Mbr {
|
|
|
23892
23887
|
}
|
|
23893
23888
|
return false;
|
|
23894
23889
|
}
|
|
23890
|
+
getMbr() {
|
|
23891
|
+
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
23892
|
+
}
|
|
23895
23893
|
applyAddChildren(childIds) {
|
|
23896
23894
|
if (!this.index) {
|
|
23897
23895
|
return;
|
|
@@ -50190,7 +50188,20 @@ class Card extends BaseItem {
|
|
|
50190
50188
|
const ctx = context.ctx;
|
|
50191
50189
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
50192
50190
|
ctx.save();
|
|
50193
|
-
|
|
50191
|
+
let { x: centerX, y: centerY } = this.getMbr().getCenter();
|
|
50192
|
+
const width2 = this.getWidth();
|
|
50193
|
+
const height3 = this.getHeight();
|
|
50194
|
+
if (typeof left === "number" && typeof top === "number") {
|
|
50195
|
+
centerX = left + width2 / 2;
|
|
50196
|
+
centerX = top + height3 / 2;
|
|
50197
|
+
}
|
|
50198
|
+
ctx.translate(centerX, centerY);
|
|
50199
|
+
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
50200
|
+
if (width2 > height3) {
|
|
50201
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, height3, width2);
|
|
50202
|
+
} else {
|
|
50203
|
+
ctx.drawImage(this.imageToRender, -width2 / 2, -height3 / 2, width2, height3);
|
|
50204
|
+
}
|
|
50194
50205
|
ctx.restore();
|
|
50195
50206
|
}
|
|
50196
50207
|
}
|
|
@@ -50210,10 +50221,22 @@ class Card extends BaseItem {
|
|
|
50210
50221
|
}
|
|
50211
50222
|
updateMbr() {
|
|
50212
50223
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
50213
|
-
|
|
50214
|
-
|
|
50215
|
-
|
|
50216
|
-
|
|
50224
|
+
const rotation = this.transformation.getRotation();
|
|
50225
|
+
const height3 = conf.CARD_DIMENSIONS.height * scaleY;
|
|
50226
|
+
const width2 = conf.CARD_DIMENSIONS.width * scaleX;
|
|
50227
|
+
if (rotation % 180 === 0) {
|
|
50228
|
+
this.left = translateX;
|
|
50229
|
+
this.top = translateY;
|
|
50230
|
+
this.right = this.left + width2;
|
|
50231
|
+
this.bottom = this.top + height3;
|
|
50232
|
+
} else {
|
|
50233
|
+
const centerX = translateX + width2 / 2;
|
|
50234
|
+
const centerY = translateY + height3 / 2;
|
|
50235
|
+
this.left = centerX - height3 / 2;
|
|
50236
|
+
this.top = centerY - width2 / 2;
|
|
50237
|
+
this.right = this.left + height3;
|
|
50238
|
+
this.bottom = this.top + width2;
|
|
50239
|
+
}
|
|
50217
50240
|
}
|
|
50218
50241
|
getPath() {
|
|
50219
50242
|
return new Path(this.getMbr().getLines());
|
|
@@ -47,11 +47,13 @@ export declare class BaseItem extends Mbr implements Geometry {
|
|
|
47
47
|
getChildrenIds(): string[] | null;
|
|
48
48
|
addChildItems(children: BaseItem[]): void;
|
|
49
49
|
removeChildItems(children: BaseItem[] | BaseItem): void;
|
|
50
|
+
rotate(clockwise?: boolean): void;
|
|
50
51
|
emitNesting(children: BaseItem[]): void;
|
|
51
52
|
handleNesting(item: BaseItem | Mbr, options?: {
|
|
52
53
|
onlyForOut?: boolean;
|
|
53
54
|
cancelIfChild?: boolean;
|
|
54
55
|
}): boolean;
|
|
56
|
+
getMbr(): Mbr;
|
|
55
57
|
applyAddChildren(childIds: string[]): void;
|
|
56
58
|
applyRemoveChildren(childIds: string[]): void;
|
|
57
59
|
updateMbr(): void;
|