microboard-temp 0.13.42 → 0.13.44
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 +284 -200
- package/dist/cjs/index.js +284 -200
- package/dist/cjs/node.js +284 -200
- package/dist/esm/browser.js +287 -203
- package/dist/esm/index.js +287 -203
- package/dist/esm/node.js +287 -203
- package/dist/types/Events/Log/EventsLog.d.ts +2 -2
- package/dist/types/Events/Log/deserializeAndApplyToList.d.ts +2 -2
- package/dist/types/Events/MessageRouter/boardMessageInterface.d.ts +57 -3
- package/dist/types/Events/MessageRouter/handleAiChatMassage.d.ts +1 -5
- package/dist/types/Events/MessageRouter/handleBoardEventMessage.d.ts +1 -8
- package/dist/types/Events/MessageRouter/handleConfirmation.d.ts +1 -6
- package/dist/types/Events/MessageRouter/handleCreateSnapshotRequestMessage.d.ts +2 -5
- package/dist/types/Events/MessageRouter/handleModeMessage.d.ts +1 -5
- package/dist/types/Events/MessageRouter/handlePresenceEventMessage.d.ts +1 -1
- package/dist/types/Events/MessageRouter/index.d.ts +0 -5
- package/dist/types/Items/AINode/AINode.d.ts +1 -1
- package/dist/types/Items/Audio/Audio.d.ts +1 -1
- package/dist/types/Items/BaseItem/BaseItem.d.ts +2 -2
- package/dist/types/Items/Comment/Comment.d.ts +1 -1
- package/dist/types/Items/Connector/Connector.d.ts +1 -1
- package/dist/types/Items/Drawing/Drawing.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Deck/Deck.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Screen/Screen.d.ts +1 -1
- package/dist/types/Items/Examples/Counter/Counter.d.ts +1 -1
- package/dist/types/Items/Examples/Star/Star.d.ts +1 -1
- package/dist/types/Items/Frame/Frame.d.ts +1 -1
- package/dist/types/Items/Group/Group.d.ts +2 -2
- package/dist/types/Items/Image/Image.d.ts +1 -1
- package/dist/types/Items/Placeholder/Placeholder.d.ts +1 -1
- package/dist/types/Items/RegisterItem.d.ts +2 -2
- package/dist/types/Items/RichText/CanvasText/index.d.ts +2 -0
- package/dist/types/Items/RichText/EditorContainer.d.ts +3 -2
- package/dist/types/Items/RichText/RichText.d.ts +1 -1
- package/dist/types/Items/RichText/RichTextData.d.ts +1 -1
- package/dist/types/Items/RichText/editorHelpers/selectionOps/setSelectionFontColor.d.ts +2 -1
- package/dist/types/Items/Shape/Shape.d.ts +1 -1
- package/dist/types/Items/Sticker/Sticker.d.ts +1 -1
- package/dist/types/Items/Video/Video.d.ts +1 -1
- package/dist/types/Presence/Events.d.ts +1 -20
- package/dist/types/Presence/Presence.d.ts +2 -1
- package/dist/types/Selection/Selection.d.ts +1 -1
- package/dist/types/Selection/SelectionItems.d.ts +1 -0
- package/dist/types/Settings.d.ts +7 -7
- package/dist/types/SpatialIndex/LayeredIndex/index.d.ts +12 -8
- package/dist/types/SpatialIndex/RTreeIndex/index.d.ts +12 -7
- package/dist/types/SpatialIndex/SimpleSpatialIndex.d.ts +24 -8
- package/dist/types/SpatialIndex/SpacialIndex.d.ts +81 -9
- package/dist/types/Tools/CustomTool.d.ts +3 -3
- package/package.json +1 -1
package/dist/cjs/node.js
CHANGED
|
@@ -4177,18 +4177,23 @@ function createEventsList(commandFactory) {
|
|
|
4177
4177
|
return item;
|
|
4178
4178
|
if (typeof item === "string")
|
|
4179
4179
|
return [item];
|
|
4180
|
-
|
|
4180
|
+
if (item && typeof item === "object")
|
|
4181
|
+
return Object.keys(item);
|
|
4181
4182
|
}
|
|
4182
|
-
if ("itemsMap" in op)
|
|
4183
|
+
if ("itemsMap" in op && op.itemsMap)
|
|
4183
4184
|
return Object.keys(op.itemsMap);
|
|
4184
4185
|
if ("items" in op) {
|
|
4185
4186
|
const items = op.items;
|
|
4186
|
-
if (Array.isArray(items))
|
|
4187
|
-
return items.map((i) => typeof i === "string" ? i : i.id);
|
|
4188
|
-
|
|
4187
|
+
if (Array.isArray(items)) {
|
|
4188
|
+
return items.map((i) => typeof i === "string" ? i : i.id).filter(Boolean);
|
|
4189
|
+
}
|
|
4190
|
+
if (items && typeof items === "object" && items !== null)
|
|
4191
|
+
return Object.keys(items);
|
|
4192
|
+
}
|
|
4193
|
+
if ("itemsOps" in op) {
|
|
4194
|
+
const itemsOps = op.itemsOps;
|
|
4195
|
+
return itemsOps.map((io) => io.item);
|
|
4189
4196
|
}
|
|
4190
|
-
if ("itemsOps" in op)
|
|
4191
|
-
return op.itemsOps.map((io) => io.item);
|
|
4192
4197
|
return [];
|
|
4193
4198
|
}
|
|
4194
4199
|
return {
|
|
@@ -5882,16 +5887,17 @@ var init_transformEvents = __esm(() => {
|
|
|
5882
5887
|
function expandEvents(events) {
|
|
5883
5888
|
return events.flatMap((event) => {
|
|
5884
5889
|
if ("operations" in event.body) {
|
|
5885
|
-
|
|
5890
|
+
const { operations, lastKnownOrder, ...bodyWithoutOps } = event.body;
|
|
5891
|
+
return operations.map((operation) => ({
|
|
5886
5892
|
order: event.order,
|
|
5887
5893
|
body: {
|
|
5888
|
-
eventId: operation.actualId ||
|
|
5889
|
-
userId:
|
|
5890
|
-
boardId:
|
|
5894
|
+
eventId: operation.actualId || bodyWithoutOps.eventId,
|
|
5895
|
+
userId: bodyWithoutOps.userId,
|
|
5896
|
+
boardId: bodyWithoutOps.boardId,
|
|
5891
5897
|
operation
|
|
5892
5898
|
},
|
|
5893
|
-
userId:
|
|
5894
|
-
lastKnownOrder
|
|
5899
|
+
userId: bodyWithoutOps.userId,
|
|
5900
|
+
lastKnownOrder
|
|
5895
5901
|
}));
|
|
5896
5902
|
} else {
|
|
5897
5903
|
return [event];
|
|
@@ -6003,13 +6009,15 @@ var init_insertEventsFromOtherConnectionsIntoList = __esm(() => {
|
|
|
6003
6009
|
function deserializeAndApplyToList(events, list, board) {
|
|
6004
6010
|
list.clear();
|
|
6005
6011
|
for (const event of events) {
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
for (const op of
|
|
6012
|
+
if ("operations" in event.body) {
|
|
6013
|
+
const { operations, lastKnownOrder, ...bodyWithoutOps } = event.body;
|
|
6014
|
+
for (const op of operations) {
|
|
6009
6015
|
const singleEvent = {
|
|
6010
|
-
|
|
6016
|
+
order: event.order,
|
|
6017
|
+
lastKnownOrder,
|
|
6018
|
+
userId: bodyWithoutOps.userId,
|
|
6011
6019
|
body: {
|
|
6012
|
-
...
|
|
6020
|
+
...bodyWithoutOps,
|
|
6013
6021
|
operation: op
|
|
6014
6022
|
}
|
|
6015
6023
|
};
|
|
@@ -11615,7 +11623,7 @@ class RTreeIndex {
|
|
|
11615
11623
|
this.tree.remove(item);
|
|
11616
11624
|
}
|
|
11617
11625
|
}
|
|
11618
|
-
|
|
11626
|
+
listAll() {
|
|
11619
11627
|
const containers = this.tree.all();
|
|
11620
11628
|
const items = [];
|
|
11621
11629
|
for (const container of containers) {
|
|
@@ -11623,7 +11631,7 @@ class RTreeIndex {
|
|
|
11623
11631
|
}
|
|
11624
11632
|
return items;
|
|
11625
11633
|
}
|
|
11626
|
-
|
|
11634
|
+
listEnclosedBy(rect) {
|
|
11627
11635
|
return this.tree.search({
|
|
11628
11636
|
minX: rect.left,
|
|
11629
11637
|
minY: rect.top,
|
|
@@ -11631,7 +11639,7 @@ class RTreeIndex {
|
|
|
11631
11639
|
maxY: rect.bottom
|
|
11632
11640
|
}).filter((container) => container.item.isEnclosedBy(rect)).map((container) => container.item);
|
|
11633
11641
|
}
|
|
11634
|
-
|
|
11642
|
+
listEnclosedOrCrossedBy(rect) {
|
|
11635
11643
|
return this.tree.search({
|
|
11636
11644
|
minX: rect.left,
|
|
11637
11645
|
minY: rect.top,
|
|
@@ -11639,7 +11647,7 @@ class RTreeIndex {
|
|
|
11639
11647
|
maxY: rect.bottom
|
|
11640
11648
|
}).filter((container) => container.item.isEnclosedOrCrossedBy(rect)).map((container) => container.item);
|
|
11641
11649
|
}
|
|
11642
|
-
|
|
11650
|
+
listUnderPoint(point, tolerance = 5) {
|
|
11643
11651
|
return this.tree.search({
|
|
11644
11652
|
minX: point.x,
|
|
11645
11653
|
minY: point.y,
|
|
@@ -11647,7 +11655,7 @@ class RTreeIndex {
|
|
|
11647
11655
|
maxY: point.y
|
|
11648
11656
|
}).filter((container) => container.item.isUnderPoint(point, tolerance)).map((container) => container.item);
|
|
11649
11657
|
}
|
|
11650
|
-
|
|
11658
|
+
listRectsEnclosedOrCrossedBy(rect) {
|
|
11651
11659
|
return this.tree.search({
|
|
11652
11660
|
minX: rect.left,
|
|
11653
11661
|
minY: rect.top,
|
|
@@ -11663,9 +11671,27 @@ class RTreeIndex {
|
|
|
11663
11671
|
maxY: rect.bottom
|
|
11664
11672
|
});
|
|
11665
11673
|
}
|
|
11666
|
-
|
|
11674
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
11667
11675
|
return knn(this.tree, point.x, point.y, maxItems, (container) => filter(container.item), maxDistance).map((container) => container.item);
|
|
11668
11676
|
}
|
|
11677
|
+
getById(id) {
|
|
11678
|
+
return this.listAll().find((item) => item.getId() === id);
|
|
11679
|
+
}
|
|
11680
|
+
findById(id) {
|
|
11681
|
+
return this.getById(id);
|
|
11682
|
+
}
|
|
11683
|
+
getByZIndex(index) {
|
|
11684
|
+
return this.listAll()[index];
|
|
11685
|
+
}
|
|
11686
|
+
getLastZIndex() {
|
|
11687
|
+
return this.listAll().length - 1;
|
|
11688
|
+
}
|
|
11689
|
+
copy() {
|
|
11690
|
+
return this.listAll().map((item) => ({
|
|
11691
|
+
...item.serialize(),
|
|
11692
|
+
id: item.getId()
|
|
11693
|
+
}));
|
|
11694
|
+
}
|
|
11669
11695
|
batchInsert(batch) {
|
|
11670
11696
|
for (const one of batch) {
|
|
11671
11697
|
this.insert(one);
|
|
@@ -11737,35 +11763,31 @@ class LayeredIndex {
|
|
|
11737
11763
|
isT(item) {
|
|
11738
11764
|
return true;
|
|
11739
11765
|
}
|
|
11740
|
-
|
|
11741
|
-
const container = this.map.get(id);
|
|
11742
|
-
return container ? container.item : undefined;
|
|
11743
|
-
}
|
|
11744
|
-
getEnclosed(rect) {
|
|
11766
|
+
listEnclosedBy(rect) {
|
|
11745
11767
|
let items = [];
|
|
11746
11768
|
for (const layer of this.layers.array) {
|
|
11747
|
-
items = items.concat(layer.
|
|
11769
|
+
items = items.concat(layer.listEnclosedBy(rect));
|
|
11748
11770
|
}
|
|
11749
11771
|
return items;
|
|
11750
11772
|
}
|
|
11751
|
-
|
|
11773
|
+
listEnclosedOrCrossedBy(rect) {
|
|
11752
11774
|
let items = [];
|
|
11753
11775
|
for (const layer of this.layers.array) {
|
|
11754
|
-
items = items.concat(layer.
|
|
11776
|
+
items = items.concat(layer.listEnclosedOrCrossedBy(rect));
|
|
11755
11777
|
}
|
|
11756
11778
|
return items;
|
|
11757
11779
|
}
|
|
11758
|
-
|
|
11780
|
+
listUnderPoint(point, tolerance = 5) {
|
|
11759
11781
|
let items = [];
|
|
11760
11782
|
for (const layer of this.layers.array) {
|
|
11761
|
-
const layerItems = layer.
|
|
11783
|
+
const layerItems = layer.listUnderPoint(point, tolerance);
|
|
11762
11784
|
if (layerItems.length > 0) {
|
|
11763
11785
|
items = items.concat(layerItems);
|
|
11764
11786
|
}
|
|
11765
11787
|
}
|
|
11766
11788
|
return items;
|
|
11767
11789
|
}
|
|
11768
|
-
|
|
11790
|
+
listRectsEnclosedOrCrossedBy(rect) {
|
|
11769
11791
|
const items = [];
|
|
11770
11792
|
const minMax = {
|
|
11771
11793
|
minX: rect.left,
|
|
@@ -11789,10 +11811,10 @@ class LayeredIndex {
|
|
|
11789
11811
|
}
|
|
11790
11812
|
return false;
|
|
11791
11813
|
}
|
|
11792
|
-
|
|
11814
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
11793
11815
|
let items = [];
|
|
11794
11816
|
for (const layer of this.layers.array) {
|
|
11795
|
-
items = items.concat(layer.
|
|
11817
|
+
items = items.concat(layer.listNearestTo(point, maxItems, filter, maxDistance));
|
|
11796
11818
|
}
|
|
11797
11819
|
return items;
|
|
11798
11820
|
}
|
|
@@ -11826,7 +11848,7 @@ class LayeredIndex {
|
|
|
11826
11848
|
}
|
|
11827
11849
|
const bounds = container.item.getMbrWithChildren();
|
|
11828
11850
|
this.remove(container.item);
|
|
11829
|
-
const inBounds = this.
|
|
11851
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11830
11852
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
11831
11853
|
const containersAbove = [];
|
|
11832
11854
|
const containerZIndex = this.getZIndex(container.item);
|
|
@@ -11854,7 +11876,7 @@ class LayeredIndex {
|
|
|
11854
11876
|
}
|
|
11855
11877
|
const bounds = container.item.getMbrWithChildren();
|
|
11856
11878
|
this.remove(container.item);
|
|
11857
|
-
const inBounds = this.
|
|
11879
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11858
11880
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
11859
11881
|
const containersBelow = [];
|
|
11860
11882
|
const containerZIndex = this.getZIndex(container.item);
|
|
@@ -11879,7 +11901,7 @@ class LayeredIndex {
|
|
|
11879
11901
|
insert(item) {
|
|
11880
11902
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
11881
11903
|
const bounds = item.getMbrWithChildren();
|
|
11882
|
-
const inBounds = this.
|
|
11904
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11883
11905
|
if (inBounds.length === 0) {
|
|
11884
11906
|
return this.insertContainer(toInsert);
|
|
11885
11907
|
}
|
|
@@ -11976,13 +11998,32 @@ class LayeredIndex {
|
|
|
11976
11998
|
return;
|
|
11977
11999
|
}
|
|
11978
12000
|
}
|
|
11979
|
-
|
|
12001
|
+
listAll() {
|
|
11980
12002
|
const items = [];
|
|
11981
12003
|
for (const record of this.map) {
|
|
11982
12004
|
items.push(record[1].item);
|
|
11983
12005
|
}
|
|
11984
12006
|
return items;
|
|
11985
12007
|
}
|
|
12008
|
+
getById(id) {
|
|
12009
|
+
const container = this.map.get(id);
|
|
12010
|
+
return container ? container.item : undefined;
|
|
12011
|
+
}
|
|
12012
|
+
findById(id) {
|
|
12013
|
+
return this.getById(id);
|
|
12014
|
+
}
|
|
12015
|
+
getByZIndex(index) {
|
|
12016
|
+
return this.listAll()[index];
|
|
12017
|
+
}
|
|
12018
|
+
getLastZIndex() {
|
|
12019
|
+
return this.listAll().length - 1;
|
|
12020
|
+
}
|
|
12021
|
+
copy() {
|
|
12022
|
+
return this.listAll().map((item) => ({
|
|
12023
|
+
...item.serialize(),
|
|
12024
|
+
id: item.getId()
|
|
12025
|
+
}));
|
|
12026
|
+
}
|
|
11986
12027
|
batchInsert(items) {
|
|
11987
12028
|
for (const item of items) {
|
|
11988
12029
|
this.insert(item);
|
|
@@ -11999,11 +12040,6 @@ var init_LayeredIndex = __esm(() => {
|
|
|
11999
12040
|
init_RTreeIndex();
|
|
12000
12041
|
});
|
|
12001
12042
|
|
|
12002
|
-
// src/Items/BaseItem/index.ts
|
|
12003
|
-
var init_BaseItem = __esm(() => {
|
|
12004
|
-
init_BaseItem2();
|
|
12005
|
-
});
|
|
12006
|
-
|
|
12007
12043
|
// src/SpatialIndex/SpacialIndex.ts
|
|
12008
12044
|
function worldBoundsToLocal(container, left, top, right, bottom) {
|
|
12009
12045
|
const inv = container.getNestingMatrix().getInverse();
|
|
@@ -12022,6 +12058,13 @@ function worldBoundsToLocal(container, left, top, right, bottom) {
|
|
|
12022
12058
|
bottom: Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y)
|
|
12023
12059
|
};
|
|
12024
12060
|
}
|
|
12061
|
+
function coerceMbr(left, top, right, bottom) {
|
|
12062
|
+
if (left instanceof Mbr)
|
|
12063
|
+
return left;
|
|
12064
|
+
if (typeof left === "object" && left !== null)
|
|
12065
|
+
return new Mbr(left.left, left.top, left.right, left.bottom);
|
|
12066
|
+
return new Mbr(left, top, right, bottom);
|
|
12067
|
+
}
|
|
12025
12068
|
|
|
12026
12069
|
class SpatialIndex {
|
|
12027
12070
|
subject = new Subject;
|
|
@@ -12042,6 +12085,9 @@ class SpatialIndex {
|
|
|
12042
12085
|
this.Mbr = new Mbr;
|
|
12043
12086
|
}
|
|
12044
12087
|
insert(item) {
|
|
12088
|
+
if (this.itemsArray.includes(item) || this.getById(item.getId())) {
|
|
12089
|
+
return;
|
|
12090
|
+
}
|
|
12045
12091
|
this.itemsArray.push(item);
|
|
12046
12092
|
this.itemsIndex.insert(item);
|
|
12047
12093
|
if (conf.isNode()) {
|
|
@@ -12070,7 +12116,7 @@ class SpatialIndex {
|
|
|
12070
12116
|
remove(item, preserveChildren = false) {
|
|
12071
12117
|
const baseItem = item;
|
|
12072
12118
|
if (!preserveChildren && baseItem.index) {
|
|
12073
|
-
baseItem.removeChildItems(baseItem.index.
|
|
12119
|
+
baseItem.removeChildItems(baseItem.index.listAll());
|
|
12074
12120
|
}
|
|
12075
12121
|
this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
|
|
12076
12122
|
this.itemsIndex.remove(item);
|
|
@@ -12113,14 +12159,14 @@ class SpatialIndex {
|
|
|
12113
12159
|
return items.flatMap((item) => {
|
|
12114
12160
|
const baseItem = item;
|
|
12115
12161
|
if (baseItem.index) {
|
|
12116
|
-
return [item, ...baseItem.index.
|
|
12162
|
+
return [item, ...baseItem.index.listAll()];
|
|
12117
12163
|
}
|
|
12118
12164
|
return item;
|
|
12119
12165
|
});
|
|
12120
12166
|
}
|
|
12121
12167
|
getItemChildren(item) {
|
|
12122
12168
|
if ("index" in item && item.index) {
|
|
12123
|
-
return item.index.
|
|
12169
|
+
return item.index.listAll();
|
|
12124
12170
|
}
|
|
12125
12171
|
return [];
|
|
12126
12172
|
}
|
|
@@ -12271,14 +12317,14 @@ class SpatialIndex {
|
|
|
12271
12317
|
findById(id) {
|
|
12272
12318
|
return this.getById(id);
|
|
12273
12319
|
}
|
|
12274
|
-
|
|
12275
|
-
const mbr =
|
|
12276
|
-
const items = this.itemsIndex.
|
|
12320
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12321
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12322
|
+
const items = this.itemsIndex.listEnclosedBy(mbr);
|
|
12277
12323
|
const children = [];
|
|
12278
12324
|
const clearItems = items.filter((item) => {
|
|
12279
12325
|
if ("index" in item && item.index) {
|
|
12280
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12281
|
-
children.push(...item.index.
|
|
12326
|
+
const local = worldBoundsToLocal(item, mbr.left, mbr.top, mbr.right, mbr.bottom);
|
|
12327
|
+
children.push(...item.index.listEnclosedBy(local.left, local.top, local.right, local.bottom));
|
|
12282
12328
|
if (!item.getMbr().isEnclosedBy(mbr)) {
|
|
12283
12329
|
return false;
|
|
12284
12330
|
}
|
|
@@ -12287,14 +12333,14 @@ class SpatialIndex {
|
|
|
12287
12333
|
});
|
|
12288
12334
|
return [...clearItems, ...children];
|
|
12289
12335
|
}
|
|
12290
|
-
|
|
12291
|
-
const mbr =
|
|
12292
|
-
const items = this.itemsIndex.
|
|
12336
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12337
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12338
|
+
const items = this.itemsIndex.listEnclosedOrCrossedBy(mbr);
|
|
12293
12339
|
const children = [];
|
|
12294
12340
|
const clearItems = items.filter((item) => {
|
|
12295
12341
|
if ("index" in item && item.index) {
|
|
12296
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12297
|
-
children.push(...item.index.
|
|
12342
|
+
const local = worldBoundsToLocal(item, mbr.left, mbr.top, mbr.right, mbr.bottom);
|
|
12343
|
+
children.push(...item.index.listEnclosedOrCrossedBy(local.left, local.top, local.right, local.bottom));
|
|
12298
12344
|
if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
12299
12345
|
return false;
|
|
12300
12346
|
}
|
|
@@ -12303,14 +12349,17 @@ class SpatialIndex {
|
|
|
12303
12349
|
});
|
|
12304
12350
|
return [...clearItems, ...children];
|
|
12305
12351
|
}
|
|
12306
|
-
|
|
12307
|
-
|
|
12352
|
+
listRectsEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12353
|
+
return this.listEnclosedOrCrossedBy(left, top, right, bottom).map((item) => item.getMbr());
|
|
12354
|
+
}
|
|
12355
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12356
|
+
const items = this.itemsIndex.listUnderPoint(point, tolerance);
|
|
12308
12357
|
const children = [];
|
|
12309
12358
|
const clearItems = items.filter((item) => {
|
|
12310
12359
|
if ("index" in item && item.index) {
|
|
12311
12360
|
const localPt = new Point(point.x, point.y);
|
|
12312
12361
|
item.getNestingMatrix().getInverse().apply(localPt);
|
|
12313
|
-
children.push(...item.index.
|
|
12362
|
+
children.push(...item.index.listUnderPoint(localPt, tolerance));
|
|
12314
12363
|
if (!item.getMbr().isUnderPoint(point)) {
|
|
12315
12364
|
return false;
|
|
12316
12365
|
}
|
|
@@ -12322,24 +12371,8 @@ class SpatialIndex {
|
|
|
12322
12371
|
});
|
|
12323
12372
|
return [...clearItems, ...children];
|
|
12324
12373
|
}
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
|
|
12328
|
-
const children = [];
|
|
12329
|
-
const clearItems = items.filter((item) => {
|
|
12330
|
-
if ("index" in item && item.index) {
|
|
12331
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12332
|
-
children.push(...item.index.getEnclosedOrCrossed(local.left, local.top, local.right, local.bottom));
|
|
12333
|
-
if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
12334
|
-
return false;
|
|
12335
|
-
}
|
|
12336
|
-
}
|
|
12337
|
-
return true;
|
|
12338
|
-
});
|
|
12339
|
-
return [...clearItems, ...children];
|
|
12340
|
-
}
|
|
12341
|
-
getItemsEnclosedOrCrossed(left, top, right, bottom) {
|
|
12342
|
-
return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
|
|
12374
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
12375
|
+
return this.itemsIndex.listNearestTo(point, maxItems, filter, maxDistance);
|
|
12343
12376
|
}
|
|
12344
12377
|
getComments() {
|
|
12345
12378
|
return this.itemsArray.filter((item) => item.itemType === "Comment");
|
|
@@ -12357,7 +12390,7 @@ class SpatialIndex {
|
|
|
12357
12390
|
const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
|
|
12358
12391
|
return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
|
|
12359
12392
|
}
|
|
12360
|
-
|
|
12393
|
+
listAll() {
|
|
12361
12394
|
return this.getItemsWithIncludedChildren(this.itemsArray).concat();
|
|
12362
12395
|
}
|
|
12363
12396
|
getZIndex(item) {
|
|
@@ -12395,10 +12428,19 @@ class Items {
|
|
|
12395
12428
|
this.index.change(item);
|
|
12396
12429
|
}
|
|
12397
12430
|
listAll() {
|
|
12398
|
-
return this.index.
|
|
12431
|
+
return this.index.listAll();
|
|
12432
|
+
}
|
|
12433
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12434
|
+
return this.index.listUnderPoint(point, tolerance);
|
|
12435
|
+
}
|
|
12436
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12437
|
+
return this.index.listEnclosedBy(left, top, right, bottom);
|
|
12438
|
+
}
|
|
12439
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12440
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12399
12441
|
}
|
|
12400
12442
|
listGroupItems() {
|
|
12401
|
-
return this.index.
|
|
12443
|
+
return this.index.listAll().filter((item) => ("index" in item) && item.index);
|
|
12402
12444
|
}
|
|
12403
12445
|
getById(id) {
|
|
12404
12446
|
return this.index.getById(id);
|
|
@@ -12407,16 +12449,16 @@ class Items {
|
|
|
12407
12449
|
return this.index.findById(id);
|
|
12408
12450
|
}
|
|
12409
12451
|
getEnclosed(left, top, right, bottom) {
|
|
12410
|
-
return this.index.
|
|
12452
|
+
return this.index.listEnclosedBy(left, top, right, bottom);
|
|
12411
12453
|
}
|
|
12412
12454
|
getEnclosedOrCrossed(left, top, right, bottom) {
|
|
12413
|
-
return this.index.
|
|
12455
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12414
12456
|
}
|
|
12415
12457
|
getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
|
|
12416
|
-
return this.index.
|
|
12458
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom).filter((item) => ("index" in item) && item.index);
|
|
12417
12459
|
}
|
|
12418
12460
|
getUnderPoint(point, tolerance = 5) {
|
|
12419
|
-
return this.index.
|
|
12461
|
+
return this.index.listUnderPoint(point, tolerance);
|
|
12420
12462
|
}
|
|
12421
12463
|
getMbr() {
|
|
12422
12464
|
return this.index.getMbr();
|
|
@@ -12439,25 +12481,25 @@ class Items {
|
|
|
12439
12481
|
}
|
|
12440
12482
|
getInView() {
|
|
12441
12483
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12442
|
-
return this.index.
|
|
12484
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12443
12485
|
}
|
|
12444
12486
|
getItemsInView() {
|
|
12445
12487
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12446
|
-
return this.index.
|
|
12488
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12447
12489
|
}
|
|
12448
12490
|
getGroupItemsInView() {
|
|
12449
12491
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12450
12492
|
return this.getGroupItemsEnclosedOrCrossed(left, top, right, bottom);
|
|
12451
12493
|
}
|
|
12452
12494
|
getComments() {
|
|
12453
|
-
return this.
|
|
12495
|
+
return this.listAll().filter((item) => item.itemType === "Comment");
|
|
12454
12496
|
}
|
|
12455
12497
|
getUnderPointer(size = 0) {
|
|
12456
12498
|
const { x, y } = this.pointer.point;
|
|
12457
12499
|
const unmodifiedSize = size;
|
|
12458
12500
|
size = 16;
|
|
12459
|
-
const tolerated = this.index.
|
|
12460
|
-
let enclosed = tolerated.some((item) => item.itemType === "Connector") ? tolerated : this.index.
|
|
12501
|
+
const tolerated = this.index.listEnclosedOrCrossedBy(x - size, y - size, x + size, y + size);
|
|
12502
|
+
let enclosed = tolerated.some((item) => item.itemType === "Connector") ? tolerated : this.index.listEnclosedOrCrossedBy(x, y, x, y);
|
|
12461
12503
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
12462
12504
|
if (enclosed.length === 0) {
|
|
12463
12505
|
enclosed = underPointer;
|
|
@@ -12485,7 +12527,7 @@ class Items {
|
|
|
12485
12527
|
return [];
|
|
12486
12528
|
}
|
|
12487
12529
|
getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
|
|
12488
|
-
return this.index.
|
|
12530
|
+
return this.index.listNearestTo(this.pointer.point, maxItems, filter, maxDistance);
|
|
12489
12531
|
}
|
|
12490
12532
|
getZIndex(item) {
|
|
12491
12533
|
return this.index.getZIndex(item);
|
|
@@ -12627,7 +12669,6 @@ var init_SpacialIndex = __esm(() => {
|
|
|
12627
12669
|
init_Point();
|
|
12628
12670
|
init_Settings();
|
|
12629
12671
|
init_LayeredIndex();
|
|
12630
|
-
init_BaseItem();
|
|
12631
12672
|
});
|
|
12632
12673
|
|
|
12633
12674
|
// src/SpatialIndex/SimpleSpatialIndex.ts
|
|
@@ -12644,6 +12685,9 @@ class SimpleSpatialIndex {
|
|
|
12644
12685
|
this.Mbr = new Mbr;
|
|
12645
12686
|
}
|
|
12646
12687
|
insert(item) {
|
|
12688
|
+
if (this.itemsArray.includes(item) || this.getById(item.getId())) {
|
|
12689
|
+
return;
|
|
12690
|
+
}
|
|
12647
12691
|
this.itemsArray.push(item);
|
|
12648
12692
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
12649
12693
|
this.Mbr = item.getMbr().copy();
|
|
@@ -12663,9 +12707,12 @@ class SimpleSpatialIndex {
|
|
|
12663
12707
|
};
|
|
12664
12708
|
remove(item, preserveChildren = false) {
|
|
12665
12709
|
if (!preserveChildren && "index" in item && item.index) {
|
|
12666
|
-
item.removeChildItems(item.index.
|
|
12710
|
+
item.removeChildItems(item.index.listAll());
|
|
12711
|
+
}
|
|
12712
|
+
const index = this.itemsArray.indexOf(item);
|
|
12713
|
+
if (index !== -1) {
|
|
12714
|
+
this.itemsArray.splice(index, 1);
|
|
12667
12715
|
}
|
|
12668
|
-
this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
|
|
12669
12716
|
this.Mbr = new Mbr;
|
|
12670
12717
|
this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
|
|
12671
12718
|
this.subject.publish(this.items);
|
|
@@ -12748,16 +12795,13 @@ class SimpleSpatialIndex {
|
|
|
12748
12795
|
this.subject.publish(this.items);
|
|
12749
12796
|
}
|
|
12750
12797
|
getById(id) {
|
|
12751
|
-
|
|
12752
|
-
if (item) {
|
|
12753
|
-
return item;
|
|
12754
|
-
}
|
|
12798
|
+
return this.itemsArray.find((item) => item.getId() === id);
|
|
12755
12799
|
}
|
|
12756
12800
|
findById(id) {
|
|
12757
12801
|
return this.getById(id);
|
|
12758
12802
|
}
|
|
12759
|
-
|
|
12760
|
-
const mbr =
|
|
12803
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12804
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12761
12805
|
const items = [];
|
|
12762
12806
|
this.itemsArray.forEach((item) => {
|
|
12763
12807
|
if (item.isEnclosedBy(mbr)) {
|
|
@@ -12766,8 +12810,8 @@ class SimpleSpatialIndex {
|
|
|
12766
12810
|
});
|
|
12767
12811
|
return items;
|
|
12768
12812
|
}
|
|
12769
|
-
|
|
12770
|
-
const mbr =
|
|
12813
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12814
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12771
12815
|
const items = [];
|
|
12772
12816
|
this.itemsArray.forEach((item) => {
|
|
12773
12817
|
if (item.isEnclosedOrCrossedBy(mbr)) {
|
|
@@ -12776,19 +12820,30 @@ class SimpleSpatialIndex {
|
|
|
12776
12820
|
});
|
|
12777
12821
|
return items;
|
|
12778
12822
|
}
|
|
12779
|
-
|
|
12823
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12780
12824
|
const items = [];
|
|
12781
12825
|
this.itemsArray.forEach((item) => {
|
|
12782
|
-
if (item.isUnderPoint(point,
|
|
12826
|
+
if (item.isUnderPoint(point, tolerance)) {
|
|
12783
12827
|
items.push(item);
|
|
12784
12828
|
}
|
|
12785
12829
|
});
|
|
12786
12830
|
return items;
|
|
12787
12831
|
}
|
|
12832
|
+
listRectsEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12833
|
+
return this.listEnclosedOrCrossedBy(left, top, right, bottom).map((item) => item.getMbr());
|
|
12834
|
+
}
|
|
12835
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
12836
|
+
const itemsWithDistance = this.itemsArray.filter(filter).map((item) => ({
|
|
12837
|
+
item,
|
|
12838
|
+
distance: item.getMbr().getDistanceToPoint(point)
|
|
12839
|
+
}));
|
|
12840
|
+
const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
|
|
12841
|
+
return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
|
|
12842
|
+
}
|
|
12788
12843
|
getMbr() {
|
|
12789
12844
|
return this.Mbr;
|
|
12790
12845
|
}
|
|
12791
|
-
|
|
12846
|
+
listAll() {
|
|
12792
12847
|
return this.itemsArray.concat();
|
|
12793
12848
|
}
|
|
12794
12849
|
getZIndex(item) {
|
|
@@ -12860,7 +12915,7 @@ function toLocalTransformOp(op, containerMatrix, itemId) {
|
|
|
12860
12915
|
}
|
|
12861
12916
|
}
|
|
12862
12917
|
var BaseItem;
|
|
12863
|
-
var
|
|
12918
|
+
var init_BaseItem = __esm(() => {
|
|
12864
12919
|
init_Mbr();
|
|
12865
12920
|
init_LinkTo();
|
|
12866
12921
|
init_Transformation();
|
|
@@ -13059,7 +13114,10 @@ var init_BaseItem2 = __esm(() => {
|
|
|
13059
13114
|
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
13060
13115
|
if (!this.index?.getById(childId) && foundItem) {
|
|
13061
13116
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
13062
|
-
|
|
13117
|
+
const currentParentId = foundItem.parent;
|
|
13118
|
+
const currentParent = currentParentId !== "Board" ? this.board.items.getById(currentParentId) : undefined;
|
|
13119
|
+
const sourceIndex = currentParent?.index || this.board.items.index;
|
|
13120
|
+
sourceIndex.remove(foundItem, true);
|
|
13063
13121
|
foundItem.parent = this.getId();
|
|
13064
13122
|
foundItem.onParentChanged(this.getId());
|
|
13065
13123
|
foundItem.transformation.setLocalMatrix(localMatrix);
|
|
@@ -13304,7 +13362,7 @@ var init_Comment = __esm(() => {
|
|
|
13304
13362
|
init_Line2();
|
|
13305
13363
|
init_esm();
|
|
13306
13364
|
init_LinkTo();
|
|
13307
|
-
|
|
13365
|
+
init_BaseItem();
|
|
13308
13366
|
Comment = class Comment extends BaseItem {
|
|
13309
13367
|
anchor;
|
|
13310
13368
|
events;
|
|
@@ -16759,15 +16817,15 @@ var import_slate40, setLink = (editor, link, selection) => {
|
|
|
16759
16817
|
}
|
|
16760
16818
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
16761
16819
|
import_slate40.Transforms.setNodes(editor, { fontColor: format }, {
|
|
16762
|
-
match: (n) =>
|
|
16820
|
+
match: (n) => import_slate40.Text.isText(n),
|
|
16763
16821
|
split: true
|
|
16764
16822
|
});
|
|
16765
|
-
for (const [
|
|
16766
|
-
match: (n) =>
|
|
16823
|
+
for (const [, path2] of import_slate40.Editor.nodes(editor, {
|
|
16824
|
+
match: (n) => import_slate40.Text.isText(n)
|
|
16767
16825
|
})) {
|
|
16768
16826
|
const nodeRange = import_slate40.Editor.range(editor, path2);
|
|
16769
16827
|
import_slate40.Transforms.select(editor, nodeRange);
|
|
16770
|
-
import_slate40.Transforms.setNodes(editor, { link }, { split: false, match: (n) =>
|
|
16828
|
+
import_slate40.Transforms.setNodes(editor, { link }, { split: false, match: (n) => import_slate40.Text.isText(n) });
|
|
16771
16829
|
}
|
|
16772
16830
|
};
|
|
16773
16831
|
var init_setLink = __esm(() => {
|
|
@@ -27495,7 +27553,7 @@ var init_RichText = __esm(() => {
|
|
|
27495
27553
|
init_getSelectionStyles();
|
|
27496
27554
|
init_setEditorFocus();
|
|
27497
27555
|
init_getAllTextNodesInSelection();
|
|
27498
|
-
|
|
27556
|
+
init_BaseItem();
|
|
27499
27557
|
RichText = class RichText extends BaseItem {
|
|
27500
27558
|
container;
|
|
27501
27559
|
transformation;
|
|
@@ -28461,7 +28519,7 @@ var init_AINode = __esm(() => {
|
|
|
28461
28519
|
init_Matrix();
|
|
28462
28520
|
init_Transformation();
|
|
28463
28521
|
init_Settings();
|
|
28464
|
-
|
|
28522
|
+
init_BaseItem();
|
|
28465
28523
|
AINode = class AINode extends BaseItem {
|
|
28466
28524
|
itemType = "AINode";
|
|
28467
28525
|
parent = "Board";
|
|
@@ -28808,7 +28866,7 @@ var init_Audio = __esm(() => {
|
|
|
28808
28866
|
init_Point();
|
|
28809
28867
|
init_Line();
|
|
28810
28868
|
init_Settings();
|
|
28811
|
-
|
|
28869
|
+
init_BaseItem();
|
|
28812
28870
|
AudioItem = class AudioItem extends BaseItem {
|
|
28813
28871
|
events;
|
|
28814
28872
|
extension;
|
|
@@ -43805,6 +43863,11 @@ var init_ShapeData = __esm(() => {
|
|
|
43805
43863
|
];
|
|
43806
43864
|
});
|
|
43807
43865
|
|
|
43866
|
+
// src/Items/BaseItem/index.ts
|
|
43867
|
+
var init_BaseItem2 = __esm(() => {
|
|
43868
|
+
init_BaseItem();
|
|
43869
|
+
});
|
|
43870
|
+
|
|
43808
43871
|
// src/Items/Mbr/updateRects.ts
|
|
43809
43872
|
function updateRects(board, ref, mbr, verticalOffset, horizontalOffset, fit = "contextPanel") {
|
|
43810
43873
|
const { selection, camera } = board;
|
|
@@ -44075,7 +44138,7 @@ var init_ControlPoint = __esm(() => {
|
|
|
44075
44138
|
init_Transformation2();
|
|
44076
44139
|
init_RichText2();
|
|
44077
44140
|
init_AINode2();
|
|
44078
|
-
|
|
44141
|
+
init_BaseItem2();
|
|
44079
44142
|
BoardPoint = class BoardPoint extends Point {
|
|
44080
44143
|
pointType = "Board";
|
|
44081
44144
|
serialize() {
|
|
@@ -44975,7 +45038,7 @@ var init_Connector = __esm(() => {
|
|
|
44975
45038
|
init_LinkTo();
|
|
44976
45039
|
init_HTMLRender();
|
|
44977
45040
|
init_Settings();
|
|
44978
|
-
|
|
45041
|
+
init_BaseItem();
|
|
44979
45042
|
init_Color();
|
|
44980
45043
|
init_ConnectorTypes();
|
|
44981
45044
|
CONNECTOR_ANCHOR_COLOR = {
|
|
@@ -45956,7 +46019,7 @@ var init_Sticker = __esm(() => {
|
|
|
45956
46019
|
init_SessionStorage();
|
|
45957
46020
|
init_HTMLRender();
|
|
45958
46021
|
init_Settings();
|
|
45959
|
-
|
|
46022
|
+
init_BaseItem();
|
|
45960
46023
|
init_Color();
|
|
45961
46024
|
stickerColors = {
|
|
45962
46025
|
Purple: "rgb(233, 208, 255)",
|
|
@@ -47089,7 +47152,7 @@ async function exportBoardSnapshot({
|
|
|
47089
47152
|
context.ctx.setTransform(upscaleFactor, 0, 0, upscaleFactor, 0, 0);
|
|
47090
47153
|
context.matrix.applyToContext(context.ctx);
|
|
47091
47154
|
const { left, top, right, bottom } = selection;
|
|
47092
|
-
const inView = board.items.index.
|
|
47155
|
+
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
47093
47156
|
for (const item of inView) {
|
|
47094
47157
|
item.render(context);
|
|
47095
47158
|
}
|
|
@@ -47209,7 +47272,7 @@ var init_Frame = __esm(() => {
|
|
|
47209
47272
|
init_FrameData();
|
|
47210
47273
|
init_Settings();
|
|
47211
47274
|
init_getResizeMatrix();
|
|
47212
|
-
|
|
47275
|
+
init_BaseItem2();
|
|
47213
47276
|
init_Color();
|
|
47214
47277
|
defaultFrameData = new DefaultFrameData;
|
|
47215
47278
|
Frame = class Frame extends BaseItem {
|
|
@@ -47328,7 +47391,7 @@ var init_Frame = __esm(() => {
|
|
|
47328
47391
|
return this.id;
|
|
47329
47392
|
}
|
|
47330
47393
|
getChildrenIds() {
|
|
47331
|
-
return this.index?.
|
|
47394
|
+
return this.index?.listAll().map((item) => item.getId()) || [];
|
|
47332
47395
|
}
|
|
47333
47396
|
updateMbr() {
|
|
47334
47397
|
const rect = this.path.getMbr().copy();
|
|
@@ -47764,7 +47827,7 @@ var init_Video = __esm(() => {
|
|
|
47764
47827
|
init_Path2();
|
|
47765
47828
|
init_Transformation2();
|
|
47766
47829
|
init_Settings();
|
|
47767
|
-
|
|
47830
|
+
init_BaseItem();
|
|
47768
47831
|
init_MediaHelpers();
|
|
47769
47832
|
videoIcon = conf.documentFactory.createElement("img");
|
|
47770
47833
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
@@ -48407,7 +48470,7 @@ var init_Drawing = __esm(() => {
|
|
|
48407
48470
|
init_DrawingCommand();
|
|
48408
48471
|
init_LinkTo();
|
|
48409
48472
|
init_Settings();
|
|
48410
|
-
|
|
48473
|
+
init_BaseItem();
|
|
48411
48474
|
init_Color();
|
|
48412
48475
|
Drawing = class Drawing extends BaseItem {
|
|
48413
48476
|
points;
|
|
@@ -48827,7 +48890,7 @@ var init_Group = __esm(() => {
|
|
|
48827
48890
|
init_Point();
|
|
48828
48891
|
init_Transformation();
|
|
48829
48892
|
init_LinkTo();
|
|
48830
|
-
|
|
48893
|
+
init_BaseItem();
|
|
48831
48894
|
Group = class Group extends BaseItem {
|
|
48832
48895
|
events;
|
|
48833
48896
|
linkTo;
|
|
@@ -48887,7 +48950,7 @@ var init_Group = __esm(() => {
|
|
|
48887
48950
|
return this;
|
|
48888
48951
|
}
|
|
48889
48952
|
getMbr() {
|
|
48890
|
-
const children = this.index.
|
|
48953
|
+
const children = this.index.listAll();
|
|
48891
48954
|
if (children.length === 0) {
|
|
48892
48955
|
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
48893
48956
|
}
|
|
@@ -48927,10 +48990,10 @@ var init_Group = __esm(() => {
|
|
|
48927
48990
|
this.getMbr();
|
|
48928
48991
|
}
|
|
48929
48992
|
getChildrenIds() {
|
|
48930
|
-
return this.index.
|
|
48993
|
+
return this.index.listAll().map((item) => item.getId());
|
|
48931
48994
|
}
|
|
48932
48995
|
getChildren() {
|
|
48933
|
-
return this.index.
|
|
48996
|
+
return this.index.listAll();
|
|
48934
48997
|
}
|
|
48935
48998
|
getLinkTo() {
|
|
48936
48999
|
return this.linkTo.link;
|
|
@@ -48978,7 +49041,7 @@ var init_Group = __esm(() => {
|
|
|
48978
49041
|
const ctx = context.ctx;
|
|
48979
49042
|
ctx.save();
|
|
48980
49043
|
this.transformation.applyToContext(ctx);
|
|
48981
|
-
for (const child of this.index.
|
|
49044
|
+
for (const child of this.index.listAll()) {
|
|
48982
49045
|
child.render(context);
|
|
48983
49046
|
}
|
|
48984
49047
|
ctx.restore();
|
|
@@ -49086,7 +49149,7 @@ function createDrawing(id, data, board) {
|
|
|
49086
49149
|
if (!isDrawingData(data)) {
|
|
49087
49150
|
throw new Error("Invalid data for Drawing");
|
|
49088
49151
|
}
|
|
49089
|
-
const drawing = new Drawing(board, [], board.events).setId(id).deserialize({ ...data, id });
|
|
49152
|
+
const drawing = new Drawing(board, [], board.events).setId(id).setId(id).deserialize({ ...data, id });
|
|
49090
49153
|
return drawing;
|
|
49091
49154
|
}
|
|
49092
49155
|
function createFrame(id, data, board) {
|
|
@@ -49107,7 +49170,7 @@ function createGroup(id, data, board) {
|
|
|
49107
49170
|
if (!isGroupData(data)) {
|
|
49108
49171
|
throw new Error("Invalid data for Group");
|
|
49109
49172
|
}
|
|
49110
|
-
const group = new Group(board, board.events, data.
|
|
49173
|
+
const group = new Group(board, board.events, data.childIds, id).setId(id).deserialize({ ...data, id });
|
|
49111
49174
|
return group;
|
|
49112
49175
|
}
|
|
49113
49176
|
function isStickerData(data) {
|
|
@@ -51645,7 +51708,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
51645
51708
|
}
|
|
51646
51709
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
51647
51710
|
let step = 1;
|
|
51648
|
-
while (board.index.
|
|
51711
|
+
while (board.index.listEnclosedOrCrossedBy(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
|
|
51649
51712
|
const xDirection = step % 2 === 0 ? -1 : 1;
|
|
51650
51713
|
const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
|
|
51651
51714
|
newMbr.transform(new Matrix(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
|
|
@@ -51887,7 +51950,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
51887
51950
|
var offsets;
|
|
51888
51951
|
var init_QuickAddButtons2 = __esm(() => {
|
|
51889
51952
|
init_Items();
|
|
51890
|
-
|
|
51953
|
+
init_BaseItem();
|
|
51891
51954
|
init_SessionStorage();
|
|
51892
51955
|
init_QuickAddButtons();
|
|
51893
51956
|
init_quickAddHelpers();
|
|
@@ -52320,7 +52383,7 @@ class AlignmentHelper {
|
|
|
52320
52383
|
var RELATIVE_ALIGNMENT_COLOR = "#4778F5";
|
|
52321
52384
|
var init_RelativeAlignment = __esm(() => {
|
|
52322
52385
|
init_Items();
|
|
52323
|
-
|
|
52386
|
+
init_BaseItem2();
|
|
52324
52387
|
});
|
|
52325
52388
|
|
|
52326
52389
|
// src/Tools/RelativeAlignment/index.ts
|
|
@@ -53921,7 +53984,7 @@ var init_AddStar = __esm(() => {
|
|
|
53921
53984
|
// src/Items/Examples/Star/Star.ts
|
|
53922
53985
|
var defaultStarData, starPath, Star2;
|
|
53923
53986
|
var init_Star2 = __esm(() => {
|
|
53924
|
-
|
|
53987
|
+
init_BaseItem();
|
|
53925
53988
|
init_Point();
|
|
53926
53989
|
init_Path();
|
|
53927
53990
|
init_Line();
|
|
@@ -54103,7 +54166,7 @@ var init_AddCounter = __esm(() => {
|
|
|
54103
54166
|
// src/Items/Examples/Counter/Counter.ts
|
|
54104
54167
|
var defaultCounterData, COUNTER_DIMENSIONS, Counter;
|
|
54105
54168
|
var init_Counter = __esm(() => {
|
|
54106
|
-
|
|
54169
|
+
init_BaseItem();
|
|
54107
54170
|
init_Point();
|
|
54108
54171
|
init_Path();
|
|
54109
54172
|
init_Line();
|
|
@@ -54222,7 +54285,7 @@ var init_HotkeyRegistry = __esm(() => {
|
|
|
54222
54285
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
54223
54286
|
var defaultCardData, Card;
|
|
54224
54287
|
var init_Card = __esm(() => {
|
|
54225
|
-
|
|
54288
|
+
init_BaseItem();
|
|
54226
54289
|
init_Path();
|
|
54227
54290
|
init_RegisterItem();
|
|
54228
54291
|
init_Settings();
|
|
@@ -54472,7 +54535,7 @@ function createDeck(event, board) {
|
|
|
54472
54535
|
if (single && single.itemType === "Deck") {
|
|
54473
54536
|
return;
|
|
54474
54537
|
}
|
|
54475
|
-
const cardsOrDecks = board.selection.items.
|
|
54538
|
+
const cardsOrDecks = board.selection.items.listAll();
|
|
54476
54539
|
const onlyCards = board.selection.items.isAllItemsType("Card");
|
|
54477
54540
|
if (onlyCards) {
|
|
54478
54541
|
const deck = new Deck(board, "");
|
|
@@ -54488,12 +54551,12 @@ function createDeck(event, board) {
|
|
|
54488
54551
|
if (item.itemType === "Card") {
|
|
54489
54552
|
cards.push(item);
|
|
54490
54553
|
} else if (item.itemType === "Deck") {
|
|
54554
|
+
const deck = item;
|
|
54491
54555
|
if (mainDeck) {
|
|
54492
|
-
cards.push(...
|
|
54493
|
-
board.remove(
|
|
54494
|
-
mainDeck = item;
|
|
54556
|
+
cards.push(...deck.getDeck());
|
|
54557
|
+
board.remove(deck);
|
|
54495
54558
|
} else {
|
|
54496
|
-
mainDeck =
|
|
54559
|
+
mainDeck = deck;
|
|
54497
54560
|
}
|
|
54498
54561
|
}
|
|
54499
54562
|
});
|
|
@@ -54506,9 +54569,10 @@ function createDeck(event, board) {
|
|
|
54506
54569
|
}
|
|
54507
54570
|
var defaultDeckData, Deck;
|
|
54508
54571
|
var init_Deck = __esm(() => {
|
|
54509
|
-
|
|
54572
|
+
init_BaseItem();
|
|
54510
54573
|
init_RegisterItem();
|
|
54511
54574
|
init_Card();
|
|
54575
|
+
init_DrawingContext();
|
|
54512
54576
|
init_Settings();
|
|
54513
54577
|
init_Path2();
|
|
54514
54578
|
init_HotkeyRegistry();
|
|
@@ -54527,9 +54591,9 @@ var init_Deck = __esm(() => {
|
|
|
54527
54591
|
drawingContext = null;
|
|
54528
54592
|
constructor(board, id = "") {
|
|
54529
54593
|
super(board, id, defaultDeckData, true);
|
|
54530
|
-
this.index.
|
|
54531
|
-
this.index.
|
|
54532
|
-
this.index.
|
|
54594
|
+
this.index.listUnderPoint = () => [];
|
|
54595
|
+
this.index.listEnclosedBy = () => [];
|
|
54596
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
54533
54597
|
this.transformation.subject.subscribe(() => {
|
|
54534
54598
|
this.updateMbr();
|
|
54535
54599
|
this.subject.publish(this);
|
|
@@ -54551,7 +54615,7 @@ var init_Deck = __esm(() => {
|
|
|
54551
54615
|
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
|
|
54552
54616
|
if (canAddItem) {
|
|
54553
54617
|
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
54554
|
-
foundItem.transformation.setLocal(this.left + (this.index?.
|
|
54618
|
+
foundItem.transformation.setLocal(this.left + (this.index?.listAll().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET), this.top + (this.index?.listAll().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0));
|
|
54555
54619
|
if (firstCard) {
|
|
54556
54620
|
const { scaleX, scaleY } = foundItem.transformation.getMatrixData();
|
|
54557
54621
|
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.getMatrixData();
|
|
@@ -54591,31 +54655,33 @@ var init_Deck = __esm(() => {
|
|
|
54591
54655
|
this.subject.publish(this);
|
|
54592
54656
|
}
|
|
54593
54657
|
getDeck() {
|
|
54594
|
-
return this.index?.
|
|
54658
|
+
return this.index?.listAll() || [];
|
|
54595
54659
|
}
|
|
54596
54660
|
getTopCard() {
|
|
54597
|
-
const
|
|
54661
|
+
const cards = this.index?.listAll() || [];
|
|
54662
|
+
const card = cards[cards.length - 1];
|
|
54598
54663
|
if (card) {
|
|
54599
54664
|
this.removeChildItems(card);
|
|
54600
54665
|
return card;
|
|
54601
54666
|
}
|
|
54602
54667
|
}
|
|
54603
54668
|
getCards(count) {
|
|
54604
|
-
const cards = this.index?.
|
|
54605
|
-
if (cards) {
|
|
54669
|
+
const cards = (this.index?.listAll() || []).reverse().slice(0, count);
|
|
54670
|
+
if (cards.length > 0) {
|
|
54606
54671
|
this.removeChildItems(cards);
|
|
54607
54672
|
return cards;
|
|
54608
54673
|
}
|
|
54609
54674
|
}
|
|
54610
54675
|
getBottomCard() {
|
|
54611
|
-
const card = this.index?.
|
|
54676
|
+
const card = this.index?.listAll()[0];
|
|
54612
54677
|
if (card) {
|
|
54613
54678
|
this.removeChildItems(card);
|
|
54614
54679
|
return card;
|
|
54615
54680
|
}
|
|
54616
54681
|
}
|
|
54617
54682
|
getRandomCard() {
|
|
54618
|
-
const
|
|
54683
|
+
const cards = this.index?.listAll() || [];
|
|
54684
|
+
const card = cards[Math.floor(Math.random() * cards.length)];
|
|
54619
54685
|
if (card) {
|
|
54620
54686
|
this.removeChildItems(card);
|
|
54621
54687
|
return card;
|
|
@@ -54625,20 +54691,20 @@ var init_Deck = __esm(() => {
|
|
|
54625
54691
|
if (!this.index) {
|
|
54626
54692
|
return;
|
|
54627
54693
|
}
|
|
54628
|
-
const shuffled = [...this.index.
|
|
54694
|
+
const shuffled = [...this.index.listAll()];
|
|
54629
54695
|
for (let i = shuffled.length - 1;i > 0; i--) {
|
|
54630
54696
|
const j = Math.floor(Math.random() * (i + 1));
|
|
54631
54697
|
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
|
54632
54698
|
}
|
|
54633
54699
|
this.emitAnimation();
|
|
54634
|
-
this.removeChildItems(this.index.
|
|
54700
|
+
this.removeChildItems(this.index.listAll());
|
|
54635
54701
|
this.addChildItems(shuffled);
|
|
54636
54702
|
}
|
|
54637
54703
|
flipDeck() {
|
|
54638
|
-
if (!this.index || !this.index.
|
|
54704
|
+
if (!this.index || !this.index.listAll().length) {
|
|
54639
54705
|
return;
|
|
54640
54706
|
}
|
|
54641
|
-
const cards = this.index.
|
|
54707
|
+
const cards = this.index.listAll();
|
|
54642
54708
|
cards[0].toggleIsOpen(cards);
|
|
54643
54709
|
const reversed = [...cards].reverse();
|
|
54644
54710
|
this.removeChildItems(cards);
|
|
@@ -54659,7 +54725,7 @@ var init_Deck = __esm(() => {
|
|
|
54659
54725
|
}
|
|
54660
54726
|
updateMbr() {
|
|
54661
54727
|
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
54662
|
-
const items = this.index.
|
|
54728
|
+
const items = this.index.listAll();
|
|
54663
54729
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
54664
54730
|
this.left = translateX;
|
|
54665
54731
|
this.top = translateY;
|
|
@@ -54727,7 +54793,7 @@ var init_Deck = __esm(() => {
|
|
|
54727
54793
|
}
|
|
54728
54794
|
renderHTML(documentFactory) {
|
|
54729
54795
|
const div = super.renderHTML(documentFactory);
|
|
54730
|
-
const cards = this.index?.
|
|
54796
|
+
const cards = this.index?.listAll();
|
|
54731
54797
|
const topCard = cards[cards.length - 1];
|
|
54732
54798
|
if (!topCard) {
|
|
54733
54799
|
return div;
|
|
@@ -54736,7 +54802,7 @@ var init_Deck = __esm(() => {
|
|
|
54736
54802
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
54737
54803
|
const topCardElement = topCard.renderHTML(documentFactory);
|
|
54738
54804
|
div.appendChild(topCardElement);
|
|
54739
|
-
const offset = ((this.index?.
|
|
54805
|
+
const offset = ((this.index?.listAll().length || 0) - 1) * 2;
|
|
54740
54806
|
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
54741
54807
|
div.id = this.getId();
|
|
54742
54808
|
div.style.width = `${this.getWidth()}px`;
|
|
@@ -54749,7 +54815,7 @@ var init_Deck = __esm(() => {
|
|
|
54749
54815
|
return div;
|
|
54750
54816
|
}
|
|
54751
54817
|
updateCache(context) {
|
|
54752
|
-
const cards = this.index?.
|
|
54818
|
+
const cards = this.index?.listAll();
|
|
54753
54819
|
const topCard = cards[cards.length - 1];
|
|
54754
54820
|
const topCardImage = topCard?.getImage();
|
|
54755
54821
|
const width2 = this.getWidth();
|
|
@@ -54763,7 +54829,7 @@ var init_Deck = __esm(() => {
|
|
|
54763
54829
|
const tempCtx = tempCanvas.getContext("2d");
|
|
54764
54830
|
if (!tempCtx)
|
|
54765
54831
|
return;
|
|
54766
|
-
const tempContext =
|
|
54832
|
+
const tempContext = new DrawingContext(context.camera, tempCtx, context.cursorCtx, context.matrix);
|
|
54767
54833
|
cards.forEach((_, index2) => {
|
|
54768
54834
|
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
54769
54835
|
});
|
|
@@ -54772,7 +54838,7 @@ var init_Deck = __esm(() => {
|
|
|
54772
54838
|
this.updateMbr();
|
|
54773
54839
|
}
|
|
54774
54840
|
getFirstCard() {
|
|
54775
|
-
return this.index?.
|
|
54841
|
+
return this.index?.listAll()[0];
|
|
54776
54842
|
}
|
|
54777
54843
|
};
|
|
54778
54844
|
registerItem({
|
|
@@ -54906,7 +54972,7 @@ var init_AddDice = __esm(() => {
|
|
|
54906
54972
|
// src/Items/Examples/CardGame/Dice/Dice.ts
|
|
54907
54973
|
var TIMEOUT = 2000, defaultDiceData, Dice;
|
|
54908
54974
|
var init_Dice = __esm(() => {
|
|
54909
|
-
|
|
54975
|
+
init_BaseItem();
|
|
54910
54976
|
init_Items();
|
|
54911
54977
|
init_RoundedRectangle();
|
|
54912
54978
|
init_Items();
|
|
@@ -55307,7 +55373,7 @@ var init_AddScreen = __esm(() => {
|
|
|
55307
55373
|
// src/Items/Examples/CardGame/Screen/Screen.ts
|
|
55308
55374
|
var screenPath, defaultScreenData, Screen;
|
|
55309
55375
|
var init_Screen = __esm(() => {
|
|
55310
|
-
|
|
55376
|
+
init_BaseItem();
|
|
55311
55377
|
init_RegisterItem();
|
|
55312
55378
|
init_Path2();
|
|
55313
55379
|
init_Line2();
|
|
@@ -55454,9 +55520,9 @@ var init_Screen = __esm(() => {
|
|
|
55454
55520
|
applyOwnerId(ownerId) {
|
|
55455
55521
|
this.ownerId = ownerId;
|
|
55456
55522
|
if (!this.ownerId) {
|
|
55457
|
-
this.index.
|
|
55458
|
-
this.index.
|
|
55459
|
-
this.index.
|
|
55523
|
+
this.index.listUnderPoint = () => [];
|
|
55524
|
+
this.index.listEnclosedBy = () => [];
|
|
55525
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
55460
55526
|
}
|
|
55461
55527
|
}
|
|
55462
55528
|
transformPath() {
|
|
@@ -55479,16 +55545,17 @@ var init_Screen = __esm(() => {
|
|
|
55479
55545
|
this.applyBackgroundUrl(this.backgroundUrl);
|
|
55480
55546
|
}
|
|
55481
55547
|
if (!this.ownerId) {
|
|
55482
|
-
this.index.
|
|
55483
|
-
this.index.
|
|
55484
|
-
this.index.
|
|
55548
|
+
this.index.listUnderPoint = () => [];
|
|
55549
|
+
this.index.listEnclosedBy = () => [];
|
|
55550
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
55485
55551
|
}
|
|
55486
55552
|
this.transformPath();
|
|
55487
55553
|
this.subject.publish(this);
|
|
55488
55554
|
return this;
|
|
55489
55555
|
}
|
|
55490
55556
|
getRandomItem() {
|
|
55491
|
-
const
|
|
55557
|
+
const items = this.index?.listAll() || [];
|
|
55558
|
+
const item = items[Math.floor(Math.random() * items.length)];
|
|
55492
55559
|
if (item) {
|
|
55493
55560
|
this.removeChildItems(item);
|
|
55494
55561
|
return item;
|
|
@@ -55537,7 +55604,7 @@ var init_Screen2 = __esm(() => {
|
|
|
55537
55604
|
|
|
55538
55605
|
// src/Items/index.ts
|
|
55539
55606
|
var init_Items = __esm(() => {
|
|
55540
|
-
|
|
55607
|
+
init_BaseItem2();
|
|
55541
55608
|
init_Point2();
|
|
55542
55609
|
init_Line2();
|
|
55543
55610
|
init_Curve2();
|
|
@@ -56412,7 +56479,7 @@ var init_Shape = __esm(() => {
|
|
|
56412
56479
|
init_Connector2();
|
|
56413
56480
|
init_ControlPoint();
|
|
56414
56481
|
init_Settings();
|
|
56415
|
-
|
|
56482
|
+
init_BaseItem();
|
|
56416
56483
|
init_Color();
|
|
56417
56484
|
defaultShapeData = new DefaultShapeData;
|
|
56418
56485
|
Shapes = { ...BasicShapes, ...BPMN };
|
|
@@ -56938,7 +57005,7 @@ var init_Placeholder2 = __esm(() => {
|
|
|
56938
57005
|
init_Transformation();
|
|
56939
57006
|
init_PlaceholderCommand();
|
|
56940
57007
|
init_getResizeMatrix();
|
|
56941
|
-
|
|
57008
|
+
init_BaseItem();
|
|
56942
57009
|
Placeholder2 = class Placeholder2 extends BaseItem {
|
|
56943
57010
|
events;
|
|
56944
57011
|
miroData;
|
|
@@ -57247,7 +57314,7 @@ var init_Image = __esm(() => {
|
|
|
57247
57314
|
init_Placeholder2();
|
|
57248
57315
|
init_LinkTo();
|
|
57249
57316
|
init_Settings();
|
|
57250
|
-
|
|
57317
|
+
init_BaseItem();
|
|
57251
57318
|
init_MediaHelpers();
|
|
57252
57319
|
ImageItem = class ImageItem extends BaseItem {
|
|
57253
57320
|
events;
|
|
@@ -57810,10 +57877,20 @@ function handleBoardEventMessage(message, board) {
|
|
|
57810
57877
|
if (isEventFromCurrentUser) {
|
|
57811
57878
|
return;
|
|
57812
57879
|
}
|
|
57813
|
-
|
|
57814
|
-
|
|
57815
|
-
|
|
57816
|
-
|
|
57880
|
+
if ("operations" in event.body) {
|
|
57881
|
+
log.insertEventsFromOtherConnections({
|
|
57882
|
+
...event,
|
|
57883
|
+
body: {
|
|
57884
|
+
...event.body,
|
|
57885
|
+
userId: Number(message.userId)
|
|
57886
|
+
}
|
|
57887
|
+
});
|
|
57888
|
+
} else {
|
|
57889
|
+
log.insertEventsFromOtherConnections({
|
|
57890
|
+
...event,
|
|
57891
|
+
userId: Number(message.userId)
|
|
57892
|
+
});
|
|
57893
|
+
}
|
|
57817
57894
|
const last = log.getLastConfirmed();
|
|
57818
57895
|
if (last) {
|
|
57819
57896
|
board.events.subject.publish(last);
|
|
@@ -57831,7 +57908,7 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
57831
57908
|
handleHTMLSnapshotApplication(msg.JSONSnapshot, board);
|
|
57832
57909
|
log.list.clearConfirmedRecords();
|
|
57833
57910
|
}
|
|
57834
|
-
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
57911
|
+
handleBoardEventListApplication(expandEvents(msg.eventsSinceLastSnapshot), board);
|
|
57835
57912
|
board.setInterfaceType(msg.mode);
|
|
57836
57913
|
board.subject.publish();
|
|
57837
57914
|
onBoardLoad(board);
|
|
@@ -60238,7 +60315,7 @@ init_Settings();
|
|
|
60238
60315
|
init_QuickAddButtons3();
|
|
60239
60316
|
|
|
60240
60317
|
// src/Selection/SelectionItems.ts
|
|
60241
|
-
|
|
60318
|
+
init_BaseItem2();
|
|
60242
60319
|
|
|
60243
60320
|
class SelectionItems {
|
|
60244
60321
|
items = new Map;
|
|
@@ -60265,6 +60342,9 @@ class SelectionItems {
|
|
|
60265
60342
|
list() {
|
|
60266
60343
|
return Array.from(this.items.values());
|
|
60267
60344
|
}
|
|
60345
|
+
listAll() {
|
|
60346
|
+
return this.list();
|
|
60347
|
+
}
|
|
60268
60348
|
isEmpty() {
|
|
60269
60349
|
return this.items.size === 0;
|
|
60270
60350
|
}
|
|
@@ -60560,7 +60640,7 @@ init_RichText();
|
|
|
60560
60640
|
init_AINode();
|
|
60561
60641
|
init_Sticker();
|
|
60562
60642
|
init_Frame();
|
|
60563
|
-
|
|
60643
|
+
init_BaseItem2();
|
|
60564
60644
|
function handleMultipleItemsResize({
|
|
60565
60645
|
board,
|
|
60566
60646
|
resize,
|
|
@@ -60943,7 +61023,7 @@ init_Image();
|
|
|
60943
61023
|
init_SessionStorage();
|
|
60944
61024
|
init_Point();
|
|
60945
61025
|
init_Items();
|
|
60946
|
-
|
|
61026
|
+
init_BaseItem2();
|
|
60947
61027
|
function transformItems({
|
|
60948
61028
|
board,
|
|
60949
61029
|
selection,
|
|
@@ -63728,8 +63808,9 @@ class Board {
|
|
|
63728
63808
|
const data = Array.from(items.children).map((el) => this.parseHTML(el));
|
|
63729
63809
|
for (const parsedData of data) {
|
|
63730
63810
|
if ("childrenMap" in parsedData) {
|
|
63731
|
-
const
|
|
63732
|
-
const
|
|
63811
|
+
const frameData = parsedData;
|
|
63812
|
+
const addedFrame = this.add(this.createItem(this.getNewItemId(), frameData.data));
|
|
63813
|
+
const addedChildren = Object.values(frameData.childrenMap).map((childData) => {
|
|
63733
63814
|
const created = this.createItem(this.getNewItemId(), childData);
|
|
63734
63815
|
const added = this.add(created);
|
|
63735
63816
|
idsMap[childData.id] = added.getId();
|
|
@@ -63742,17 +63823,18 @@ class Board {
|
|
|
63742
63823
|
return added;
|
|
63743
63824
|
});
|
|
63744
63825
|
addedFrame.addChildItems(addedChildren);
|
|
63745
|
-
|
|
63746
|
-
idsMap[
|
|
63826
|
+
frameData.data.children = addedChildren.map((item) => item.getId());
|
|
63827
|
+
idsMap[frameData.data.id] = addedFrame.getId();
|
|
63747
63828
|
} else {
|
|
63748
|
-
const
|
|
63829
|
+
const itemData = parsedData;
|
|
63830
|
+
const added = this.add(this.createItem(this.getNewItemId(), itemData));
|
|
63749
63831
|
if (added.itemType === "Connector") {
|
|
63750
63832
|
addedConnectors.push({
|
|
63751
63833
|
item: added,
|
|
63752
|
-
data:
|
|
63834
|
+
data: itemData
|
|
63753
63835
|
});
|
|
63754
63836
|
}
|
|
63755
|
-
idsMap[
|
|
63837
|
+
idsMap[itemData.id] = added.getId();
|
|
63756
63838
|
}
|
|
63757
63839
|
}
|
|
63758
63840
|
addedConnectors.forEach((connector) => {
|
|
@@ -63796,12 +63878,13 @@ class Board {
|
|
|
63796
63878
|
this.index.insert(item);
|
|
63797
63879
|
return item;
|
|
63798
63880
|
};
|
|
63799
|
-
for (const
|
|
63800
|
-
if ("childrenMap" in
|
|
63801
|
-
|
|
63802
|
-
|
|
63881
|
+
for (const rawItemData of items) {
|
|
63882
|
+
if ("childrenMap" in rawItemData) {
|
|
63883
|
+
const frameData = rawItemData;
|
|
63884
|
+
Object.values(frameData.childrenMap).map((childData) => addItem(childData));
|
|
63885
|
+
addItem(frameData.data);
|
|
63803
63886
|
} else {
|
|
63804
|
-
addItem(
|
|
63887
|
+
addItem(rawItemData);
|
|
63805
63888
|
}
|
|
63806
63889
|
}
|
|
63807
63890
|
for (const key in createdConnectors) {
|
|
@@ -64234,8 +64317,9 @@ class Board {
|
|
|
64234
64317
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
64235
64318
|
}
|
|
64236
64319
|
}
|
|
64237
|
-
|
|
64238
|
-
|
|
64320
|
+
const itemDataWithChildren = itemData;
|
|
64321
|
+
if ("children" in itemDataWithChildren && itemDataWithChildren.children?.length) {
|
|
64322
|
+
itemDataWithChildren.children = itemDataWithChildren.children.map((childId) => newItemIdMap[childId]);
|
|
64239
64323
|
}
|
|
64240
64324
|
newMap[newItemId] = itemData;
|
|
64241
64325
|
}
|
|
@@ -64418,7 +64502,7 @@ function initI18N(i18nInstance) {
|
|
|
64418
64502
|
// src/index.ts
|
|
64419
64503
|
init_MediaHelpers();
|
|
64420
64504
|
init_CreateCommand();
|
|
64421
|
-
|
|
64505
|
+
init_BaseItem();
|
|
64422
64506
|
init_Events();
|
|
64423
64507
|
BaseItem.createCommand = createCommand;
|
|
64424
64508
|
Events.createCommand = createCommand;
|