microboard-temp 0.4.54 → 0.4.56
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 +16 -36
- package/dist/cjs/index.js +16 -36
- package/dist/cjs/node.js +16 -36
- package/dist/esm/browser.js +16 -36
- package/dist/esm/index.js +16 -36
- package/dist/esm/node.js +16 -36
- package/dist/types/Items/Frame/Frame.d.ts +0 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -20423,7 +20423,7 @@ class Container extends Mbr {
|
|
|
20423
20423
|
layer;
|
|
20424
20424
|
zIndex;
|
|
20425
20425
|
constructor(id, item, layer, zIndex) {
|
|
20426
|
-
const rect = item.
|
|
20426
|
+
const rect = item.getMbrWithChildren();
|
|
20427
20427
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
20428
20428
|
this.id = id;
|
|
20429
20429
|
this.item = item;
|
|
@@ -20533,7 +20533,7 @@ class LayeredIndex {
|
|
|
20533
20533
|
if (!this.isT(container.item)) {
|
|
20534
20534
|
return;
|
|
20535
20535
|
}
|
|
20536
|
-
const bounds = container.item.
|
|
20536
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20537
20537
|
this.remove(container.item);
|
|
20538
20538
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20539
20539
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20561,7 +20561,7 @@ class LayeredIndex {
|
|
|
20561
20561
|
if (!this.isT(container.item)) {
|
|
20562
20562
|
return;
|
|
20563
20563
|
}
|
|
20564
|
-
const bounds = container.item.
|
|
20564
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20565
20565
|
this.remove(container.item);
|
|
20566
20566
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20567
20567
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20587,7 +20587,7 @@ class LayeredIndex {
|
|
|
20587
20587
|
}
|
|
20588
20588
|
insert(item) {
|
|
20589
20589
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
20590
|
-
const bounds = item.
|
|
20590
|
+
const bounds = item.getMbrWithChildren();
|
|
20591
20591
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20592
20592
|
if (inBounds.length === 0) {
|
|
20593
20593
|
return this.insertContainer(toInsert);
|
|
@@ -20730,9 +20730,9 @@ class SpatialIndex {
|
|
|
20730
20730
|
return;
|
|
20731
20731
|
}
|
|
20732
20732
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20733
|
-
this.Mbr = item.
|
|
20733
|
+
this.Mbr = item.getMbr().copy();
|
|
20734
20734
|
} else {
|
|
20735
|
-
this.Mbr.combine([item.
|
|
20735
|
+
this.Mbr.combine([item.getMbr()]);
|
|
20736
20736
|
}
|
|
20737
20737
|
item.subject.subscribe(this.change);
|
|
20738
20738
|
this.subject.publish(this.items);
|
|
@@ -21588,7 +21588,7 @@ class BaseItem extends Mbr {
|
|
|
21588
21588
|
if (!this.index) {
|
|
21589
21589
|
return this.getMbr();
|
|
21590
21590
|
}
|
|
21591
|
-
return this.getMbr().combine(this.index.
|
|
21591
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
21592
21592
|
}
|
|
21593
21593
|
getPath() {
|
|
21594
21594
|
return new Path(this.getMbr().getLines());
|
|
@@ -40245,26 +40245,6 @@ class Frame2 extends BaseItem {
|
|
|
40245
40245
|
this.board = board;
|
|
40246
40246
|
return this;
|
|
40247
40247
|
}
|
|
40248
|
-
applyAddChild(childId, noWarn = false) {
|
|
40249
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
40250
|
-
children.forEach((child) => {
|
|
40251
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
40252
|
-
const foundItem = this.getItemById(child);
|
|
40253
|
-
if (!this.children.includes(child) && foundItem) {
|
|
40254
|
-
this.children.push(child);
|
|
40255
|
-
foundItem.parent = this.getId();
|
|
40256
|
-
this.updateMbr();
|
|
40257
|
-
this.subject.publish(this);
|
|
40258
|
-
} else if (!foundItem && !noWarn) {
|
|
40259
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
40260
|
-
}
|
|
40261
|
-
}
|
|
40262
|
-
});
|
|
40263
|
-
}
|
|
40264
|
-
applyRemoveChild(childId) {
|
|
40265
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
40266
|
-
this.subject.publish(this);
|
|
40267
|
-
}
|
|
40268
40248
|
getLinkTo() {
|
|
40269
40249
|
return this.linkTo.link;
|
|
40270
40250
|
}
|
|
@@ -40405,7 +40385,7 @@ class Frame2 extends BaseItem {
|
|
|
40405
40385
|
this.transformPath();
|
|
40406
40386
|
}
|
|
40407
40387
|
if (data.children) {
|
|
40408
|
-
this.
|
|
40388
|
+
this.applyAddChildren(data.children);
|
|
40409
40389
|
}
|
|
40410
40390
|
if (data.text) {
|
|
40411
40391
|
this.text.deserialize(data.text);
|
|
@@ -40451,9 +40431,9 @@ class Frame2 extends BaseItem {
|
|
|
40451
40431
|
} else if (op.method === "setFrameType") {
|
|
40452
40432
|
this.applyFrameType(op.shapeType);
|
|
40453
40433
|
} else if (op.method === "addChild") {
|
|
40454
|
-
this.
|
|
40434
|
+
this.applyAddChildren(op.childId);
|
|
40455
40435
|
} else if (op.method === "removeChild") {
|
|
40456
|
-
this.
|
|
40436
|
+
this.applyRemoveChildren(op.childId);
|
|
40457
40437
|
}
|
|
40458
40438
|
break;
|
|
40459
40439
|
case "RichText":
|
|
@@ -40529,10 +40509,10 @@ class Frame2 extends BaseItem {
|
|
|
40529
40509
|
const child = this.board?.items.getById(childId);
|
|
40530
40510
|
if (child) {
|
|
40531
40511
|
if (this.handleNesting(child)) {
|
|
40532
|
-
this.
|
|
40512
|
+
this.applyAddChildren([child.getId()]);
|
|
40533
40513
|
child.parent = this.getId();
|
|
40534
40514
|
} else {
|
|
40535
|
-
this.
|
|
40515
|
+
this.applyRemoveChildren([child.getId()]);
|
|
40536
40516
|
child.parent = "Board";
|
|
40537
40517
|
}
|
|
40538
40518
|
}
|
|
@@ -40541,7 +40521,7 @@ class Frame2 extends BaseItem {
|
|
|
40541
40521
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
40542
40522
|
if (item.parent === "Board") {
|
|
40543
40523
|
if (this.handleNesting(item)) {
|
|
40544
|
-
this.
|
|
40524
|
+
this.applyAddChildren([item.getId()]);
|
|
40545
40525
|
item.parent = this.getId();
|
|
40546
40526
|
}
|
|
40547
40527
|
}
|
|
@@ -43958,7 +43938,7 @@ class AddFrame extends BoardTool {
|
|
|
43958
43938
|
child.parent = this.frame.getId();
|
|
43959
43939
|
return child.getId();
|
|
43960
43940
|
});
|
|
43961
|
-
this.frame.
|
|
43941
|
+
this.frame.applyAddChildren(childrenIds);
|
|
43962
43942
|
this.frame.subject.publish(this.frame);
|
|
43963
43943
|
}
|
|
43964
43944
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -53708,7 +53688,7 @@ class Board {
|
|
|
53708
53688
|
}
|
|
53709
53689
|
for (const key in createdFrames) {
|
|
53710
53690
|
const { item, itemData } = createdFrames[key];
|
|
53711
|
-
item.
|
|
53691
|
+
item.applyAddChildren(itemData.children);
|
|
53712
53692
|
}
|
|
53713
53693
|
}
|
|
53714
53694
|
deserialize(snapshot) {
|
|
@@ -53744,7 +53724,7 @@ class Board {
|
|
|
53744
53724
|
}
|
|
53745
53725
|
for (const key in createdFrames) {
|
|
53746
53726
|
const { item, itemData } = createdFrames[key];
|
|
53747
|
-
item.
|
|
53727
|
+
item.applyAddChildren(itemData.children);
|
|
53748
53728
|
}
|
|
53749
53729
|
this.events?.log.deserialize(events);
|
|
53750
53730
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -20423,7 +20423,7 @@ class Container extends Mbr {
|
|
|
20423
20423
|
layer;
|
|
20424
20424
|
zIndex;
|
|
20425
20425
|
constructor(id, item, layer, zIndex) {
|
|
20426
|
-
const rect = item.
|
|
20426
|
+
const rect = item.getMbrWithChildren();
|
|
20427
20427
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
20428
20428
|
this.id = id;
|
|
20429
20429
|
this.item = item;
|
|
@@ -20533,7 +20533,7 @@ class LayeredIndex {
|
|
|
20533
20533
|
if (!this.isT(container.item)) {
|
|
20534
20534
|
return;
|
|
20535
20535
|
}
|
|
20536
|
-
const bounds = container.item.
|
|
20536
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20537
20537
|
this.remove(container.item);
|
|
20538
20538
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20539
20539
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20561,7 +20561,7 @@ class LayeredIndex {
|
|
|
20561
20561
|
if (!this.isT(container.item)) {
|
|
20562
20562
|
return;
|
|
20563
20563
|
}
|
|
20564
|
-
const bounds = container.item.
|
|
20564
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20565
20565
|
this.remove(container.item);
|
|
20566
20566
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20567
20567
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20587,7 +20587,7 @@ class LayeredIndex {
|
|
|
20587
20587
|
}
|
|
20588
20588
|
insert(item) {
|
|
20589
20589
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
20590
|
-
const bounds = item.
|
|
20590
|
+
const bounds = item.getMbrWithChildren();
|
|
20591
20591
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20592
20592
|
if (inBounds.length === 0) {
|
|
20593
20593
|
return this.insertContainer(toInsert);
|
|
@@ -20730,9 +20730,9 @@ class SpatialIndex {
|
|
|
20730
20730
|
return;
|
|
20731
20731
|
}
|
|
20732
20732
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20733
|
-
this.Mbr = item.
|
|
20733
|
+
this.Mbr = item.getMbr().copy();
|
|
20734
20734
|
} else {
|
|
20735
|
-
this.Mbr.combine([item.
|
|
20735
|
+
this.Mbr.combine([item.getMbr()]);
|
|
20736
20736
|
}
|
|
20737
20737
|
item.subject.subscribe(this.change);
|
|
20738
20738
|
this.subject.publish(this.items);
|
|
@@ -21588,7 +21588,7 @@ class BaseItem extends Mbr {
|
|
|
21588
21588
|
if (!this.index) {
|
|
21589
21589
|
return this.getMbr();
|
|
21590
21590
|
}
|
|
21591
|
-
return this.getMbr().combine(this.index.
|
|
21591
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
21592
21592
|
}
|
|
21593
21593
|
getPath() {
|
|
21594
21594
|
return new Path(this.getMbr().getLines());
|
|
@@ -40245,26 +40245,6 @@ class Frame2 extends BaseItem {
|
|
|
40245
40245
|
this.board = board;
|
|
40246
40246
|
return this;
|
|
40247
40247
|
}
|
|
40248
|
-
applyAddChild(childId, noWarn = false) {
|
|
40249
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
40250
|
-
children.forEach((child) => {
|
|
40251
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
40252
|
-
const foundItem = this.getItemById(child);
|
|
40253
|
-
if (!this.children.includes(child) && foundItem) {
|
|
40254
|
-
this.children.push(child);
|
|
40255
|
-
foundItem.parent = this.getId();
|
|
40256
|
-
this.updateMbr();
|
|
40257
|
-
this.subject.publish(this);
|
|
40258
|
-
} else if (!foundItem && !noWarn) {
|
|
40259
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
40260
|
-
}
|
|
40261
|
-
}
|
|
40262
|
-
});
|
|
40263
|
-
}
|
|
40264
|
-
applyRemoveChild(childId) {
|
|
40265
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
40266
|
-
this.subject.publish(this);
|
|
40267
|
-
}
|
|
40268
40248
|
getLinkTo() {
|
|
40269
40249
|
return this.linkTo.link;
|
|
40270
40250
|
}
|
|
@@ -40405,7 +40385,7 @@ class Frame2 extends BaseItem {
|
|
|
40405
40385
|
this.transformPath();
|
|
40406
40386
|
}
|
|
40407
40387
|
if (data.children) {
|
|
40408
|
-
this.
|
|
40388
|
+
this.applyAddChildren(data.children);
|
|
40409
40389
|
}
|
|
40410
40390
|
if (data.text) {
|
|
40411
40391
|
this.text.deserialize(data.text);
|
|
@@ -40451,9 +40431,9 @@ class Frame2 extends BaseItem {
|
|
|
40451
40431
|
} else if (op.method === "setFrameType") {
|
|
40452
40432
|
this.applyFrameType(op.shapeType);
|
|
40453
40433
|
} else if (op.method === "addChild") {
|
|
40454
|
-
this.
|
|
40434
|
+
this.applyAddChildren(op.childId);
|
|
40455
40435
|
} else if (op.method === "removeChild") {
|
|
40456
|
-
this.
|
|
40436
|
+
this.applyRemoveChildren(op.childId);
|
|
40457
40437
|
}
|
|
40458
40438
|
break;
|
|
40459
40439
|
case "RichText":
|
|
@@ -40529,10 +40509,10 @@ class Frame2 extends BaseItem {
|
|
|
40529
40509
|
const child = this.board?.items.getById(childId);
|
|
40530
40510
|
if (child) {
|
|
40531
40511
|
if (this.handleNesting(child)) {
|
|
40532
|
-
this.
|
|
40512
|
+
this.applyAddChildren([child.getId()]);
|
|
40533
40513
|
child.parent = this.getId();
|
|
40534
40514
|
} else {
|
|
40535
|
-
this.
|
|
40515
|
+
this.applyRemoveChildren([child.getId()]);
|
|
40536
40516
|
child.parent = "Board";
|
|
40537
40517
|
}
|
|
40538
40518
|
}
|
|
@@ -40541,7 +40521,7 @@ class Frame2 extends BaseItem {
|
|
|
40541
40521
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
40542
40522
|
if (item.parent === "Board") {
|
|
40543
40523
|
if (this.handleNesting(item)) {
|
|
40544
|
-
this.
|
|
40524
|
+
this.applyAddChildren([item.getId()]);
|
|
40545
40525
|
item.parent = this.getId();
|
|
40546
40526
|
}
|
|
40547
40527
|
}
|
|
@@ -43958,7 +43938,7 @@ class AddFrame extends BoardTool {
|
|
|
43958
43938
|
child.parent = this.frame.getId();
|
|
43959
43939
|
return child.getId();
|
|
43960
43940
|
});
|
|
43961
|
-
this.frame.
|
|
43941
|
+
this.frame.applyAddChildren(childrenIds);
|
|
43962
43942
|
this.frame.subject.publish(this.frame);
|
|
43963
43943
|
}
|
|
43964
43944
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -53708,7 +53688,7 @@ class Board {
|
|
|
53708
53688
|
}
|
|
53709
53689
|
for (const key in createdFrames) {
|
|
53710
53690
|
const { item, itemData } = createdFrames[key];
|
|
53711
|
-
item.
|
|
53691
|
+
item.applyAddChildren(itemData.children);
|
|
53712
53692
|
}
|
|
53713
53693
|
}
|
|
53714
53694
|
deserialize(snapshot) {
|
|
@@ -53744,7 +53724,7 @@ class Board {
|
|
|
53744
53724
|
}
|
|
53745
53725
|
for (const key in createdFrames) {
|
|
53746
53726
|
const { item, itemData } = createdFrames[key];
|
|
53747
|
-
item.
|
|
53727
|
+
item.applyAddChildren(itemData.children);
|
|
53748
53728
|
}
|
|
53749
53729
|
this.events?.log.deserialize(events);
|
|
53750
53730
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -22895,7 +22895,7 @@ class Container extends Mbr {
|
|
|
22895
22895
|
layer;
|
|
22896
22896
|
zIndex;
|
|
22897
22897
|
constructor(id, item, layer, zIndex) {
|
|
22898
|
-
const rect = item.
|
|
22898
|
+
const rect = item.getMbrWithChildren();
|
|
22899
22899
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
22900
22900
|
this.id = id;
|
|
22901
22901
|
this.item = item;
|
|
@@ -23005,7 +23005,7 @@ class LayeredIndex {
|
|
|
23005
23005
|
if (!this.isT(container.item)) {
|
|
23006
23006
|
return;
|
|
23007
23007
|
}
|
|
23008
|
-
const bounds = container.item.
|
|
23008
|
+
const bounds = container.item.getMbrWithChildren();
|
|
23009
23009
|
this.remove(container.item);
|
|
23010
23010
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
23011
23011
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -23033,7 +23033,7 @@ class LayeredIndex {
|
|
|
23033
23033
|
if (!this.isT(container.item)) {
|
|
23034
23034
|
return;
|
|
23035
23035
|
}
|
|
23036
|
-
const bounds = container.item.
|
|
23036
|
+
const bounds = container.item.getMbrWithChildren();
|
|
23037
23037
|
this.remove(container.item);
|
|
23038
23038
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
23039
23039
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -23059,7 +23059,7 @@ class LayeredIndex {
|
|
|
23059
23059
|
}
|
|
23060
23060
|
insert(item) {
|
|
23061
23061
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
23062
|
-
const bounds = item.
|
|
23062
|
+
const bounds = item.getMbrWithChildren();
|
|
23063
23063
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
23064
23064
|
if (inBounds.length === 0) {
|
|
23065
23065
|
return this.insertContainer(toInsert);
|
|
@@ -23202,9 +23202,9 @@ class SpatialIndex {
|
|
|
23202
23202
|
return;
|
|
23203
23203
|
}
|
|
23204
23204
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
23205
|
-
this.Mbr = item.
|
|
23205
|
+
this.Mbr = item.getMbr().copy();
|
|
23206
23206
|
} else {
|
|
23207
|
-
this.Mbr.combine([item.
|
|
23207
|
+
this.Mbr.combine([item.getMbr()]);
|
|
23208
23208
|
}
|
|
23209
23209
|
item.subject.subscribe(this.change);
|
|
23210
23210
|
this.subject.publish(this.items);
|
|
@@ -24060,7 +24060,7 @@ class BaseItem extends Mbr {
|
|
|
24060
24060
|
if (!this.index) {
|
|
24061
24061
|
return this.getMbr();
|
|
24062
24062
|
}
|
|
24063
|
-
return this.getMbr().combine(this.index.
|
|
24063
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
24064
24064
|
}
|
|
24065
24065
|
getPath() {
|
|
24066
24066
|
return new Path(this.getMbr().getLines());
|
|
@@ -42718,26 +42718,6 @@ class Frame2 extends BaseItem {
|
|
|
42718
42718
|
this.board = board;
|
|
42719
42719
|
return this;
|
|
42720
42720
|
}
|
|
42721
|
-
applyAddChild(childId, noWarn = false) {
|
|
42722
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
42723
|
-
children.forEach((child) => {
|
|
42724
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
42725
|
-
const foundItem = this.getItemById(child);
|
|
42726
|
-
if (!this.children.includes(child) && foundItem) {
|
|
42727
|
-
this.children.push(child);
|
|
42728
|
-
foundItem.parent = this.getId();
|
|
42729
|
-
this.updateMbr();
|
|
42730
|
-
this.subject.publish(this);
|
|
42731
|
-
} else if (!foundItem && !noWarn) {
|
|
42732
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
42733
|
-
}
|
|
42734
|
-
}
|
|
42735
|
-
});
|
|
42736
|
-
}
|
|
42737
|
-
applyRemoveChild(childId) {
|
|
42738
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
42739
|
-
this.subject.publish(this);
|
|
42740
|
-
}
|
|
42741
42721
|
getLinkTo() {
|
|
42742
42722
|
return this.linkTo.link;
|
|
42743
42723
|
}
|
|
@@ -42878,7 +42858,7 @@ class Frame2 extends BaseItem {
|
|
|
42878
42858
|
this.transformPath();
|
|
42879
42859
|
}
|
|
42880
42860
|
if (data.children) {
|
|
42881
|
-
this.
|
|
42861
|
+
this.applyAddChildren(data.children);
|
|
42882
42862
|
}
|
|
42883
42863
|
if (data.text) {
|
|
42884
42864
|
this.text.deserialize(data.text);
|
|
@@ -42924,9 +42904,9 @@ class Frame2 extends BaseItem {
|
|
|
42924
42904
|
} else if (op.method === "setFrameType") {
|
|
42925
42905
|
this.applyFrameType(op.shapeType);
|
|
42926
42906
|
} else if (op.method === "addChild") {
|
|
42927
|
-
this.
|
|
42907
|
+
this.applyAddChildren(op.childId);
|
|
42928
42908
|
} else if (op.method === "removeChild") {
|
|
42929
|
-
this.
|
|
42909
|
+
this.applyRemoveChildren(op.childId);
|
|
42930
42910
|
}
|
|
42931
42911
|
break;
|
|
42932
42912
|
case "RichText":
|
|
@@ -43002,10 +42982,10 @@ class Frame2 extends BaseItem {
|
|
|
43002
42982
|
const child = this.board?.items.getById(childId);
|
|
43003
42983
|
if (child) {
|
|
43004
42984
|
if (this.handleNesting(child)) {
|
|
43005
|
-
this.
|
|
42985
|
+
this.applyAddChildren([child.getId()]);
|
|
43006
42986
|
child.parent = this.getId();
|
|
43007
42987
|
} else {
|
|
43008
|
-
this.
|
|
42988
|
+
this.applyRemoveChildren([child.getId()]);
|
|
43009
42989
|
child.parent = "Board";
|
|
43010
42990
|
}
|
|
43011
42991
|
}
|
|
@@ -43014,7 +42994,7 @@ class Frame2 extends BaseItem {
|
|
|
43014
42994
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
43015
42995
|
if (item.parent === "Board") {
|
|
43016
42996
|
if (this.handleNesting(item)) {
|
|
43017
|
-
this.
|
|
42997
|
+
this.applyAddChildren([item.getId()]);
|
|
43018
42998
|
item.parent = this.getId();
|
|
43019
42999
|
}
|
|
43020
43000
|
}
|
|
@@ -46431,7 +46411,7 @@ class AddFrame extends BoardTool {
|
|
|
46431
46411
|
child.parent = this.frame.getId();
|
|
46432
46412
|
return child.getId();
|
|
46433
46413
|
});
|
|
46434
|
-
this.frame.
|
|
46414
|
+
this.frame.applyAddChildren(childrenIds);
|
|
46435
46415
|
this.frame.subject.publish(this.frame);
|
|
46436
46416
|
}
|
|
46437
46417
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -56181,7 +56161,7 @@ class Board {
|
|
|
56181
56161
|
}
|
|
56182
56162
|
for (const key in createdFrames) {
|
|
56183
56163
|
const { item, itemData } = createdFrames[key];
|
|
56184
|
-
item.
|
|
56164
|
+
item.applyAddChildren(itemData.children);
|
|
56185
56165
|
}
|
|
56186
56166
|
}
|
|
56187
56167
|
deserialize(snapshot) {
|
|
@@ -56217,7 +56197,7 @@ class Board {
|
|
|
56217
56197
|
}
|
|
56218
56198
|
for (const key in createdFrames) {
|
|
56219
56199
|
const { item, itemData } = createdFrames[key];
|
|
56220
|
-
item.
|
|
56200
|
+
item.applyAddChildren(itemData.children);
|
|
56221
56201
|
}
|
|
56222
56202
|
this.events?.log.deserialize(events);
|
|
56223
56203
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -20273,7 +20273,7 @@ class Container extends Mbr {
|
|
|
20273
20273
|
layer;
|
|
20274
20274
|
zIndex;
|
|
20275
20275
|
constructor(id, item, layer, zIndex) {
|
|
20276
|
-
const rect = item.
|
|
20276
|
+
const rect = item.getMbrWithChildren();
|
|
20277
20277
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
20278
20278
|
this.id = id;
|
|
20279
20279
|
this.item = item;
|
|
@@ -20383,7 +20383,7 @@ class LayeredIndex {
|
|
|
20383
20383
|
if (!this.isT(container.item)) {
|
|
20384
20384
|
return;
|
|
20385
20385
|
}
|
|
20386
|
-
const bounds = container.item.
|
|
20386
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20387
20387
|
this.remove(container.item);
|
|
20388
20388
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20389
20389
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20411,7 +20411,7 @@ class LayeredIndex {
|
|
|
20411
20411
|
if (!this.isT(container.item)) {
|
|
20412
20412
|
return;
|
|
20413
20413
|
}
|
|
20414
|
-
const bounds = container.item.
|
|
20414
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20415
20415
|
this.remove(container.item);
|
|
20416
20416
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20417
20417
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20437,7 +20437,7 @@ class LayeredIndex {
|
|
|
20437
20437
|
}
|
|
20438
20438
|
insert(item) {
|
|
20439
20439
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
20440
|
-
const bounds = item.
|
|
20440
|
+
const bounds = item.getMbrWithChildren();
|
|
20441
20441
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20442
20442
|
if (inBounds.length === 0) {
|
|
20443
20443
|
return this.insertContainer(toInsert);
|
|
@@ -20580,9 +20580,9 @@ class SpatialIndex {
|
|
|
20580
20580
|
return;
|
|
20581
20581
|
}
|
|
20582
20582
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20583
|
-
this.Mbr = item.
|
|
20583
|
+
this.Mbr = item.getMbr().copy();
|
|
20584
20584
|
} else {
|
|
20585
|
-
this.Mbr.combine([item.
|
|
20585
|
+
this.Mbr.combine([item.getMbr()]);
|
|
20586
20586
|
}
|
|
20587
20587
|
item.subject.subscribe(this.change);
|
|
20588
20588
|
this.subject.publish(this.items);
|
|
@@ -21438,7 +21438,7 @@ class BaseItem extends Mbr {
|
|
|
21438
21438
|
if (!this.index) {
|
|
21439
21439
|
return this.getMbr();
|
|
21440
21440
|
}
|
|
21441
|
-
return this.getMbr().combine(this.index.
|
|
21441
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
21442
21442
|
}
|
|
21443
21443
|
getPath() {
|
|
21444
21444
|
return new Path(this.getMbr().getLines());
|
|
@@ -40095,26 +40095,6 @@ class Frame2 extends BaseItem {
|
|
|
40095
40095
|
this.board = board;
|
|
40096
40096
|
return this;
|
|
40097
40097
|
}
|
|
40098
|
-
applyAddChild(childId, noWarn = false) {
|
|
40099
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
40100
|
-
children.forEach((child) => {
|
|
40101
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
40102
|
-
const foundItem = this.getItemById(child);
|
|
40103
|
-
if (!this.children.includes(child) && foundItem) {
|
|
40104
|
-
this.children.push(child);
|
|
40105
|
-
foundItem.parent = this.getId();
|
|
40106
|
-
this.updateMbr();
|
|
40107
|
-
this.subject.publish(this);
|
|
40108
|
-
} else if (!foundItem && !noWarn) {
|
|
40109
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
40110
|
-
}
|
|
40111
|
-
}
|
|
40112
|
-
});
|
|
40113
|
-
}
|
|
40114
|
-
applyRemoveChild(childId) {
|
|
40115
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
40116
|
-
this.subject.publish(this);
|
|
40117
|
-
}
|
|
40118
40098
|
getLinkTo() {
|
|
40119
40099
|
return this.linkTo.link;
|
|
40120
40100
|
}
|
|
@@ -40255,7 +40235,7 @@ class Frame2 extends BaseItem {
|
|
|
40255
40235
|
this.transformPath();
|
|
40256
40236
|
}
|
|
40257
40237
|
if (data.children) {
|
|
40258
|
-
this.
|
|
40238
|
+
this.applyAddChildren(data.children);
|
|
40259
40239
|
}
|
|
40260
40240
|
if (data.text) {
|
|
40261
40241
|
this.text.deserialize(data.text);
|
|
@@ -40301,9 +40281,9 @@ class Frame2 extends BaseItem {
|
|
|
40301
40281
|
} else if (op.method === "setFrameType") {
|
|
40302
40282
|
this.applyFrameType(op.shapeType);
|
|
40303
40283
|
} else if (op.method === "addChild") {
|
|
40304
|
-
this.
|
|
40284
|
+
this.applyAddChildren(op.childId);
|
|
40305
40285
|
} else if (op.method === "removeChild") {
|
|
40306
|
-
this.
|
|
40286
|
+
this.applyRemoveChildren(op.childId);
|
|
40307
40287
|
}
|
|
40308
40288
|
break;
|
|
40309
40289
|
case "RichText":
|
|
@@ -40379,10 +40359,10 @@ class Frame2 extends BaseItem {
|
|
|
40379
40359
|
const child = this.board?.items.getById(childId);
|
|
40380
40360
|
if (child) {
|
|
40381
40361
|
if (this.handleNesting(child)) {
|
|
40382
|
-
this.
|
|
40362
|
+
this.applyAddChildren([child.getId()]);
|
|
40383
40363
|
child.parent = this.getId();
|
|
40384
40364
|
} else {
|
|
40385
|
-
this.
|
|
40365
|
+
this.applyRemoveChildren([child.getId()]);
|
|
40386
40366
|
child.parent = "Board";
|
|
40387
40367
|
}
|
|
40388
40368
|
}
|
|
@@ -40391,7 +40371,7 @@ class Frame2 extends BaseItem {
|
|
|
40391
40371
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
40392
40372
|
if (item.parent === "Board") {
|
|
40393
40373
|
if (this.handleNesting(item)) {
|
|
40394
|
-
this.
|
|
40374
|
+
this.applyAddChildren([item.getId()]);
|
|
40395
40375
|
item.parent = this.getId();
|
|
40396
40376
|
}
|
|
40397
40377
|
}
|
|
@@ -43808,7 +43788,7 @@ class AddFrame extends BoardTool {
|
|
|
43808
43788
|
child.parent = this.frame.getId();
|
|
43809
43789
|
return child.getId();
|
|
43810
43790
|
});
|
|
43811
|
-
this.frame.
|
|
43791
|
+
this.frame.applyAddChildren(childrenIds);
|
|
43812
43792
|
this.frame.subject.publish(this.frame);
|
|
43813
43793
|
}
|
|
43814
43794
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -53558,7 +53538,7 @@ class Board {
|
|
|
53558
53538
|
}
|
|
53559
53539
|
for (const key in createdFrames) {
|
|
53560
53540
|
const { item, itemData } = createdFrames[key];
|
|
53561
|
-
item.
|
|
53541
|
+
item.applyAddChildren(itemData.children);
|
|
53562
53542
|
}
|
|
53563
53543
|
}
|
|
53564
53544
|
deserialize(snapshot) {
|
|
@@ -53594,7 +53574,7 @@ class Board {
|
|
|
53594
53574
|
}
|
|
53595
53575
|
for (const key in createdFrames) {
|
|
53596
53576
|
const { item, itemData } = createdFrames[key];
|
|
53597
|
-
item.
|
|
53577
|
+
item.applyAddChildren(itemData.children);
|
|
53598
53578
|
}
|
|
53599
53579
|
this.events?.log.deserialize(events);
|
|
53600
53580
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -20266,7 +20266,7 @@ class Container extends Mbr {
|
|
|
20266
20266
|
layer;
|
|
20267
20267
|
zIndex;
|
|
20268
20268
|
constructor(id, item, layer, zIndex) {
|
|
20269
|
-
const rect = item.
|
|
20269
|
+
const rect = item.getMbrWithChildren();
|
|
20270
20270
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
20271
20271
|
this.id = id;
|
|
20272
20272
|
this.item = item;
|
|
@@ -20376,7 +20376,7 @@ class LayeredIndex {
|
|
|
20376
20376
|
if (!this.isT(container.item)) {
|
|
20377
20377
|
return;
|
|
20378
20378
|
}
|
|
20379
|
-
const bounds = container.item.
|
|
20379
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20380
20380
|
this.remove(container.item);
|
|
20381
20381
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20382
20382
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20404,7 +20404,7 @@ class LayeredIndex {
|
|
|
20404
20404
|
if (!this.isT(container.item)) {
|
|
20405
20405
|
return;
|
|
20406
20406
|
}
|
|
20407
|
-
const bounds = container.item.
|
|
20407
|
+
const bounds = container.item.getMbrWithChildren();
|
|
20408
20408
|
this.remove(container.item);
|
|
20409
20409
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20410
20410
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -20430,7 +20430,7 @@ class LayeredIndex {
|
|
|
20430
20430
|
}
|
|
20431
20431
|
insert(item) {
|
|
20432
20432
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
20433
|
-
const bounds = item.
|
|
20433
|
+
const bounds = item.getMbrWithChildren();
|
|
20434
20434
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20435
20435
|
if (inBounds.length === 0) {
|
|
20436
20436
|
return this.insertContainer(toInsert);
|
|
@@ -20573,9 +20573,9 @@ class SpatialIndex {
|
|
|
20573
20573
|
return;
|
|
20574
20574
|
}
|
|
20575
20575
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20576
|
-
this.Mbr = item.
|
|
20576
|
+
this.Mbr = item.getMbr().copy();
|
|
20577
20577
|
} else {
|
|
20578
|
-
this.Mbr.combine([item.
|
|
20578
|
+
this.Mbr.combine([item.getMbr()]);
|
|
20579
20579
|
}
|
|
20580
20580
|
item.subject.subscribe(this.change);
|
|
20581
20581
|
this.subject.publish(this.items);
|
|
@@ -21431,7 +21431,7 @@ class BaseItem extends Mbr {
|
|
|
21431
21431
|
if (!this.index) {
|
|
21432
21432
|
return this.getMbr();
|
|
21433
21433
|
}
|
|
21434
|
-
return this.getMbr().combine(this.index.
|
|
21434
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
21435
21435
|
}
|
|
21436
21436
|
getPath() {
|
|
21437
21437
|
return new Path(this.getMbr().getLines());
|
|
@@ -40088,26 +40088,6 @@ class Frame2 extends BaseItem {
|
|
|
40088
40088
|
this.board = board;
|
|
40089
40089
|
return this;
|
|
40090
40090
|
}
|
|
40091
|
-
applyAddChild(childId, noWarn = false) {
|
|
40092
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
40093
|
-
children.forEach((child) => {
|
|
40094
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
40095
|
-
const foundItem = this.getItemById(child);
|
|
40096
|
-
if (!this.children.includes(child) && foundItem) {
|
|
40097
|
-
this.children.push(child);
|
|
40098
|
-
foundItem.parent = this.getId();
|
|
40099
|
-
this.updateMbr();
|
|
40100
|
-
this.subject.publish(this);
|
|
40101
|
-
} else if (!foundItem && !noWarn) {
|
|
40102
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
40103
|
-
}
|
|
40104
|
-
}
|
|
40105
|
-
});
|
|
40106
|
-
}
|
|
40107
|
-
applyRemoveChild(childId) {
|
|
40108
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
40109
|
-
this.subject.publish(this);
|
|
40110
|
-
}
|
|
40111
40091
|
getLinkTo() {
|
|
40112
40092
|
return this.linkTo.link;
|
|
40113
40093
|
}
|
|
@@ -40248,7 +40228,7 @@ class Frame2 extends BaseItem {
|
|
|
40248
40228
|
this.transformPath();
|
|
40249
40229
|
}
|
|
40250
40230
|
if (data.children) {
|
|
40251
|
-
this.
|
|
40231
|
+
this.applyAddChildren(data.children);
|
|
40252
40232
|
}
|
|
40253
40233
|
if (data.text) {
|
|
40254
40234
|
this.text.deserialize(data.text);
|
|
@@ -40294,9 +40274,9 @@ class Frame2 extends BaseItem {
|
|
|
40294
40274
|
} else if (op.method === "setFrameType") {
|
|
40295
40275
|
this.applyFrameType(op.shapeType);
|
|
40296
40276
|
} else if (op.method === "addChild") {
|
|
40297
|
-
this.
|
|
40277
|
+
this.applyAddChildren(op.childId);
|
|
40298
40278
|
} else if (op.method === "removeChild") {
|
|
40299
|
-
this.
|
|
40279
|
+
this.applyRemoveChildren(op.childId);
|
|
40300
40280
|
}
|
|
40301
40281
|
break;
|
|
40302
40282
|
case "RichText":
|
|
@@ -40372,10 +40352,10 @@ class Frame2 extends BaseItem {
|
|
|
40372
40352
|
const child = this.board?.items.getById(childId);
|
|
40373
40353
|
if (child) {
|
|
40374
40354
|
if (this.handleNesting(child)) {
|
|
40375
|
-
this.
|
|
40355
|
+
this.applyAddChildren([child.getId()]);
|
|
40376
40356
|
child.parent = this.getId();
|
|
40377
40357
|
} else {
|
|
40378
|
-
this.
|
|
40358
|
+
this.applyRemoveChildren([child.getId()]);
|
|
40379
40359
|
child.parent = "Board";
|
|
40380
40360
|
}
|
|
40381
40361
|
}
|
|
@@ -40384,7 +40364,7 @@ class Frame2 extends BaseItem {
|
|
|
40384
40364
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
40385
40365
|
if (item.parent === "Board") {
|
|
40386
40366
|
if (this.handleNesting(item)) {
|
|
40387
|
-
this.
|
|
40367
|
+
this.applyAddChildren([item.getId()]);
|
|
40388
40368
|
item.parent = this.getId();
|
|
40389
40369
|
}
|
|
40390
40370
|
}
|
|
@@ -43801,7 +43781,7 @@ class AddFrame extends BoardTool {
|
|
|
43801
43781
|
child.parent = this.frame.getId();
|
|
43802
43782
|
return child.getId();
|
|
43803
43783
|
});
|
|
43804
|
-
this.frame.
|
|
43784
|
+
this.frame.applyAddChildren(childrenIds);
|
|
43805
43785
|
this.frame.subject.publish(this.frame);
|
|
43806
43786
|
}
|
|
43807
43787
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -53551,7 +53531,7 @@ class Board {
|
|
|
53551
53531
|
}
|
|
53552
53532
|
for (const key in createdFrames) {
|
|
53553
53533
|
const { item, itemData } = createdFrames[key];
|
|
53554
|
-
item.
|
|
53534
|
+
item.applyAddChildren(itemData.children);
|
|
53555
53535
|
}
|
|
53556
53536
|
}
|
|
53557
53537
|
deserialize(snapshot) {
|
|
@@ -53587,7 +53567,7 @@ class Board {
|
|
|
53587
53567
|
}
|
|
53588
53568
|
for (const key in createdFrames) {
|
|
53589
53569
|
const { item, itemData } = createdFrames[key];
|
|
53590
|
-
item.
|
|
53570
|
+
item.applyAddChildren(itemData.children);
|
|
53591
53571
|
}
|
|
53592
53572
|
this.events?.log.deserialize(events);
|
|
53593
53573
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -22733,7 +22733,7 @@ class Container extends Mbr {
|
|
|
22733
22733
|
layer;
|
|
22734
22734
|
zIndex;
|
|
22735
22735
|
constructor(id, item, layer, zIndex) {
|
|
22736
|
-
const rect = item.
|
|
22736
|
+
const rect = item.getMbrWithChildren();
|
|
22737
22737
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
22738
22738
|
this.id = id;
|
|
22739
22739
|
this.item = item;
|
|
@@ -22843,7 +22843,7 @@ class LayeredIndex {
|
|
|
22843
22843
|
if (!this.isT(container.item)) {
|
|
22844
22844
|
return;
|
|
22845
22845
|
}
|
|
22846
|
-
const bounds = container.item.
|
|
22846
|
+
const bounds = container.item.getMbrWithChildren();
|
|
22847
22847
|
this.remove(container.item);
|
|
22848
22848
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
22849
22849
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -22871,7 +22871,7 @@ class LayeredIndex {
|
|
|
22871
22871
|
if (!this.isT(container.item)) {
|
|
22872
22872
|
return;
|
|
22873
22873
|
}
|
|
22874
|
-
const bounds = container.item.
|
|
22874
|
+
const bounds = container.item.getMbrWithChildren();
|
|
22875
22875
|
this.remove(container.item);
|
|
22876
22876
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
22877
22877
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
@@ -22897,7 +22897,7 @@ class LayeredIndex {
|
|
|
22897
22897
|
}
|
|
22898
22898
|
insert(item) {
|
|
22899
22899
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
22900
|
-
const bounds = item.
|
|
22900
|
+
const bounds = item.getMbrWithChildren();
|
|
22901
22901
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
22902
22902
|
if (inBounds.length === 0) {
|
|
22903
22903
|
return this.insertContainer(toInsert);
|
|
@@ -23040,9 +23040,9 @@ class SpatialIndex {
|
|
|
23040
23040
|
return;
|
|
23041
23041
|
}
|
|
23042
23042
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
23043
|
-
this.Mbr = item.
|
|
23043
|
+
this.Mbr = item.getMbr().copy();
|
|
23044
23044
|
} else {
|
|
23045
|
-
this.Mbr.combine([item.
|
|
23045
|
+
this.Mbr.combine([item.getMbr()]);
|
|
23046
23046
|
}
|
|
23047
23047
|
item.subject.subscribe(this.change);
|
|
23048
23048
|
this.subject.publish(this.items);
|
|
@@ -23898,7 +23898,7 @@ class BaseItem extends Mbr {
|
|
|
23898
23898
|
if (!this.index) {
|
|
23899
23899
|
return this.getMbr();
|
|
23900
23900
|
}
|
|
23901
|
-
return this.getMbr().combine(this.index.
|
|
23901
|
+
return this.getMbr().combine(this.index.getMbr());
|
|
23902
23902
|
}
|
|
23903
23903
|
getPath() {
|
|
23904
23904
|
return new Path(this.getMbr().getLines());
|
|
@@ -42556,26 +42556,6 @@ class Frame2 extends BaseItem {
|
|
|
42556
42556
|
this.board = board;
|
|
42557
42557
|
return this;
|
|
42558
42558
|
}
|
|
42559
|
-
applyAddChild(childId, noWarn = false) {
|
|
42560
|
-
const children = Array.isArray(childId) ? childId : [childId];
|
|
42561
|
-
children.forEach((child) => {
|
|
42562
|
-
if (this.parent !== child && this.getId() !== child) {
|
|
42563
|
-
const foundItem = this.getItemById(child);
|
|
42564
|
-
if (!this.children.includes(child) && foundItem) {
|
|
42565
|
-
this.children.push(child);
|
|
42566
|
-
foundItem.parent = this.getId();
|
|
42567
|
-
this.updateMbr();
|
|
42568
|
-
this.subject.publish(this);
|
|
42569
|
-
} else if (!foundItem && !noWarn) {
|
|
42570
|
-
console.warn(`Could not find child with id ${childId}`);
|
|
42571
|
-
}
|
|
42572
|
-
}
|
|
42573
|
-
});
|
|
42574
|
-
}
|
|
42575
|
-
applyRemoveChild(childId) {
|
|
42576
|
-
this.children = this.children.filter((currChild) => !childId.includes(currChild));
|
|
42577
|
-
this.subject.publish(this);
|
|
42578
|
-
}
|
|
42579
42559
|
getLinkTo() {
|
|
42580
42560
|
return this.linkTo.link;
|
|
42581
42561
|
}
|
|
@@ -42716,7 +42696,7 @@ class Frame2 extends BaseItem {
|
|
|
42716
42696
|
this.transformPath();
|
|
42717
42697
|
}
|
|
42718
42698
|
if (data.children) {
|
|
42719
|
-
this.
|
|
42699
|
+
this.applyAddChildren(data.children);
|
|
42720
42700
|
}
|
|
42721
42701
|
if (data.text) {
|
|
42722
42702
|
this.text.deserialize(data.text);
|
|
@@ -42762,9 +42742,9 @@ class Frame2 extends BaseItem {
|
|
|
42762
42742
|
} else if (op.method === "setFrameType") {
|
|
42763
42743
|
this.applyFrameType(op.shapeType);
|
|
42764
42744
|
} else if (op.method === "addChild") {
|
|
42765
|
-
this.
|
|
42745
|
+
this.applyAddChildren(op.childId);
|
|
42766
42746
|
} else if (op.method === "removeChild") {
|
|
42767
|
-
this.
|
|
42747
|
+
this.applyRemoveChildren(op.childId);
|
|
42768
42748
|
}
|
|
42769
42749
|
break;
|
|
42770
42750
|
case "RichText":
|
|
@@ -42840,10 +42820,10 @@ class Frame2 extends BaseItem {
|
|
|
42840
42820
|
const child = this.board?.items.getById(childId);
|
|
42841
42821
|
if (child) {
|
|
42842
42822
|
if (this.handleNesting(child)) {
|
|
42843
|
-
this.
|
|
42823
|
+
this.applyAddChildren([child.getId()]);
|
|
42844
42824
|
child.parent = this.getId();
|
|
42845
42825
|
} else {
|
|
42846
|
-
this.
|
|
42826
|
+
this.applyRemoveChildren([child.getId()]);
|
|
42847
42827
|
child.parent = "Board";
|
|
42848
42828
|
}
|
|
42849
42829
|
}
|
|
@@ -42852,7 +42832,7 @@ class Frame2 extends BaseItem {
|
|
|
42852
42832
|
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item) => {
|
|
42853
42833
|
if (item.parent === "Board") {
|
|
42854
42834
|
if (this.handleNesting(item)) {
|
|
42855
|
-
this.
|
|
42835
|
+
this.applyAddChildren([item.getId()]);
|
|
42856
42836
|
item.parent = this.getId();
|
|
42857
42837
|
}
|
|
42858
42838
|
}
|
|
@@ -46269,7 +46249,7 @@ class AddFrame extends BoardTool {
|
|
|
46269
46249
|
child.parent = this.frame.getId();
|
|
46270
46250
|
return child.getId();
|
|
46271
46251
|
});
|
|
46272
|
-
this.frame.
|
|
46252
|
+
this.frame.applyAddChildren(childrenIds);
|
|
46273
46253
|
this.frame.subject.publish(this.frame);
|
|
46274
46254
|
}
|
|
46275
46255
|
applyCanChangeRatio(canChangeRatio) {
|
|
@@ -56019,7 +55999,7 @@ class Board {
|
|
|
56019
55999
|
}
|
|
56020
56000
|
for (const key in createdFrames) {
|
|
56021
56001
|
const { item, itemData } = createdFrames[key];
|
|
56022
|
-
item.
|
|
56002
|
+
item.applyAddChildren(itemData.children);
|
|
56023
56003
|
}
|
|
56024
56004
|
}
|
|
56025
56005
|
deserialize(snapshot) {
|
|
@@ -56055,7 +56035,7 @@ class Board {
|
|
|
56055
56035
|
}
|
|
56056
56036
|
for (const key in createdFrames) {
|
|
56057
56037
|
const { item, itemData } = createdFrames[key];
|
|
56058
|
-
item.
|
|
56038
|
+
item.applyAddChildren(itemData.children);
|
|
56059
56039
|
}
|
|
56060
56040
|
this.events?.log.deserialize(events);
|
|
56061
56041
|
}
|