microboard-temp 0.11.1 → 0.11.3
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 +51 -30
- package/dist/cjs/index.js +51 -30
- package/dist/cjs/node.js +51 -30
- package/dist/esm/browser.js +51 -30
- package/dist/esm/index.js +51 -30
- package/dist/esm/node.js +51 -30
- package/dist/types/Items/RichText/RichText.d.ts +0 -8
- package/dist/types/Items/Transformation/TransformationCommand.d.ts +10 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -17752,9 +17752,15 @@ class TransformationCommand {
|
|
|
17752
17752
|
transformation;
|
|
17753
17753
|
operation;
|
|
17754
17754
|
reverse;
|
|
17755
|
-
|
|
17755
|
+
itemsMap = new Map;
|
|
17756
|
+
constructor(transformation, operation, items) {
|
|
17756
17757
|
this.transformation = transformation;
|
|
17757
17758
|
this.operation = operation;
|
|
17759
|
+
if (items) {
|
|
17760
|
+
for (const item of items) {
|
|
17761
|
+
this.itemsMap.set(item.transformation, item);
|
|
17762
|
+
}
|
|
17763
|
+
}
|
|
17758
17764
|
this.reverse = this.getReverse();
|
|
17759
17765
|
}
|
|
17760
17766
|
merge(op) {
|
|
@@ -17764,12 +17770,22 @@ class TransformationCommand {
|
|
|
17764
17770
|
}
|
|
17765
17771
|
apply() {
|
|
17766
17772
|
for (const transformation of this.transformation) {
|
|
17767
|
-
|
|
17773
|
+
const item = this.itemsMap.get(transformation);
|
|
17774
|
+
if (item) {
|
|
17775
|
+
item.apply(this.operation);
|
|
17776
|
+
} else {
|
|
17777
|
+
transformation.apply(this.operation);
|
|
17778
|
+
}
|
|
17768
17779
|
}
|
|
17769
17780
|
}
|
|
17770
17781
|
revert() {
|
|
17771
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
17772
|
-
item.
|
|
17782
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
17783
|
+
const item = this.itemsMap.get(transformation);
|
|
17784
|
+
if (item) {
|
|
17785
|
+
item.apply(operation);
|
|
17786
|
+
} else {
|
|
17787
|
+
transformation.apply(operation);
|
|
17788
|
+
}
|
|
17773
17789
|
});
|
|
17774
17790
|
}
|
|
17775
17791
|
getReverse() {
|
|
@@ -19225,7 +19241,7 @@ class Comment {
|
|
|
19225
19241
|
this.transform();
|
|
19226
19242
|
break;
|
|
19227
19243
|
case "Transformation":
|
|
19228
|
-
|
|
19244
|
+
super.apply(op);
|
|
19229
19245
|
break;
|
|
19230
19246
|
default:
|
|
19231
19247
|
return;
|
|
@@ -19754,7 +19770,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19754
19770
|
}
|
|
19755
19771
|
}
|
|
19756
19772
|
function createTransformationCommand(items, operation) {
|
|
19757
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
19773
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
19758
19774
|
}
|
|
19759
19775
|
function createLinkToCommand(items, operation) {
|
|
19760
19776
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -21867,10 +21883,9 @@ class BaseItem extends Mbr {
|
|
|
21867
21883
|
return this.getMbr();
|
|
21868
21884
|
}
|
|
21869
21885
|
const container = this.board.items.getById(this.parent);
|
|
21870
|
-
if (!container)
|
|
21886
|
+
if (!container)
|
|
21871
21887
|
return this.getMbr();
|
|
21872
|
-
|
|
21873
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
21888
|
+
const worldMatrix = container.getWorldMatrix();
|
|
21874
21889
|
const local = this.getMbr();
|
|
21875
21890
|
const corners = [
|
|
21876
21891
|
new Point(local.left, local.top),
|
|
@@ -21879,7 +21894,7 @@ class BaseItem extends Mbr {
|
|
|
21879
21894
|
new Point(local.left, local.bottom)
|
|
21880
21895
|
];
|
|
21881
21896
|
for (const c of corners)
|
|
21882
|
-
|
|
21897
|
+
worldMatrix.apply(c);
|
|
21883
21898
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21884
21899
|
}
|
|
21885
21900
|
applyAddChildren(childIds) {
|
|
@@ -22328,15 +22343,29 @@ class RichText extends BaseItem {
|
|
|
22328
22343
|
};
|
|
22329
22344
|
calcAutoSize(blockNodes) {
|
|
22330
22345
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22331
|
-
const container = this.
|
|
22346
|
+
const container = this.getTransformedContainer();
|
|
22332
22347
|
const containerWidth = container.getWidth();
|
|
22333
22348
|
const containerHeight = container.getHeight();
|
|
22334
|
-
const
|
|
22335
|
-
|
|
22349
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
22350
|
+
let effectiveWidth = containerWidth;
|
|
22351
|
+
let effectiveHeight = containerHeight;
|
|
22352
|
+
if (worldMatrix) {
|
|
22353
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22354
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
22355
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
22356
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
22357
|
+
}
|
|
22358
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
22359
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
22360
|
+
if (worldMatrix) {
|
|
22361
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22362
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
22363
|
+
}
|
|
22364
|
+
return worldTextScale;
|
|
22336
22365
|
}
|
|
22337
22366
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
22338
22367
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22339
|
-
const container = this.
|
|
22368
|
+
const container = this.getTransformedContainer();
|
|
22340
22369
|
const containerWidth = container.getWidth();
|
|
22341
22370
|
const containerHeight = container.getHeight();
|
|
22342
22371
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -22458,13 +22487,6 @@ class RichText extends BaseItem {
|
|
|
22458
22487
|
}
|
|
22459
22488
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22460
22489
|
}
|
|
22461
|
-
getLayoutContainer() {
|
|
22462
|
-
if (this.insideOf === "Frame") {
|
|
22463
|
-
return this.getTransformedContainer();
|
|
22464
|
-
}
|
|
22465
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
22466
|
-
return this.container.getTransformed(matrix);
|
|
22467
|
-
}
|
|
22468
22490
|
emitWithoutApplying = (op) => {
|
|
22469
22491
|
if (this.board.events) {
|
|
22470
22492
|
this.board.events.emit(op);
|
|
@@ -22480,7 +22502,7 @@ class RichText extends BaseItem {
|
|
|
22480
22502
|
apply(op) {
|
|
22481
22503
|
switch (op.class) {
|
|
22482
22504
|
case "Transformation":
|
|
22483
|
-
|
|
22505
|
+
super.apply(op);
|
|
22484
22506
|
break;
|
|
22485
22507
|
case "LinkTo":
|
|
22486
22508
|
this.linkTo.apply(op);
|
|
@@ -36431,7 +36453,6 @@ class AINode extends BaseItem {
|
|
|
36431
36453
|
this.subject.publish(this);
|
|
36432
36454
|
});
|
|
36433
36455
|
this.text.insideOf = "AINode";
|
|
36434
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
36435
36456
|
this.transformPath();
|
|
36436
36457
|
}
|
|
36437
36458
|
transformPath() {
|
|
@@ -40028,7 +40049,7 @@ class Shape extends BaseItem {
|
|
|
40028
40049
|
this.text.apply(op);
|
|
40029
40050
|
break;
|
|
40030
40051
|
case "Transformation":
|
|
40031
|
-
|
|
40052
|
+
super.apply(op);
|
|
40032
40053
|
break;
|
|
40033
40054
|
case "LinkTo":
|
|
40034
40055
|
this.linkTo.apply(op);
|
|
@@ -41805,7 +41826,7 @@ class VideoItem extends BaseItem {
|
|
|
41805
41826
|
apply(op) {
|
|
41806
41827
|
switch (op.class) {
|
|
41807
41828
|
case "Transformation":
|
|
41808
|
-
|
|
41829
|
+
super.apply(op);
|
|
41809
41830
|
break;
|
|
41810
41831
|
case "LinkTo":
|
|
41811
41832
|
this.linkTo.apply(op);
|
|
@@ -42281,7 +42302,7 @@ class AudioItem extends BaseItem {
|
|
|
42281
42302
|
apply(op) {
|
|
42282
42303
|
switch (op.class) {
|
|
42283
42304
|
case "Transformation":
|
|
42284
|
-
|
|
42305
|
+
super.apply(op);
|
|
42285
42306
|
break;
|
|
42286
42307
|
case "LinkTo":
|
|
42287
42308
|
this.linkTo.apply(op);
|
|
@@ -42475,7 +42496,7 @@ class Placeholder extends BaseItem {
|
|
|
42475
42496
|
this.updateMbr();
|
|
42476
42497
|
break;
|
|
42477
42498
|
case "Transformation":
|
|
42478
|
-
|
|
42499
|
+
super.apply(op);
|
|
42479
42500
|
break;
|
|
42480
42501
|
default:
|
|
42481
42502
|
return;
|
|
@@ -42902,7 +42923,7 @@ class ImageItem extends BaseItem {
|
|
|
42902
42923
|
apply(op) {
|
|
42903
42924
|
switch (op.class) {
|
|
42904
42925
|
case "Transformation":
|
|
42905
|
-
|
|
42926
|
+
super.apply(op);
|
|
42906
42927
|
break;
|
|
42907
42928
|
case "LinkTo":
|
|
42908
42929
|
this.linkTo.apply(op);
|
|
@@ -43330,7 +43351,7 @@ class Drawing extends BaseItem {
|
|
|
43330
43351
|
this.updateMbr();
|
|
43331
43352
|
break;
|
|
43332
43353
|
case "Transformation":
|
|
43333
|
-
|
|
43354
|
+
super.apply(op);
|
|
43334
43355
|
break;
|
|
43335
43356
|
case "LinkTo":
|
|
43336
43357
|
this.linkTo.apply(op);
|
|
@@ -43493,7 +43514,7 @@ class Group extends BaseItem {
|
|
|
43493
43514
|
}
|
|
43494
43515
|
break;
|
|
43495
43516
|
case "Transformation":
|
|
43496
|
-
|
|
43517
|
+
super.apply(op);
|
|
43497
43518
|
break;
|
|
43498
43519
|
default:
|
|
43499
43520
|
return;
|
package/dist/cjs/index.js
CHANGED
|
@@ -17752,9 +17752,15 @@ class TransformationCommand {
|
|
|
17752
17752
|
transformation;
|
|
17753
17753
|
operation;
|
|
17754
17754
|
reverse;
|
|
17755
|
-
|
|
17755
|
+
itemsMap = new Map;
|
|
17756
|
+
constructor(transformation, operation, items) {
|
|
17756
17757
|
this.transformation = transformation;
|
|
17757
17758
|
this.operation = operation;
|
|
17759
|
+
if (items) {
|
|
17760
|
+
for (const item of items) {
|
|
17761
|
+
this.itemsMap.set(item.transformation, item);
|
|
17762
|
+
}
|
|
17763
|
+
}
|
|
17758
17764
|
this.reverse = this.getReverse();
|
|
17759
17765
|
}
|
|
17760
17766
|
merge(op) {
|
|
@@ -17764,12 +17770,22 @@ class TransformationCommand {
|
|
|
17764
17770
|
}
|
|
17765
17771
|
apply() {
|
|
17766
17772
|
for (const transformation of this.transformation) {
|
|
17767
|
-
|
|
17773
|
+
const item = this.itemsMap.get(transformation);
|
|
17774
|
+
if (item) {
|
|
17775
|
+
item.apply(this.operation);
|
|
17776
|
+
} else {
|
|
17777
|
+
transformation.apply(this.operation);
|
|
17778
|
+
}
|
|
17768
17779
|
}
|
|
17769
17780
|
}
|
|
17770
17781
|
revert() {
|
|
17771
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
17772
|
-
item.
|
|
17782
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
17783
|
+
const item = this.itemsMap.get(transformation);
|
|
17784
|
+
if (item) {
|
|
17785
|
+
item.apply(operation);
|
|
17786
|
+
} else {
|
|
17787
|
+
transformation.apply(operation);
|
|
17788
|
+
}
|
|
17773
17789
|
});
|
|
17774
17790
|
}
|
|
17775
17791
|
getReverse() {
|
|
@@ -19225,7 +19241,7 @@ class Comment {
|
|
|
19225
19241
|
this.transform();
|
|
19226
19242
|
break;
|
|
19227
19243
|
case "Transformation":
|
|
19228
|
-
|
|
19244
|
+
super.apply(op);
|
|
19229
19245
|
break;
|
|
19230
19246
|
default:
|
|
19231
19247
|
return;
|
|
@@ -19754,7 +19770,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19754
19770
|
}
|
|
19755
19771
|
}
|
|
19756
19772
|
function createTransformationCommand(items, operation) {
|
|
19757
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
19773
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
19758
19774
|
}
|
|
19759
19775
|
function createLinkToCommand(items, operation) {
|
|
19760
19776
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -21867,10 +21883,9 @@ class BaseItem extends Mbr {
|
|
|
21867
21883
|
return this.getMbr();
|
|
21868
21884
|
}
|
|
21869
21885
|
const container = this.board.items.getById(this.parent);
|
|
21870
|
-
if (!container)
|
|
21886
|
+
if (!container)
|
|
21871
21887
|
return this.getMbr();
|
|
21872
|
-
|
|
21873
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
21888
|
+
const worldMatrix = container.getWorldMatrix();
|
|
21874
21889
|
const local = this.getMbr();
|
|
21875
21890
|
const corners = [
|
|
21876
21891
|
new Point(local.left, local.top),
|
|
@@ -21879,7 +21894,7 @@ class BaseItem extends Mbr {
|
|
|
21879
21894
|
new Point(local.left, local.bottom)
|
|
21880
21895
|
];
|
|
21881
21896
|
for (const c of corners)
|
|
21882
|
-
|
|
21897
|
+
worldMatrix.apply(c);
|
|
21883
21898
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21884
21899
|
}
|
|
21885
21900
|
applyAddChildren(childIds) {
|
|
@@ -22328,15 +22343,29 @@ class RichText extends BaseItem {
|
|
|
22328
22343
|
};
|
|
22329
22344
|
calcAutoSize(blockNodes) {
|
|
22330
22345
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22331
|
-
const container = this.
|
|
22346
|
+
const container = this.getTransformedContainer();
|
|
22332
22347
|
const containerWidth = container.getWidth();
|
|
22333
22348
|
const containerHeight = container.getHeight();
|
|
22334
|
-
const
|
|
22335
|
-
|
|
22349
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
22350
|
+
let effectiveWidth = containerWidth;
|
|
22351
|
+
let effectiveHeight = containerHeight;
|
|
22352
|
+
if (worldMatrix) {
|
|
22353
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22354
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
22355
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
22356
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
22357
|
+
}
|
|
22358
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
22359
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
22360
|
+
if (worldMatrix) {
|
|
22361
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22362
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
22363
|
+
}
|
|
22364
|
+
return worldTextScale;
|
|
22336
22365
|
}
|
|
22337
22366
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
22338
22367
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22339
|
-
const container = this.
|
|
22368
|
+
const container = this.getTransformedContainer();
|
|
22340
22369
|
const containerWidth = container.getWidth();
|
|
22341
22370
|
const containerHeight = container.getHeight();
|
|
22342
22371
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -22458,13 +22487,6 @@ class RichText extends BaseItem {
|
|
|
22458
22487
|
}
|
|
22459
22488
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22460
22489
|
}
|
|
22461
|
-
getLayoutContainer() {
|
|
22462
|
-
if (this.insideOf === "Frame") {
|
|
22463
|
-
return this.getTransformedContainer();
|
|
22464
|
-
}
|
|
22465
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
22466
|
-
return this.container.getTransformed(matrix);
|
|
22467
|
-
}
|
|
22468
22490
|
emitWithoutApplying = (op) => {
|
|
22469
22491
|
if (this.board.events) {
|
|
22470
22492
|
this.board.events.emit(op);
|
|
@@ -22480,7 +22502,7 @@ class RichText extends BaseItem {
|
|
|
22480
22502
|
apply(op) {
|
|
22481
22503
|
switch (op.class) {
|
|
22482
22504
|
case "Transformation":
|
|
22483
|
-
|
|
22505
|
+
super.apply(op);
|
|
22484
22506
|
break;
|
|
22485
22507
|
case "LinkTo":
|
|
22486
22508
|
this.linkTo.apply(op);
|
|
@@ -36431,7 +36453,6 @@ class AINode extends BaseItem {
|
|
|
36431
36453
|
this.subject.publish(this);
|
|
36432
36454
|
});
|
|
36433
36455
|
this.text.insideOf = "AINode";
|
|
36434
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
36435
36456
|
this.transformPath();
|
|
36436
36457
|
}
|
|
36437
36458
|
transformPath() {
|
|
@@ -40028,7 +40049,7 @@ class Shape extends BaseItem {
|
|
|
40028
40049
|
this.text.apply(op);
|
|
40029
40050
|
break;
|
|
40030
40051
|
case "Transformation":
|
|
40031
|
-
|
|
40052
|
+
super.apply(op);
|
|
40032
40053
|
break;
|
|
40033
40054
|
case "LinkTo":
|
|
40034
40055
|
this.linkTo.apply(op);
|
|
@@ -41805,7 +41826,7 @@ class VideoItem extends BaseItem {
|
|
|
41805
41826
|
apply(op) {
|
|
41806
41827
|
switch (op.class) {
|
|
41807
41828
|
case "Transformation":
|
|
41808
|
-
|
|
41829
|
+
super.apply(op);
|
|
41809
41830
|
break;
|
|
41810
41831
|
case "LinkTo":
|
|
41811
41832
|
this.linkTo.apply(op);
|
|
@@ -42281,7 +42302,7 @@ class AudioItem extends BaseItem {
|
|
|
42281
42302
|
apply(op) {
|
|
42282
42303
|
switch (op.class) {
|
|
42283
42304
|
case "Transformation":
|
|
42284
|
-
|
|
42305
|
+
super.apply(op);
|
|
42285
42306
|
break;
|
|
42286
42307
|
case "LinkTo":
|
|
42287
42308
|
this.linkTo.apply(op);
|
|
@@ -42475,7 +42496,7 @@ class Placeholder extends BaseItem {
|
|
|
42475
42496
|
this.updateMbr();
|
|
42476
42497
|
break;
|
|
42477
42498
|
case "Transformation":
|
|
42478
|
-
|
|
42499
|
+
super.apply(op);
|
|
42479
42500
|
break;
|
|
42480
42501
|
default:
|
|
42481
42502
|
return;
|
|
@@ -42902,7 +42923,7 @@ class ImageItem extends BaseItem {
|
|
|
42902
42923
|
apply(op) {
|
|
42903
42924
|
switch (op.class) {
|
|
42904
42925
|
case "Transformation":
|
|
42905
|
-
|
|
42926
|
+
super.apply(op);
|
|
42906
42927
|
break;
|
|
42907
42928
|
case "LinkTo":
|
|
42908
42929
|
this.linkTo.apply(op);
|
|
@@ -43330,7 +43351,7 @@ class Drawing extends BaseItem {
|
|
|
43330
43351
|
this.updateMbr();
|
|
43331
43352
|
break;
|
|
43332
43353
|
case "Transformation":
|
|
43333
|
-
|
|
43354
|
+
super.apply(op);
|
|
43334
43355
|
break;
|
|
43335
43356
|
case "LinkTo":
|
|
43336
43357
|
this.linkTo.apply(op);
|
|
@@ -43493,7 +43514,7 @@ class Group extends BaseItem {
|
|
|
43493
43514
|
}
|
|
43494
43515
|
break;
|
|
43495
43516
|
case "Transformation":
|
|
43496
|
-
|
|
43517
|
+
super.apply(op);
|
|
43497
43518
|
break;
|
|
43498
43519
|
default:
|
|
43499
43520
|
return;
|
package/dist/cjs/node.js
CHANGED
|
@@ -20292,9 +20292,15 @@ class TransformationCommand {
|
|
|
20292
20292
|
transformation;
|
|
20293
20293
|
operation;
|
|
20294
20294
|
reverse;
|
|
20295
|
-
|
|
20295
|
+
itemsMap = new Map;
|
|
20296
|
+
constructor(transformation, operation, items) {
|
|
20296
20297
|
this.transformation = transformation;
|
|
20297
20298
|
this.operation = operation;
|
|
20299
|
+
if (items) {
|
|
20300
|
+
for (const item of items) {
|
|
20301
|
+
this.itemsMap.set(item.transformation, item);
|
|
20302
|
+
}
|
|
20303
|
+
}
|
|
20298
20304
|
this.reverse = this.getReverse();
|
|
20299
20305
|
}
|
|
20300
20306
|
merge(op) {
|
|
@@ -20304,12 +20310,22 @@ class TransformationCommand {
|
|
|
20304
20310
|
}
|
|
20305
20311
|
apply() {
|
|
20306
20312
|
for (const transformation of this.transformation) {
|
|
20307
|
-
|
|
20313
|
+
const item = this.itemsMap.get(transformation);
|
|
20314
|
+
if (item) {
|
|
20315
|
+
item.apply(this.operation);
|
|
20316
|
+
} else {
|
|
20317
|
+
transformation.apply(this.operation);
|
|
20318
|
+
}
|
|
20308
20319
|
}
|
|
20309
20320
|
}
|
|
20310
20321
|
revert() {
|
|
20311
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
20312
|
-
item.
|
|
20322
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
20323
|
+
const item = this.itemsMap.get(transformation);
|
|
20324
|
+
if (item) {
|
|
20325
|
+
item.apply(operation);
|
|
20326
|
+
} else {
|
|
20327
|
+
transformation.apply(operation);
|
|
20328
|
+
}
|
|
20313
20329
|
});
|
|
20314
20330
|
}
|
|
20315
20331
|
getReverse() {
|
|
@@ -21764,7 +21780,7 @@ class Comment {
|
|
|
21764
21780
|
this.transform();
|
|
21765
21781
|
break;
|
|
21766
21782
|
case "Transformation":
|
|
21767
|
-
|
|
21783
|
+
super.apply(op);
|
|
21768
21784
|
break;
|
|
21769
21785
|
default:
|
|
21770
21786
|
return;
|
|
@@ -22293,7 +22309,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
22293
22309
|
}
|
|
22294
22310
|
}
|
|
22295
22311
|
function createTransformationCommand(items, operation) {
|
|
22296
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
22312
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
22297
22313
|
}
|
|
22298
22314
|
function createLinkToCommand(items, operation) {
|
|
22299
22315
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -24339,10 +24355,9 @@ class BaseItem extends Mbr {
|
|
|
24339
24355
|
return this.getMbr();
|
|
24340
24356
|
}
|
|
24341
24357
|
const container = this.board.items.getById(this.parent);
|
|
24342
|
-
if (!container)
|
|
24358
|
+
if (!container)
|
|
24343
24359
|
return this.getMbr();
|
|
24344
|
-
|
|
24345
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
24360
|
+
const worldMatrix = container.getWorldMatrix();
|
|
24346
24361
|
const local = this.getMbr();
|
|
24347
24362
|
const corners = [
|
|
24348
24363
|
new Point(local.left, local.top),
|
|
@@ -24351,7 +24366,7 @@ class BaseItem extends Mbr {
|
|
|
24351
24366
|
new Point(local.left, local.bottom)
|
|
24352
24367
|
];
|
|
24353
24368
|
for (const c of corners)
|
|
24354
|
-
|
|
24369
|
+
worldMatrix.apply(c);
|
|
24355
24370
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
24356
24371
|
}
|
|
24357
24372
|
applyAddChildren(childIds) {
|
|
@@ -24800,15 +24815,29 @@ class RichText extends BaseItem {
|
|
|
24800
24815
|
};
|
|
24801
24816
|
calcAutoSize(blockNodes) {
|
|
24802
24817
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
24803
|
-
const container = this.
|
|
24818
|
+
const container = this.getTransformedContainer();
|
|
24804
24819
|
const containerWidth = container.getWidth();
|
|
24805
24820
|
const containerHeight = container.getHeight();
|
|
24806
|
-
const
|
|
24807
|
-
|
|
24821
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
24822
|
+
let effectiveWidth = containerWidth;
|
|
24823
|
+
let effectiveHeight = containerHeight;
|
|
24824
|
+
if (worldMatrix) {
|
|
24825
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
24826
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
24827
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
24828
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
24829
|
+
}
|
|
24830
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
24831
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
24832
|
+
if (worldMatrix) {
|
|
24833
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
24834
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
24835
|
+
}
|
|
24836
|
+
return worldTextScale;
|
|
24808
24837
|
}
|
|
24809
24838
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
24810
24839
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
24811
|
-
const container = this.
|
|
24840
|
+
const container = this.getTransformedContainer();
|
|
24812
24841
|
const containerWidth = container.getWidth();
|
|
24813
24842
|
const containerHeight = container.getHeight();
|
|
24814
24843
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -24930,13 +24959,6 @@ class RichText extends BaseItem {
|
|
|
24930
24959
|
}
|
|
24931
24960
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
24932
24961
|
}
|
|
24933
|
-
getLayoutContainer() {
|
|
24934
|
-
if (this.insideOf === "Frame") {
|
|
24935
|
-
return this.getTransformedContainer();
|
|
24936
|
-
}
|
|
24937
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
24938
|
-
return this.container.getTransformed(matrix);
|
|
24939
|
-
}
|
|
24940
24962
|
emitWithoutApplying = (op) => {
|
|
24941
24963
|
if (this.board.events) {
|
|
24942
24964
|
this.board.events.emit(op);
|
|
@@ -24952,7 +24974,7 @@ class RichText extends BaseItem {
|
|
|
24952
24974
|
apply(op) {
|
|
24953
24975
|
switch (op.class) {
|
|
24954
24976
|
case "Transformation":
|
|
24955
|
-
|
|
24977
|
+
super.apply(op);
|
|
24956
24978
|
break;
|
|
24957
24979
|
case "LinkTo":
|
|
24958
24980
|
this.linkTo.apply(op);
|
|
@@ -38904,7 +38926,6 @@ class AINode extends BaseItem {
|
|
|
38904
38926
|
this.subject.publish(this);
|
|
38905
38927
|
});
|
|
38906
38928
|
this.text.insideOf = "AINode";
|
|
38907
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
38908
38929
|
this.transformPath();
|
|
38909
38930
|
}
|
|
38910
38931
|
transformPath() {
|
|
@@ -42501,7 +42522,7 @@ class Shape extends BaseItem {
|
|
|
42501
42522
|
this.text.apply(op);
|
|
42502
42523
|
break;
|
|
42503
42524
|
case "Transformation":
|
|
42504
|
-
|
|
42525
|
+
super.apply(op);
|
|
42505
42526
|
break;
|
|
42506
42527
|
case "LinkTo":
|
|
42507
42528
|
this.linkTo.apply(op);
|
|
@@ -44278,7 +44299,7 @@ class VideoItem extends BaseItem {
|
|
|
44278
44299
|
apply(op) {
|
|
44279
44300
|
switch (op.class) {
|
|
44280
44301
|
case "Transformation":
|
|
44281
|
-
|
|
44302
|
+
super.apply(op);
|
|
44282
44303
|
break;
|
|
44283
44304
|
case "LinkTo":
|
|
44284
44305
|
this.linkTo.apply(op);
|
|
@@ -44754,7 +44775,7 @@ class AudioItem extends BaseItem {
|
|
|
44754
44775
|
apply(op) {
|
|
44755
44776
|
switch (op.class) {
|
|
44756
44777
|
case "Transformation":
|
|
44757
|
-
|
|
44778
|
+
super.apply(op);
|
|
44758
44779
|
break;
|
|
44759
44780
|
case "LinkTo":
|
|
44760
44781
|
this.linkTo.apply(op);
|
|
@@ -44948,7 +44969,7 @@ class Placeholder extends BaseItem {
|
|
|
44948
44969
|
this.updateMbr();
|
|
44949
44970
|
break;
|
|
44950
44971
|
case "Transformation":
|
|
44951
|
-
|
|
44972
|
+
super.apply(op);
|
|
44952
44973
|
break;
|
|
44953
44974
|
default:
|
|
44954
44975
|
return;
|
|
@@ -45375,7 +45396,7 @@ class ImageItem extends BaseItem {
|
|
|
45375
45396
|
apply(op) {
|
|
45376
45397
|
switch (op.class) {
|
|
45377
45398
|
case "Transformation":
|
|
45378
|
-
|
|
45399
|
+
super.apply(op);
|
|
45379
45400
|
break;
|
|
45380
45401
|
case "LinkTo":
|
|
45381
45402
|
this.linkTo.apply(op);
|
|
@@ -45803,7 +45824,7 @@ class Drawing extends BaseItem {
|
|
|
45803
45824
|
this.updateMbr();
|
|
45804
45825
|
break;
|
|
45805
45826
|
case "Transformation":
|
|
45806
|
-
|
|
45827
|
+
super.apply(op);
|
|
45807
45828
|
break;
|
|
45808
45829
|
case "LinkTo":
|
|
45809
45830
|
this.linkTo.apply(op);
|
|
@@ -45966,7 +45987,7 @@ class Group extends BaseItem {
|
|
|
45966
45987
|
}
|
|
45967
45988
|
break;
|
|
45968
45989
|
case "Transformation":
|
|
45969
|
-
|
|
45990
|
+
super.apply(op);
|
|
45970
45991
|
break;
|
|
45971
45992
|
default:
|
|
45972
45993
|
return;
|
package/dist/esm/browser.js
CHANGED
|
@@ -17581,9 +17581,15 @@ class TransformationCommand {
|
|
|
17581
17581
|
transformation;
|
|
17582
17582
|
operation;
|
|
17583
17583
|
reverse;
|
|
17584
|
-
|
|
17584
|
+
itemsMap = new Map;
|
|
17585
|
+
constructor(transformation, operation, items) {
|
|
17585
17586
|
this.transformation = transformation;
|
|
17586
17587
|
this.operation = operation;
|
|
17588
|
+
if (items) {
|
|
17589
|
+
for (const item of items) {
|
|
17590
|
+
this.itemsMap.set(item.transformation, item);
|
|
17591
|
+
}
|
|
17592
|
+
}
|
|
17587
17593
|
this.reverse = this.getReverse();
|
|
17588
17594
|
}
|
|
17589
17595
|
merge(op) {
|
|
@@ -17593,12 +17599,22 @@ class TransformationCommand {
|
|
|
17593
17599
|
}
|
|
17594
17600
|
apply() {
|
|
17595
17601
|
for (const transformation of this.transformation) {
|
|
17596
|
-
|
|
17602
|
+
const item = this.itemsMap.get(transformation);
|
|
17603
|
+
if (item) {
|
|
17604
|
+
item.apply(this.operation);
|
|
17605
|
+
} else {
|
|
17606
|
+
transformation.apply(this.operation);
|
|
17607
|
+
}
|
|
17597
17608
|
}
|
|
17598
17609
|
}
|
|
17599
17610
|
revert() {
|
|
17600
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
17601
|
-
item.
|
|
17611
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
17612
|
+
const item = this.itemsMap.get(transformation);
|
|
17613
|
+
if (item) {
|
|
17614
|
+
item.apply(operation);
|
|
17615
|
+
} else {
|
|
17616
|
+
transformation.apply(operation);
|
|
17617
|
+
}
|
|
17602
17618
|
});
|
|
17603
17619
|
}
|
|
17604
17620
|
getReverse() {
|
|
@@ -19054,7 +19070,7 @@ class Comment {
|
|
|
19054
19070
|
this.transform();
|
|
19055
19071
|
break;
|
|
19056
19072
|
case "Transformation":
|
|
19057
|
-
|
|
19073
|
+
super.apply(op);
|
|
19058
19074
|
break;
|
|
19059
19075
|
default:
|
|
19060
19076
|
return;
|
|
@@ -19583,7 +19599,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19583
19599
|
}
|
|
19584
19600
|
}
|
|
19585
19601
|
function createTransformationCommand(items, operation) {
|
|
19586
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
19602
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
19587
19603
|
}
|
|
19588
19604
|
function createLinkToCommand(items, operation) {
|
|
19589
19605
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -21696,10 +21712,9 @@ class BaseItem extends Mbr {
|
|
|
21696
21712
|
return this.getMbr();
|
|
21697
21713
|
}
|
|
21698
21714
|
const container = this.board.items.getById(this.parent);
|
|
21699
|
-
if (!container)
|
|
21715
|
+
if (!container)
|
|
21700
21716
|
return this.getMbr();
|
|
21701
|
-
|
|
21702
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
21717
|
+
const worldMatrix = container.getWorldMatrix();
|
|
21703
21718
|
const local = this.getMbr();
|
|
21704
21719
|
const corners = [
|
|
21705
21720
|
new Point(local.left, local.top),
|
|
@@ -21708,7 +21723,7 @@ class BaseItem extends Mbr {
|
|
|
21708
21723
|
new Point(local.left, local.bottom)
|
|
21709
21724
|
];
|
|
21710
21725
|
for (const c of corners)
|
|
21711
|
-
|
|
21726
|
+
worldMatrix.apply(c);
|
|
21712
21727
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21713
21728
|
}
|
|
21714
21729
|
applyAddChildren(childIds) {
|
|
@@ -22157,15 +22172,29 @@ class RichText extends BaseItem {
|
|
|
22157
22172
|
};
|
|
22158
22173
|
calcAutoSize(blockNodes) {
|
|
22159
22174
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22160
|
-
const container = this.
|
|
22175
|
+
const container = this.getTransformedContainer();
|
|
22161
22176
|
const containerWidth = container.getWidth();
|
|
22162
22177
|
const containerHeight = container.getHeight();
|
|
22163
|
-
const
|
|
22164
|
-
|
|
22178
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
22179
|
+
let effectiveWidth = containerWidth;
|
|
22180
|
+
let effectiveHeight = containerHeight;
|
|
22181
|
+
if (worldMatrix) {
|
|
22182
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22183
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
22184
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
22185
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
22186
|
+
}
|
|
22187
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
22188
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
22189
|
+
if (worldMatrix) {
|
|
22190
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22191
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
22192
|
+
}
|
|
22193
|
+
return worldTextScale;
|
|
22165
22194
|
}
|
|
22166
22195
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
22167
22196
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22168
|
-
const container = this.
|
|
22197
|
+
const container = this.getTransformedContainer();
|
|
22169
22198
|
const containerWidth = container.getWidth();
|
|
22170
22199
|
const containerHeight = container.getHeight();
|
|
22171
22200
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -22287,13 +22316,6 @@ class RichText extends BaseItem {
|
|
|
22287
22316
|
}
|
|
22288
22317
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22289
22318
|
}
|
|
22290
|
-
getLayoutContainer() {
|
|
22291
|
-
if (this.insideOf === "Frame") {
|
|
22292
|
-
return this.getTransformedContainer();
|
|
22293
|
-
}
|
|
22294
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
22295
|
-
return this.container.getTransformed(matrix);
|
|
22296
|
-
}
|
|
22297
22319
|
emitWithoutApplying = (op) => {
|
|
22298
22320
|
if (this.board.events) {
|
|
22299
22321
|
this.board.events.emit(op);
|
|
@@ -22309,7 +22331,7 @@ class RichText extends BaseItem {
|
|
|
22309
22331
|
apply(op) {
|
|
22310
22332
|
switch (op.class) {
|
|
22311
22333
|
case "Transformation":
|
|
22312
|
-
|
|
22334
|
+
super.apply(op);
|
|
22313
22335
|
break;
|
|
22314
22336
|
case "LinkTo":
|
|
22315
22337
|
this.linkTo.apply(op);
|
|
@@ -36260,7 +36282,6 @@ class AINode extends BaseItem {
|
|
|
36260
36282
|
this.subject.publish(this);
|
|
36261
36283
|
});
|
|
36262
36284
|
this.text.insideOf = "AINode";
|
|
36263
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
36264
36285
|
this.transformPath();
|
|
36265
36286
|
}
|
|
36266
36287
|
transformPath() {
|
|
@@ -39857,7 +39878,7 @@ class Shape extends BaseItem {
|
|
|
39857
39878
|
this.text.apply(op);
|
|
39858
39879
|
break;
|
|
39859
39880
|
case "Transformation":
|
|
39860
|
-
|
|
39881
|
+
super.apply(op);
|
|
39861
39882
|
break;
|
|
39862
39883
|
case "LinkTo":
|
|
39863
39884
|
this.linkTo.apply(op);
|
|
@@ -41634,7 +41655,7 @@ class VideoItem extends BaseItem {
|
|
|
41634
41655
|
apply(op) {
|
|
41635
41656
|
switch (op.class) {
|
|
41636
41657
|
case "Transformation":
|
|
41637
|
-
|
|
41658
|
+
super.apply(op);
|
|
41638
41659
|
break;
|
|
41639
41660
|
case "LinkTo":
|
|
41640
41661
|
this.linkTo.apply(op);
|
|
@@ -42110,7 +42131,7 @@ class AudioItem extends BaseItem {
|
|
|
42110
42131
|
apply(op) {
|
|
42111
42132
|
switch (op.class) {
|
|
42112
42133
|
case "Transformation":
|
|
42113
|
-
|
|
42134
|
+
super.apply(op);
|
|
42114
42135
|
break;
|
|
42115
42136
|
case "LinkTo":
|
|
42116
42137
|
this.linkTo.apply(op);
|
|
@@ -42304,7 +42325,7 @@ class Placeholder extends BaseItem {
|
|
|
42304
42325
|
this.updateMbr();
|
|
42305
42326
|
break;
|
|
42306
42327
|
case "Transformation":
|
|
42307
|
-
|
|
42328
|
+
super.apply(op);
|
|
42308
42329
|
break;
|
|
42309
42330
|
default:
|
|
42310
42331
|
return;
|
|
@@ -42731,7 +42752,7 @@ class ImageItem extends BaseItem {
|
|
|
42731
42752
|
apply(op) {
|
|
42732
42753
|
switch (op.class) {
|
|
42733
42754
|
case "Transformation":
|
|
42734
|
-
|
|
42755
|
+
super.apply(op);
|
|
42735
42756
|
break;
|
|
42736
42757
|
case "LinkTo":
|
|
42737
42758
|
this.linkTo.apply(op);
|
|
@@ -43159,7 +43180,7 @@ class Drawing extends BaseItem {
|
|
|
43159
43180
|
this.updateMbr();
|
|
43160
43181
|
break;
|
|
43161
43182
|
case "Transformation":
|
|
43162
|
-
|
|
43183
|
+
super.apply(op);
|
|
43163
43184
|
break;
|
|
43164
43185
|
case "LinkTo":
|
|
43165
43186
|
this.linkTo.apply(op);
|
|
@@ -43322,7 +43343,7 @@ class Group extends BaseItem {
|
|
|
43322
43343
|
}
|
|
43323
43344
|
break;
|
|
43324
43345
|
case "Transformation":
|
|
43325
|
-
|
|
43346
|
+
super.apply(op);
|
|
43326
43347
|
break;
|
|
43327
43348
|
default:
|
|
43328
43349
|
return;
|
package/dist/esm/index.js
CHANGED
|
@@ -17574,9 +17574,15 @@ class TransformationCommand {
|
|
|
17574
17574
|
transformation;
|
|
17575
17575
|
operation;
|
|
17576
17576
|
reverse;
|
|
17577
|
-
|
|
17577
|
+
itemsMap = new Map;
|
|
17578
|
+
constructor(transformation, operation, items) {
|
|
17578
17579
|
this.transformation = transformation;
|
|
17579
17580
|
this.operation = operation;
|
|
17581
|
+
if (items) {
|
|
17582
|
+
for (const item of items) {
|
|
17583
|
+
this.itemsMap.set(item.transformation, item);
|
|
17584
|
+
}
|
|
17585
|
+
}
|
|
17580
17586
|
this.reverse = this.getReverse();
|
|
17581
17587
|
}
|
|
17582
17588
|
merge(op) {
|
|
@@ -17586,12 +17592,22 @@ class TransformationCommand {
|
|
|
17586
17592
|
}
|
|
17587
17593
|
apply() {
|
|
17588
17594
|
for (const transformation of this.transformation) {
|
|
17589
|
-
|
|
17595
|
+
const item = this.itemsMap.get(transformation);
|
|
17596
|
+
if (item) {
|
|
17597
|
+
item.apply(this.operation);
|
|
17598
|
+
} else {
|
|
17599
|
+
transformation.apply(this.operation);
|
|
17600
|
+
}
|
|
17590
17601
|
}
|
|
17591
17602
|
}
|
|
17592
17603
|
revert() {
|
|
17593
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
17594
|
-
item.
|
|
17604
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
17605
|
+
const item = this.itemsMap.get(transformation);
|
|
17606
|
+
if (item) {
|
|
17607
|
+
item.apply(operation);
|
|
17608
|
+
} else {
|
|
17609
|
+
transformation.apply(operation);
|
|
17610
|
+
}
|
|
17595
17611
|
});
|
|
17596
17612
|
}
|
|
17597
17613
|
getReverse() {
|
|
@@ -19047,7 +19063,7 @@ class Comment {
|
|
|
19047
19063
|
this.transform();
|
|
19048
19064
|
break;
|
|
19049
19065
|
case "Transformation":
|
|
19050
|
-
|
|
19066
|
+
super.apply(op);
|
|
19051
19067
|
break;
|
|
19052
19068
|
default:
|
|
19053
19069
|
return;
|
|
@@ -19576,7 +19592,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19576
19592
|
}
|
|
19577
19593
|
}
|
|
19578
19594
|
function createTransformationCommand(items, operation) {
|
|
19579
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
19595
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
19580
19596
|
}
|
|
19581
19597
|
function createLinkToCommand(items, operation) {
|
|
19582
19598
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -21689,10 +21705,9 @@ class BaseItem extends Mbr {
|
|
|
21689
21705
|
return this.getMbr();
|
|
21690
21706
|
}
|
|
21691
21707
|
const container = this.board.items.getById(this.parent);
|
|
21692
|
-
if (!container)
|
|
21708
|
+
if (!container)
|
|
21693
21709
|
return this.getMbr();
|
|
21694
|
-
|
|
21695
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
21710
|
+
const worldMatrix = container.getWorldMatrix();
|
|
21696
21711
|
const local = this.getMbr();
|
|
21697
21712
|
const corners = [
|
|
21698
21713
|
new Point(local.left, local.top),
|
|
@@ -21701,7 +21716,7 @@ class BaseItem extends Mbr {
|
|
|
21701
21716
|
new Point(local.left, local.bottom)
|
|
21702
21717
|
];
|
|
21703
21718
|
for (const c of corners)
|
|
21704
|
-
|
|
21719
|
+
worldMatrix.apply(c);
|
|
21705
21720
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21706
21721
|
}
|
|
21707
21722
|
applyAddChildren(childIds) {
|
|
@@ -22150,15 +22165,29 @@ class RichText extends BaseItem {
|
|
|
22150
22165
|
};
|
|
22151
22166
|
calcAutoSize(blockNodes) {
|
|
22152
22167
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22153
|
-
const container = this.
|
|
22168
|
+
const container = this.getTransformedContainer();
|
|
22154
22169
|
const containerWidth = container.getWidth();
|
|
22155
22170
|
const containerHeight = container.getHeight();
|
|
22156
|
-
const
|
|
22157
|
-
|
|
22171
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
22172
|
+
let effectiveWidth = containerWidth;
|
|
22173
|
+
let effectiveHeight = containerHeight;
|
|
22174
|
+
if (worldMatrix) {
|
|
22175
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22176
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
22177
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
22178
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
22179
|
+
}
|
|
22180
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
22181
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
22182
|
+
if (worldMatrix) {
|
|
22183
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
22184
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
22185
|
+
}
|
|
22186
|
+
return worldTextScale;
|
|
22158
22187
|
}
|
|
22159
22188
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
22160
22189
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
22161
|
-
const container = this.
|
|
22190
|
+
const container = this.getTransformedContainer();
|
|
22162
22191
|
const containerWidth = container.getWidth();
|
|
22163
22192
|
const containerHeight = container.getHeight();
|
|
22164
22193
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -22280,13 +22309,6 @@ class RichText extends BaseItem {
|
|
|
22280
22309
|
}
|
|
22281
22310
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22282
22311
|
}
|
|
22283
|
-
getLayoutContainer() {
|
|
22284
|
-
if (this.insideOf === "Frame") {
|
|
22285
|
-
return this.getTransformedContainer();
|
|
22286
|
-
}
|
|
22287
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
22288
|
-
return this.container.getTransformed(matrix);
|
|
22289
|
-
}
|
|
22290
22312
|
emitWithoutApplying = (op) => {
|
|
22291
22313
|
if (this.board.events) {
|
|
22292
22314
|
this.board.events.emit(op);
|
|
@@ -22302,7 +22324,7 @@ class RichText extends BaseItem {
|
|
|
22302
22324
|
apply(op) {
|
|
22303
22325
|
switch (op.class) {
|
|
22304
22326
|
case "Transformation":
|
|
22305
|
-
|
|
22327
|
+
super.apply(op);
|
|
22306
22328
|
break;
|
|
22307
22329
|
case "LinkTo":
|
|
22308
22330
|
this.linkTo.apply(op);
|
|
@@ -36253,7 +36275,6 @@ class AINode extends BaseItem {
|
|
|
36253
36275
|
this.subject.publish(this);
|
|
36254
36276
|
});
|
|
36255
36277
|
this.text.insideOf = "AINode";
|
|
36256
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
36257
36278
|
this.transformPath();
|
|
36258
36279
|
}
|
|
36259
36280
|
transformPath() {
|
|
@@ -39850,7 +39871,7 @@ class Shape extends BaseItem {
|
|
|
39850
39871
|
this.text.apply(op);
|
|
39851
39872
|
break;
|
|
39852
39873
|
case "Transformation":
|
|
39853
|
-
|
|
39874
|
+
super.apply(op);
|
|
39854
39875
|
break;
|
|
39855
39876
|
case "LinkTo":
|
|
39856
39877
|
this.linkTo.apply(op);
|
|
@@ -41627,7 +41648,7 @@ class VideoItem extends BaseItem {
|
|
|
41627
41648
|
apply(op) {
|
|
41628
41649
|
switch (op.class) {
|
|
41629
41650
|
case "Transformation":
|
|
41630
|
-
|
|
41651
|
+
super.apply(op);
|
|
41631
41652
|
break;
|
|
41632
41653
|
case "LinkTo":
|
|
41633
41654
|
this.linkTo.apply(op);
|
|
@@ -42103,7 +42124,7 @@ class AudioItem extends BaseItem {
|
|
|
42103
42124
|
apply(op) {
|
|
42104
42125
|
switch (op.class) {
|
|
42105
42126
|
case "Transformation":
|
|
42106
|
-
|
|
42127
|
+
super.apply(op);
|
|
42107
42128
|
break;
|
|
42108
42129
|
case "LinkTo":
|
|
42109
42130
|
this.linkTo.apply(op);
|
|
@@ -42297,7 +42318,7 @@ class Placeholder extends BaseItem {
|
|
|
42297
42318
|
this.updateMbr();
|
|
42298
42319
|
break;
|
|
42299
42320
|
case "Transformation":
|
|
42300
|
-
|
|
42321
|
+
super.apply(op);
|
|
42301
42322
|
break;
|
|
42302
42323
|
default:
|
|
42303
42324
|
return;
|
|
@@ -42724,7 +42745,7 @@ class ImageItem extends BaseItem {
|
|
|
42724
42745
|
apply(op) {
|
|
42725
42746
|
switch (op.class) {
|
|
42726
42747
|
case "Transformation":
|
|
42727
|
-
|
|
42748
|
+
super.apply(op);
|
|
42728
42749
|
break;
|
|
42729
42750
|
case "LinkTo":
|
|
42730
42751
|
this.linkTo.apply(op);
|
|
@@ -43152,7 +43173,7 @@ class Drawing extends BaseItem {
|
|
|
43152
43173
|
this.updateMbr();
|
|
43153
43174
|
break;
|
|
43154
43175
|
case "Transformation":
|
|
43155
|
-
|
|
43176
|
+
super.apply(op);
|
|
43156
43177
|
break;
|
|
43157
43178
|
case "LinkTo":
|
|
43158
43179
|
this.linkTo.apply(op);
|
|
@@ -43315,7 +43336,7 @@ class Group extends BaseItem {
|
|
|
43315
43336
|
}
|
|
43316
43337
|
break;
|
|
43317
43338
|
case "Transformation":
|
|
43318
|
-
|
|
43339
|
+
super.apply(op);
|
|
43319
43340
|
break;
|
|
43320
43341
|
default:
|
|
43321
43342
|
return;
|
package/dist/esm/node.js
CHANGED
|
@@ -20109,9 +20109,15 @@ class TransformationCommand {
|
|
|
20109
20109
|
transformation;
|
|
20110
20110
|
operation;
|
|
20111
20111
|
reverse;
|
|
20112
|
-
|
|
20112
|
+
itemsMap = new Map;
|
|
20113
|
+
constructor(transformation, operation, items) {
|
|
20113
20114
|
this.transformation = transformation;
|
|
20114
20115
|
this.operation = operation;
|
|
20116
|
+
if (items) {
|
|
20117
|
+
for (const item of items) {
|
|
20118
|
+
this.itemsMap.set(item.transformation, item);
|
|
20119
|
+
}
|
|
20120
|
+
}
|
|
20115
20121
|
this.reverse = this.getReverse();
|
|
20116
20122
|
}
|
|
20117
20123
|
merge(op) {
|
|
@@ -20121,12 +20127,22 @@ class TransformationCommand {
|
|
|
20121
20127
|
}
|
|
20122
20128
|
apply() {
|
|
20123
20129
|
for (const transformation of this.transformation) {
|
|
20124
|
-
|
|
20130
|
+
const item = this.itemsMap.get(transformation);
|
|
20131
|
+
if (item) {
|
|
20132
|
+
item.apply(this.operation);
|
|
20133
|
+
} else {
|
|
20134
|
+
transformation.apply(this.operation);
|
|
20135
|
+
}
|
|
20125
20136
|
}
|
|
20126
20137
|
}
|
|
20127
20138
|
revert() {
|
|
20128
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
20129
|
-
item.
|
|
20139
|
+
this.reverse.forEach(({ item: transformation, operation }) => {
|
|
20140
|
+
const item = this.itemsMap.get(transformation);
|
|
20141
|
+
if (item) {
|
|
20142
|
+
item.apply(operation);
|
|
20143
|
+
} else {
|
|
20144
|
+
transformation.apply(operation);
|
|
20145
|
+
}
|
|
20130
20146
|
});
|
|
20131
20147
|
}
|
|
20132
20148
|
getReverse() {
|
|
@@ -21581,7 +21597,7 @@ class Comment {
|
|
|
21581
21597
|
this.transform();
|
|
21582
21598
|
break;
|
|
21583
21599
|
case "Transformation":
|
|
21584
|
-
|
|
21600
|
+
super.apply(op);
|
|
21585
21601
|
break;
|
|
21586
21602
|
default:
|
|
21587
21603
|
return;
|
|
@@ -22110,7 +22126,7 @@ function createRichTextCommand(items, operation, board) {
|
|
|
22110
22126
|
}
|
|
22111
22127
|
}
|
|
22112
22128
|
function createTransformationCommand(items, operation) {
|
|
22113
|
-
return new TransformationCommand(items.map((item) => item.transformation), operation);
|
|
22129
|
+
return new TransformationCommand(items.map((item) => item.transformation), operation, items);
|
|
22114
22130
|
}
|
|
22115
22131
|
function createLinkToCommand(items, operation) {
|
|
22116
22132
|
return new LinkToCommand(items.map((item) => item.linkTo), operation);
|
|
@@ -24156,10 +24172,9 @@ class BaseItem extends Mbr {
|
|
|
24156
24172
|
return this.getMbr();
|
|
24157
24173
|
}
|
|
24158
24174
|
const container = this.board.items.getById(this.parent);
|
|
24159
|
-
if (!container)
|
|
24175
|
+
if (!container)
|
|
24160
24176
|
return this.getMbr();
|
|
24161
|
-
|
|
24162
|
-
const containerWorldMatrix = container.getWorldMatrix();
|
|
24177
|
+
const worldMatrix = container.getWorldMatrix();
|
|
24163
24178
|
const local = this.getMbr();
|
|
24164
24179
|
const corners = [
|
|
24165
24180
|
new Point(local.left, local.top),
|
|
@@ -24168,7 +24183,7 @@ class BaseItem extends Mbr {
|
|
|
24168
24183
|
new Point(local.left, local.bottom)
|
|
24169
24184
|
];
|
|
24170
24185
|
for (const c of corners)
|
|
24171
|
-
|
|
24186
|
+
worldMatrix.apply(c);
|
|
24172
24187
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
24173
24188
|
}
|
|
24174
24189
|
applyAddChildren(childIds) {
|
|
@@ -24617,15 +24632,29 @@ class RichText extends BaseItem {
|
|
|
24617
24632
|
};
|
|
24618
24633
|
calcAutoSize(blockNodes) {
|
|
24619
24634
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
24620
|
-
const container = this.
|
|
24635
|
+
const container = this.getTransformedContainer();
|
|
24621
24636
|
const containerWidth = container.getWidth();
|
|
24622
24637
|
const containerHeight = container.getHeight();
|
|
24623
|
-
const
|
|
24624
|
-
|
|
24638
|
+
const worldMatrix = this.worldMatrixGetter?.();
|
|
24639
|
+
let effectiveWidth = containerWidth;
|
|
24640
|
+
let effectiveHeight = containerHeight;
|
|
24641
|
+
if (worldMatrix) {
|
|
24642
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
24643
|
+
const localScaleY = this.transformation.getScale().y || 1;
|
|
24644
|
+
effectiveWidth = containerWidth * (worldMatrix.scaleX / localScaleX);
|
|
24645
|
+
effectiveHeight = containerHeight * (worldMatrix.scaleY / localScaleY);
|
|
24646
|
+
}
|
|
24647
|
+
const optimal = findOptimalMaxWidthForTextAutoSize(nodes, effectiveWidth, effectiveHeight, effectiveWidth);
|
|
24648
|
+
const worldTextScale = Math.min(effectiveWidth / optimal.bestMaxWidth, effectiveHeight / optimal.bestMaxHeight);
|
|
24649
|
+
if (worldMatrix) {
|
|
24650
|
+
const localScaleX = this.transformation.getScale().x || 1;
|
|
24651
|
+
return worldTextScale * localScaleX / worldMatrix.scaleX;
|
|
24652
|
+
}
|
|
24653
|
+
return worldTextScale;
|
|
24625
24654
|
}
|
|
24626
24655
|
applyAutoSizeScale(textScale, blockNodes) {
|
|
24627
24656
|
const nodes = blockNodes ? blockNodes : this.getBlockNodes();
|
|
24628
|
-
const container = this.
|
|
24657
|
+
const container = this.getTransformedContainer();
|
|
24629
24658
|
const containerWidth = container.getWidth();
|
|
24630
24659
|
const containerHeight = container.getHeight();
|
|
24631
24660
|
this.layoutNodes = getBlockNodes(nodes, containerWidth / textScale);
|
|
@@ -24747,13 +24776,6 @@ class RichText extends BaseItem {
|
|
|
24747
24776
|
}
|
|
24748
24777
|
return this.container.getTransformed(this.transformation.toMatrix());
|
|
24749
24778
|
}
|
|
24750
|
-
getLayoutContainer() {
|
|
24751
|
-
if (this.insideOf === "Frame") {
|
|
24752
|
-
return this.getTransformedContainer();
|
|
24753
|
-
}
|
|
24754
|
-
const matrix = this.worldMatrixGetter ? this.worldMatrixGetter() : this.transformation.toMatrix();
|
|
24755
|
-
return this.container.getTransformed(matrix);
|
|
24756
|
-
}
|
|
24757
24779
|
emitWithoutApplying = (op) => {
|
|
24758
24780
|
if (this.board.events) {
|
|
24759
24781
|
this.board.events.emit(op);
|
|
@@ -24769,7 +24791,7 @@ class RichText extends BaseItem {
|
|
|
24769
24791
|
apply(op) {
|
|
24770
24792
|
switch (op.class) {
|
|
24771
24793
|
case "Transformation":
|
|
24772
|
-
|
|
24794
|
+
super.apply(op);
|
|
24773
24795
|
break;
|
|
24774
24796
|
case "LinkTo":
|
|
24775
24797
|
this.linkTo.apply(op);
|
|
@@ -38721,7 +38743,6 @@ class AINode extends BaseItem {
|
|
|
38721
38743
|
this.subject.publish(this);
|
|
38722
38744
|
});
|
|
38723
38745
|
this.text.insideOf = "AINode";
|
|
38724
|
-
this.text.worldMatrixGetter = () => this.getWorldMatrix();
|
|
38725
38746
|
this.transformPath();
|
|
38726
38747
|
}
|
|
38727
38748
|
transformPath() {
|
|
@@ -42318,7 +42339,7 @@ class Shape extends BaseItem {
|
|
|
42318
42339
|
this.text.apply(op);
|
|
42319
42340
|
break;
|
|
42320
42341
|
case "Transformation":
|
|
42321
|
-
|
|
42342
|
+
super.apply(op);
|
|
42322
42343
|
break;
|
|
42323
42344
|
case "LinkTo":
|
|
42324
42345
|
this.linkTo.apply(op);
|
|
@@ -44095,7 +44116,7 @@ class VideoItem extends BaseItem {
|
|
|
44095
44116
|
apply(op) {
|
|
44096
44117
|
switch (op.class) {
|
|
44097
44118
|
case "Transformation":
|
|
44098
|
-
|
|
44119
|
+
super.apply(op);
|
|
44099
44120
|
break;
|
|
44100
44121
|
case "LinkTo":
|
|
44101
44122
|
this.linkTo.apply(op);
|
|
@@ -44571,7 +44592,7 @@ class AudioItem extends BaseItem {
|
|
|
44571
44592
|
apply(op) {
|
|
44572
44593
|
switch (op.class) {
|
|
44573
44594
|
case "Transformation":
|
|
44574
|
-
|
|
44595
|
+
super.apply(op);
|
|
44575
44596
|
break;
|
|
44576
44597
|
case "LinkTo":
|
|
44577
44598
|
this.linkTo.apply(op);
|
|
@@ -44765,7 +44786,7 @@ class Placeholder extends BaseItem {
|
|
|
44765
44786
|
this.updateMbr();
|
|
44766
44787
|
break;
|
|
44767
44788
|
case "Transformation":
|
|
44768
|
-
|
|
44789
|
+
super.apply(op);
|
|
44769
44790
|
break;
|
|
44770
44791
|
default:
|
|
44771
44792
|
return;
|
|
@@ -45192,7 +45213,7 @@ class ImageItem extends BaseItem {
|
|
|
45192
45213
|
apply(op) {
|
|
45193
45214
|
switch (op.class) {
|
|
45194
45215
|
case "Transformation":
|
|
45195
|
-
|
|
45216
|
+
super.apply(op);
|
|
45196
45217
|
break;
|
|
45197
45218
|
case "LinkTo":
|
|
45198
45219
|
this.linkTo.apply(op);
|
|
@@ -45620,7 +45641,7 @@ class Drawing extends BaseItem {
|
|
|
45620
45641
|
this.updateMbr();
|
|
45621
45642
|
break;
|
|
45622
45643
|
case "Transformation":
|
|
45623
|
-
|
|
45644
|
+
super.apply(op);
|
|
45624
45645
|
break;
|
|
45625
45646
|
case "LinkTo":
|
|
45626
45647
|
this.linkTo.apply(op);
|
|
@@ -45783,7 +45804,7 @@ class Group extends BaseItem {
|
|
|
45783
45804
|
}
|
|
45784
45805
|
break;
|
|
45785
45806
|
case "Transformation":
|
|
45786
|
-
|
|
45807
|
+
super.apply(op);
|
|
45787
45808
|
break;
|
|
45788
45809
|
default:
|
|
45789
45810
|
return;
|
|
@@ -52,7 +52,6 @@ export declare class RichText extends BaseItem {
|
|
|
52
52
|
private _onLimitReached;
|
|
53
53
|
private shrinkWidth;
|
|
54
54
|
prevMbr: Mbr | null;
|
|
55
|
-
/** When set, used by calcAutoSize/applyAutoSizeScale to get world-space container dimensions. */
|
|
56
55
|
worldMatrixGetter?: () => Matrix;
|
|
57
56
|
rtCounter: number;
|
|
58
57
|
constructor(board: Board, container: Mbr, id?: string, transformation?: Transformation, linkTo?: LinkTo, placeholderText?: string, isInShape?: boolean, autoSize?: boolean, insideOf?: ItemType | undefined, initialTextStyles?: DefaultTextStyles);
|
|
@@ -96,13 +95,6 @@ export declare class RichText extends BaseItem {
|
|
|
96
95
|
* Get the container that would be used to align the CanvasDocument.
|
|
97
96
|
*/
|
|
98
97
|
getTransformedContainer(): Mbr;
|
|
99
|
-
/**
|
|
100
|
-
* Like getTransformedContainer() but uses the world-space matrix when this
|
|
101
|
-
* RichText belongs to a nested item (e.g. Sticker inside a Frame). This
|
|
102
|
-
* ensures calcAutoSize and applyAutoSizeScale measure the correct pixel
|
|
103
|
-
* dimensions instead of the compressed local-space dimensions.
|
|
104
|
-
*/
|
|
105
|
-
private getLayoutContainer;
|
|
106
98
|
emitWithoutApplying: (op: RichTextOperation) => void;
|
|
107
99
|
emit: (op: RichTextOperation) => void;
|
|
108
100
|
apply(op: Operation): void;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Transformation } from "./Transformation";
|
|
2
2
|
import { TransformationOperation } from "./TransformationOperations";
|
|
3
|
-
import { Command } from "../../Events";
|
|
3
|
+
import { Command, Operation } from "../../Events";
|
|
4
|
+
/** Minimal interface to avoid circular import with BaseItem/Item */
|
|
5
|
+
interface TransformableItem {
|
|
6
|
+
apply(op: Operation): void;
|
|
7
|
+
transformation: Transformation;
|
|
8
|
+
}
|
|
4
9
|
export declare class TransformationCommand implements Command {
|
|
5
10
|
private transformation;
|
|
6
11
|
private operation;
|
|
@@ -8,7 +13,9 @@ export declare class TransformationCommand implements Command {
|
|
|
8
13
|
item: Transformation;
|
|
9
14
|
operation: TransformationOperation;
|
|
10
15
|
}[];
|
|
11
|
-
|
|
16
|
+
/** Map from Transformation → Item, populated when items are passed to the constructor. */
|
|
17
|
+
private itemsMap;
|
|
18
|
+
constructor(transformation: Transformation[], operation: TransformationOperation, items?: TransformableItem[]);
|
|
12
19
|
merge(op: TransformationOperation): this;
|
|
13
20
|
apply(): void;
|
|
14
21
|
revert(): void;
|
|
@@ -17,3 +24,4 @@ export declare class TransformationCommand implements Command {
|
|
|
17
24
|
operation: TransformationOperation;
|
|
18
25
|
}[];
|
|
19
26
|
}
|
|
27
|
+
export {};
|