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/browser.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
|
};
|
|
@@ -11595,7 +11603,7 @@ class RTreeIndex {
|
|
|
11595
11603
|
this.tree.remove(item);
|
|
11596
11604
|
}
|
|
11597
11605
|
}
|
|
11598
|
-
|
|
11606
|
+
listAll() {
|
|
11599
11607
|
const containers = this.tree.all();
|
|
11600
11608
|
const items = [];
|
|
11601
11609
|
for (const container of containers) {
|
|
@@ -11603,7 +11611,7 @@ class RTreeIndex {
|
|
|
11603
11611
|
}
|
|
11604
11612
|
return items;
|
|
11605
11613
|
}
|
|
11606
|
-
|
|
11614
|
+
listEnclosedBy(rect) {
|
|
11607
11615
|
return this.tree.search({
|
|
11608
11616
|
minX: rect.left,
|
|
11609
11617
|
minY: rect.top,
|
|
@@ -11611,7 +11619,7 @@ class RTreeIndex {
|
|
|
11611
11619
|
maxY: rect.bottom
|
|
11612
11620
|
}).filter((container) => container.item.isEnclosedBy(rect)).map((container) => container.item);
|
|
11613
11621
|
}
|
|
11614
|
-
|
|
11622
|
+
listEnclosedOrCrossedBy(rect) {
|
|
11615
11623
|
return this.tree.search({
|
|
11616
11624
|
minX: rect.left,
|
|
11617
11625
|
minY: rect.top,
|
|
@@ -11619,7 +11627,7 @@ class RTreeIndex {
|
|
|
11619
11627
|
maxY: rect.bottom
|
|
11620
11628
|
}).filter((container) => container.item.isEnclosedOrCrossedBy(rect)).map((container) => container.item);
|
|
11621
11629
|
}
|
|
11622
|
-
|
|
11630
|
+
listUnderPoint(point, tolerance = 5) {
|
|
11623
11631
|
return this.tree.search({
|
|
11624
11632
|
minX: point.x,
|
|
11625
11633
|
minY: point.y,
|
|
@@ -11627,7 +11635,7 @@ class RTreeIndex {
|
|
|
11627
11635
|
maxY: point.y
|
|
11628
11636
|
}).filter((container) => container.item.isUnderPoint(point, tolerance)).map((container) => container.item);
|
|
11629
11637
|
}
|
|
11630
|
-
|
|
11638
|
+
listRectsEnclosedOrCrossedBy(rect) {
|
|
11631
11639
|
return this.tree.search({
|
|
11632
11640
|
minX: rect.left,
|
|
11633
11641
|
minY: rect.top,
|
|
@@ -11643,9 +11651,27 @@ class RTreeIndex {
|
|
|
11643
11651
|
maxY: rect.bottom
|
|
11644
11652
|
});
|
|
11645
11653
|
}
|
|
11646
|
-
|
|
11654
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
11647
11655
|
return knn(this.tree, point.x, point.y, maxItems, (container) => filter(container.item), maxDistance).map((container) => container.item);
|
|
11648
11656
|
}
|
|
11657
|
+
getById(id) {
|
|
11658
|
+
return this.listAll().find((item) => item.getId() === id);
|
|
11659
|
+
}
|
|
11660
|
+
findById(id) {
|
|
11661
|
+
return this.getById(id);
|
|
11662
|
+
}
|
|
11663
|
+
getByZIndex(index) {
|
|
11664
|
+
return this.listAll()[index];
|
|
11665
|
+
}
|
|
11666
|
+
getLastZIndex() {
|
|
11667
|
+
return this.listAll().length - 1;
|
|
11668
|
+
}
|
|
11669
|
+
copy() {
|
|
11670
|
+
return this.listAll().map((item) => ({
|
|
11671
|
+
...item.serialize(),
|
|
11672
|
+
id: item.getId()
|
|
11673
|
+
}));
|
|
11674
|
+
}
|
|
11649
11675
|
batchInsert(batch) {
|
|
11650
11676
|
for (const one of batch) {
|
|
11651
11677
|
this.insert(one);
|
|
@@ -11717,35 +11743,31 @@ class LayeredIndex {
|
|
|
11717
11743
|
isT(item) {
|
|
11718
11744
|
return true;
|
|
11719
11745
|
}
|
|
11720
|
-
|
|
11721
|
-
const container = this.map.get(id);
|
|
11722
|
-
return container ? container.item : undefined;
|
|
11723
|
-
}
|
|
11724
|
-
getEnclosed(rect) {
|
|
11746
|
+
listEnclosedBy(rect) {
|
|
11725
11747
|
let items = [];
|
|
11726
11748
|
for (const layer of this.layers.array) {
|
|
11727
|
-
items = items.concat(layer.
|
|
11749
|
+
items = items.concat(layer.listEnclosedBy(rect));
|
|
11728
11750
|
}
|
|
11729
11751
|
return items;
|
|
11730
11752
|
}
|
|
11731
|
-
|
|
11753
|
+
listEnclosedOrCrossedBy(rect) {
|
|
11732
11754
|
let items = [];
|
|
11733
11755
|
for (const layer of this.layers.array) {
|
|
11734
|
-
items = items.concat(layer.
|
|
11756
|
+
items = items.concat(layer.listEnclosedOrCrossedBy(rect));
|
|
11735
11757
|
}
|
|
11736
11758
|
return items;
|
|
11737
11759
|
}
|
|
11738
|
-
|
|
11760
|
+
listUnderPoint(point, tolerance = 5) {
|
|
11739
11761
|
let items = [];
|
|
11740
11762
|
for (const layer of this.layers.array) {
|
|
11741
|
-
const layerItems = layer.
|
|
11763
|
+
const layerItems = layer.listUnderPoint(point, tolerance);
|
|
11742
11764
|
if (layerItems.length > 0) {
|
|
11743
11765
|
items = items.concat(layerItems);
|
|
11744
11766
|
}
|
|
11745
11767
|
}
|
|
11746
11768
|
return items;
|
|
11747
11769
|
}
|
|
11748
|
-
|
|
11770
|
+
listRectsEnclosedOrCrossedBy(rect) {
|
|
11749
11771
|
const items = [];
|
|
11750
11772
|
const minMax = {
|
|
11751
11773
|
minX: rect.left,
|
|
@@ -11769,10 +11791,10 @@ class LayeredIndex {
|
|
|
11769
11791
|
}
|
|
11770
11792
|
return false;
|
|
11771
11793
|
}
|
|
11772
|
-
|
|
11794
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
11773
11795
|
let items = [];
|
|
11774
11796
|
for (const layer of this.layers.array) {
|
|
11775
|
-
items = items.concat(layer.
|
|
11797
|
+
items = items.concat(layer.listNearestTo(point, maxItems, filter, maxDistance));
|
|
11776
11798
|
}
|
|
11777
11799
|
return items;
|
|
11778
11800
|
}
|
|
@@ -11806,7 +11828,7 @@ class LayeredIndex {
|
|
|
11806
11828
|
}
|
|
11807
11829
|
const bounds = container.item.getMbrWithChildren();
|
|
11808
11830
|
this.remove(container.item);
|
|
11809
|
-
const inBounds = this.
|
|
11831
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11810
11832
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
11811
11833
|
const containersAbove = [];
|
|
11812
11834
|
const containerZIndex = this.getZIndex(container.item);
|
|
@@ -11834,7 +11856,7 @@ class LayeredIndex {
|
|
|
11834
11856
|
}
|
|
11835
11857
|
const bounds = container.item.getMbrWithChildren();
|
|
11836
11858
|
this.remove(container.item);
|
|
11837
|
-
const inBounds = this.
|
|
11859
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11838
11860
|
const containersInBounds = this.getContainersFromItems(inBounds);
|
|
11839
11861
|
const containersBelow = [];
|
|
11840
11862
|
const containerZIndex = this.getZIndex(container.item);
|
|
@@ -11859,7 +11881,7 @@ class LayeredIndex {
|
|
|
11859
11881
|
insert(item) {
|
|
11860
11882
|
const toInsert = new Container(item.getId(), item, 0, this.getZIndex(item));
|
|
11861
11883
|
const bounds = item.getMbrWithChildren();
|
|
11862
|
-
const inBounds = this.
|
|
11884
|
+
const inBounds = this.listRectsEnclosedOrCrossedBy(bounds);
|
|
11863
11885
|
if (inBounds.length === 0) {
|
|
11864
11886
|
return this.insertContainer(toInsert);
|
|
11865
11887
|
}
|
|
@@ -11956,13 +11978,32 @@ class LayeredIndex {
|
|
|
11956
11978
|
return;
|
|
11957
11979
|
}
|
|
11958
11980
|
}
|
|
11959
|
-
|
|
11981
|
+
listAll() {
|
|
11960
11982
|
const items = [];
|
|
11961
11983
|
for (const record of this.map) {
|
|
11962
11984
|
items.push(record[1].item);
|
|
11963
11985
|
}
|
|
11964
11986
|
return items;
|
|
11965
11987
|
}
|
|
11988
|
+
getById(id) {
|
|
11989
|
+
const container = this.map.get(id);
|
|
11990
|
+
return container ? container.item : undefined;
|
|
11991
|
+
}
|
|
11992
|
+
findById(id) {
|
|
11993
|
+
return this.getById(id);
|
|
11994
|
+
}
|
|
11995
|
+
getByZIndex(index) {
|
|
11996
|
+
return this.listAll()[index];
|
|
11997
|
+
}
|
|
11998
|
+
getLastZIndex() {
|
|
11999
|
+
return this.listAll().length - 1;
|
|
12000
|
+
}
|
|
12001
|
+
copy() {
|
|
12002
|
+
return this.listAll().map((item) => ({
|
|
12003
|
+
...item.serialize(),
|
|
12004
|
+
id: item.getId()
|
|
12005
|
+
}));
|
|
12006
|
+
}
|
|
11966
12007
|
batchInsert(items) {
|
|
11967
12008
|
for (const item of items) {
|
|
11968
12009
|
this.insert(item);
|
|
@@ -11979,11 +12020,6 @@ var init_LayeredIndex = __esm(() => {
|
|
|
11979
12020
|
init_RTreeIndex();
|
|
11980
12021
|
});
|
|
11981
12022
|
|
|
11982
|
-
// src/Items/BaseItem/index.ts
|
|
11983
|
-
var init_BaseItem = __esm(() => {
|
|
11984
|
-
init_BaseItem2();
|
|
11985
|
-
});
|
|
11986
|
-
|
|
11987
12023
|
// src/SpatialIndex/SpacialIndex.ts
|
|
11988
12024
|
function worldBoundsToLocal(container, left, top, right, bottom) {
|
|
11989
12025
|
const inv = container.getNestingMatrix().getInverse();
|
|
@@ -12002,6 +12038,13 @@ function worldBoundsToLocal(container, left, top, right, bottom) {
|
|
|
12002
12038
|
bottom: Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y)
|
|
12003
12039
|
};
|
|
12004
12040
|
}
|
|
12041
|
+
function coerceMbr(left, top, right, bottom) {
|
|
12042
|
+
if (left instanceof Mbr)
|
|
12043
|
+
return left;
|
|
12044
|
+
if (typeof left === "object" && left !== null)
|
|
12045
|
+
return new Mbr(left.left, left.top, left.right, left.bottom);
|
|
12046
|
+
return new Mbr(left, top, right, bottom);
|
|
12047
|
+
}
|
|
12005
12048
|
|
|
12006
12049
|
class SpatialIndex {
|
|
12007
12050
|
subject = new Subject;
|
|
@@ -12022,6 +12065,9 @@ class SpatialIndex {
|
|
|
12022
12065
|
this.Mbr = new Mbr;
|
|
12023
12066
|
}
|
|
12024
12067
|
insert(item) {
|
|
12068
|
+
if (this.itemsArray.includes(item) || this.getById(item.getId())) {
|
|
12069
|
+
return;
|
|
12070
|
+
}
|
|
12025
12071
|
this.itemsArray.push(item);
|
|
12026
12072
|
this.itemsIndex.insert(item);
|
|
12027
12073
|
if (conf.isNode()) {
|
|
@@ -12050,7 +12096,7 @@ class SpatialIndex {
|
|
|
12050
12096
|
remove(item, preserveChildren = false) {
|
|
12051
12097
|
const baseItem = item;
|
|
12052
12098
|
if (!preserveChildren && baseItem.index) {
|
|
12053
|
-
baseItem.removeChildItems(baseItem.index.
|
|
12099
|
+
baseItem.removeChildItems(baseItem.index.listAll());
|
|
12054
12100
|
}
|
|
12055
12101
|
this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
|
|
12056
12102
|
this.itemsIndex.remove(item);
|
|
@@ -12093,14 +12139,14 @@ class SpatialIndex {
|
|
|
12093
12139
|
return items.flatMap((item) => {
|
|
12094
12140
|
const baseItem = item;
|
|
12095
12141
|
if (baseItem.index) {
|
|
12096
|
-
return [item, ...baseItem.index.
|
|
12142
|
+
return [item, ...baseItem.index.listAll()];
|
|
12097
12143
|
}
|
|
12098
12144
|
return item;
|
|
12099
12145
|
});
|
|
12100
12146
|
}
|
|
12101
12147
|
getItemChildren(item) {
|
|
12102
12148
|
if ("index" in item && item.index) {
|
|
12103
|
-
return item.index.
|
|
12149
|
+
return item.index.listAll();
|
|
12104
12150
|
}
|
|
12105
12151
|
return [];
|
|
12106
12152
|
}
|
|
@@ -12251,14 +12297,14 @@ class SpatialIndex {
|
|
|
12251
12297
|
findById(id) {
|
|
12252
12298
|
return this.getById(id);
|
|
12253
12299
|
}
|
|
12254
|
-
|
|
12255
|
-
const mbr =
|
|
12256
|
-
const items = this.itemsIndex.
|
|
12300
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12301
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12302
|
+
const items = this.itemsIndex.listEnclosedBy(mbr);
|
|
12257
12303
|
const children = [];
|
|
12258
12304
|
const clearItems = items.filter((item) => {
|
|
12259
12305
|
if ("index" in item && item.index) {
|
|
12260
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12261
|
-
children.push(...item.index.
|
|
12306
|
+
const local = worldBoundsToLocal(item, mbr.left, mbr.top, mbr.right, mbr.bottom);
|
|
12307
|
+
children.push(...item.index.listEnclosedBy(local.left, local.top, local.right, local.bottom));
|
|
12262
12308
|
if (!item.getMbr().isEnclosedBy(mbr)) {
|
|
12263
12309
|
return false;
|
|
12264
12310
|
}
|
|
@@ -12267,14 +12313,14 @@ class SpatialIndex {
|
|
|
12267
12313
|
});
|
|
12268
12314
|
return [...clearItems, ...children];
|
|
12269
12315
|
}
|
|
12270
|
-
|
|
12271
|
-
const mbr =
|
|
12272
|
-
const items = this.itemsIndex.
|
|
12316
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12317
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12318
|
+
const items = this.itemsIndex.listEnclosedOrCrossedBy(mbr);
|
|
12273
12319
|
const children = [];
|
|
12274
12320
|
const clearItems = items.filter((item) => {
|
|
12275
12321
|
if ("index" in item && item.index) {
|
|
12276
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12277
|
-
children.push(...item.index.
|
|
12322
|
+
const local = worldBoundsToLocal(item, mbr.left, mbr.top, mbr.right, mbr.bottom);
|
|
12323
|
+
children.push(...item.index.listEnclosedOrCrossedBy(local.left, local.top, local.right, local.bottom));
|
|
12278
12324
|
if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
12279
12325
|
return false;
|
|
12280
12326
|
}
|
|
@@ -12283,14 +12329,17 @@ class SpatialIndex {
|
|
|
12283
12329
|
});
|
|
12284
12330
|
return [...clearItems, ...children];
|
|
12285
12331
|
}
|
|
12286
|
-
|
|
12287
|
-
|
|
12332
|
+
listRectsEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12333
|
+
return this.listEnclosedOrCrossedBy(left, top, right, bottom).map((item) => item.getMbr());
|
|
12334
|
+
}
|
|
12335
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12336
|
+
const items = this.itemsIndex.listUnderPoint(point, tolerance);
|
|
12288
12337
|
const children = [];
|
|
12289
12338
|
const clearItems = items.filter((item) => {
|
|
12290
12339
|
if ("index" in item && item.index) {
|
|
12291
12340
|
const localPt = new Point(point.x, point.y);
|
|
12292
12341
|
item.getNestingMatrix().getInverse().apply(localPt);
|
|
12293
|
-
children.push(...item.index.
|
|
12342
|
+
children.push(...item.index.listUnderPoint(localPt, tolerance));
|
|
12294
12343
|
if (!item.getMbr().isUnderPoint(point)) {
|
|
12295
12344
|
return false;
|
|
12296
12345
|
}
|
|
@@ -12302,24 +12351,8 @@ class SpatialIndex {
|
|
|
12302
12351
|
});
|
|
12303
12352
|
return [...clearItems, ...children];
|
|
12304
12353
|
}
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
|
|
12308
|
-
const children = [];
|
|
12309
|
-
const clearItems = items.filter((item) => {
|
|
12310
|
-
if ("index" in item && item.index) {
|
|
12311
|
-
const local = worldBoundsToLocal(item, left, top, right, bottom);
|
|
12312
|
-
children.push(...item.index.getEnclosedOrCrossed(local.left, local.top, local.right, local.bottom));
|
|
12313
|
-
if (!item.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
12314
|
-
return false;
|
|
12315
|
-
}
|
|
12316
|
-
}
|
|
12317
|
-
return true;
|
|
12318
|
-
});
|
|
12319
|
-
return [...clearItems, ...children];
|
|
12320
|
-
}
|
|
12321
|
-
getItemsEnclosedOrCrossed(left, top, right, bottom) {
|
|
12322
|
-
return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
|
|
12354
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
12355
|
+
return this.itemsIndex.listNearestTo(point, maxItems, filter, maxDistance);
|
|
12323
12356
|
}
|
|
12324
12357
|
getComments() {
|
|
12325
12358
|
return this.itemsArray.filter((item) => item.itemType === "Comment");
|
|
@@ -12337,7 +12370,7 @@ class SpatialIndex {
|
|
|
12337
12370
|
const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
|
|
12338
12371
|
return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
|
|
12339
12372
|
}
|
|
12340
|
-
|
|
12373
|
+
listAll() {
|
|
12341
12374
|
return this.getItemsWithIncludedChildren(this.itemsArray).concat();
|
|
12342
12375
|
}
|
|
12343
12376
|
getZIndex(item) {
|
|
@@ -12375,10 +12408,19 @@ class Items {
|
|
|
12375
12408
|
this.index.change(item);
|
|
12376
12409
|
}
|
|
12377
12410
|
listAll() {
|
|
12378
|
-
return this.index.
|
|
12411
|
+
return this.index.listAll();
|
|
12412
|
+
}
|
|
12413
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12414
|
+
return this.index.listUnderPoint(point, tolerance);
|
|
12415
|
+
}
|
|
12416
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12417
|
+
return this.index.listEnclosedBy(left, top, right, bottom);
|
|
12418
|
+
}
|
|
12419
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12420
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12379
12421
|
}
|
|
12380
12422
|
listGroupItems() {
|
|
12381
|
-
return this.index.
|
|
12423
|
+
return this.index.listAll().filter((item) => ("index" in item) && item.index);
|
|
12382
12424
|
}
|
|
12383
12425
|
getById(id) {
|
|
12384
12426
|
return this.index.getById(id);
|
|
@@ -12387,16 +12429,16 @@ class Items {
|
|
|
12387
12429
|
return this.index.findById(id);
|
|
12388
12430
|
}
|
|
12389
12431
|
getEnclosed(left, top, right, bottom) {
|
|
12390
|
-
return this.index.
|
|
12432
|
+
return this.index.listEnclosedBy(left, top, right, bottom);
|
|
12391
12433
|
}
|
|
12392
12434
|
getEnclosedOrCrossed(left, top, right, bottom) {
|
|
12393
|
-
return this.index.
|
|
12435
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12394
12436
|
}
|
|
12395
12437
|
getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
|
|
12396
|
-
return this.index.
|
|
12438
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom).filter((item) => ("index" in item) && item.index);
|
|
12397
12439
|
}
|
|
12398
12440
|
getUnderPoint(point, tolerance = 5) {
|
|
12399
|
-
return this.index.
|
|
12441
|
+
return this.index.listUnderPoint(point, tolerance);
|
|
12400
12442
|
}
|
|
12401
12443
|
getMbr() {
|
|
12402
12444
|
return this.index.getMbr();
|
|
@@ -12419,25 +12461,25 @@ class Items {
|
|
|
12419
12461
|
}
|
|
12420
12462
|
getInView() {
|
|
12421
12463
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12422
|
-
return this.index.
|
|
12464
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12423
12465
|
}
|
|
12424
12466
|
getItemsInView() {
|
|
12425
12467
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12426
|
-
return this.index.
|
|
12468
|
+
return this.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
12427
12469
|
}
|
|
12428
12470
|
getGroupItemsInView() {
|
|
12429
12471
|
const { left, top, right, bottom } = this.view.getMbr();
|
|
12430
12472
|
return this.getGroupItemsEnclosedOrCrossed(left, top, right, bottom);
|
|
12431
12473
|
}
|
|
12432
12474
|
getComments() {
|
|
12433
|
-
return this.
|
|
12475
|
+
return this.listAll().filter((item) => item.itemType === "Comment");
|
|
12434
12476
|
}
|
|
12435
12477
|
getUnderPointer(size = 0) {
|
|
12436
12478
|
const { x, y } = this.pointer.point;
|
|
12437
12479
|
const unmodifiedSize = size;
|
|
12438
12480
|
size = 16;
|
|
12439
|
-
const tolerated = this.index.
|
|
12440
|
-
let enclosed = tolerated.some((item) => item.itemType === "Connector") ? tolerated : this.index.
|
|
12481
|
+
const tolerated = this.index.listEnclosedOrCrossedBy(x - size, y - size, x + size, y + size);
|
|
12482
|
+
let enclosed = tolerated.some((item) => item.itemType === "Connector") ? tolerated : this.index.listEnclosedOrCrossedBy(x, y, x, y);
|
|
12441
12483
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
12442
12484
|
if (enclosed.length === 0) {
|
|
12443
12485
|
enclosed = underPointer;
|
|
@@ -12465,7 +12507,7 @@ class Items {
|
|
|
12465
12507
|
return [];
|
|
12466
12508
|
}
|
|
12467
12509
|
getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
|
|
12468
|
-
return this.index.
|
|
12510
|
+
return this.index.listNearestTo(this.pointer.point, maxItems, filter, maxDistance);
|
|
12469
12511
|
}
|
|
12470
12512
|
getZIndex(item) {
|
|
12471
12513
|
return this.index.getZIndex(item);
|
|
@@ -12607,7 +12649,6 @@ var init_SpacialIndex = __esm(() => {
|
|
|
12607
12649
|
init_Point();
|
|
12608
12650
|
init_Settings();
|
|
12609
12651
|
init_LayeredIndex();
|
|
12610
|
-
init_BaseItem();
|
|
12611
12652
|
});
|
|
12612
12653
|
|
|
12613
12654
|
// src/SpatialIndex/SimpleSpatialIndex.ts
|
|
@@ -12624,6 +12665,9 @@ class SimpleSpatialIndex {
|
|
|
12624
12665
|
this.Mbr = new Mbr;
|
|
12625
12666
|
}
|
|
12626
12667
|
insert(item) {
|
|
12668
|
+
if (this.itemsArray.includes(item) || this.getById(item.getId())) {
|
|
12669
|
+
return;
|
|
12670
|
+
}
|
|
12627
12671
|
this.itemsArray.push(item);
|
|
12628
12672
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
12629
12673
|
this.Mbr = item.getMbr().copy();
|
|
@@ -12643,9 +12687,12 @@ class SimpleSpatialIndex {
|
|
|
12643
12687
|
};
|
|
12644
12688
|
remove(item, preserveChildren = false) {
|
|
12645
12689
|
if (!preserveChildren && "index" in item && item.index) {
|
|
12646
|
-
item.removeChildItems(item.index.
|
|
12690
|
+
item.removeChildItems(item.index.listAll());
|
|
12691
|
+
}
|
|
12692
|
+
const index = this.itemsArray.indexOf(item);
|
|
12693
|
+
if (index !== -1) {
|
|
12694
|
+
this.itemsArray.splice(index, 1);
|
|
12647
12695
|
}
|
|
12648
|
-
this.itemsArray.splice(this.itemsArray.indexOf(item), 1);
|
|
12649
12696
|
this.Mbr = new Mbr;
|
|
12650
12697
|
this.itemsArray.forEach((item2) => this.Mbr.combine([item2.getMbr()]));
|
|
12651
12698
|
this.subject.publish(this.items);
|
|
@@ -12728,16 +12775,13 @@ class SimpleSpatialIndex {
|
|
|
12728
12775
|
this.subject.publish(this.items);
|
|
12729
12776
|
}
|
|
12730
12777
|
getById(id) {
|
|
12731
|
-
|
|
12732
|
-
if (item) {
|
|
12733
|
-
return item;
|
|
12734
|
-
}
|
|
12778
|
+
return this.itemsArray.find((item) => item.getId() === id);
|
|
12735
12779
|
}
|
|
12736
12780
|
findById(id) {
|
|
12737
12781
|
return this.getById(id);
|
|
12738
12782
|
}
|
|
12739
|
-
|
|
12740
|
-
const mbr =
|
|
12783
|
+
listEnclosedBy(left, top, right, bottom) {
|
|
12784
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12741
12785
|
const items = [];
|
|
12742
12786
|
this.itemsArray.forEach((item) => {
|
|
12743
12787
|
if (item.isEnclosedBy(mbr)) {
|
|
@@ -12746,8 +12790,8 @@ class SimpleSpatialIndex {
|
|
|
12746
12790
|
});
|
|
12747
12791
|
return items;
|
|
12748
12792
|
}
|
|
12749
|
-
|
|
12750
|
-
const mbr =
|
|
12793
|
+
listEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12794
|
+
const mbr = coerceMbr(left, top, right, bottom);
|
|
12751
12795
|
const items = [];
|
|
12752
12796
|
this.itemsArray.forEach((item) => {
|
|
12753
12797
|
if (item.isEnclosedOrCrossedBy(mbr)) {
|
|
@@ -12756,19 +12800,30 @@ class SimpleSpatialIndex {
|
|
|
12756
12800
|
});
|
|
12757
12801
|
return items;
|
|
12758
12802
|
}
|
|
12759
|
-
|
|
12803
|
+
listUnderPoint(point, tolerance = 5) {
|
|
12760
12804
|
const items = [];
|
|
12761
12805
|
this.itemsArray.forEach((item) => {
|
|
12762
|
-
if (item.isUnderPoint(point,
|
|
12806
|
+
if (item.isUnderPoint(point, tolerance)) {
|
|
12763
12807
|
items.push(item);
|
|
12764
12808
|
}
|
|
12765
12809
|
});
|
|
12766
12810
|
return items;
|
|
12767
12811
|
}
|
|
12812
|
+
listRectsEnclosedOrCrossedBy(left, top, right, bottom) {
|
|
12813
|
+
return this.listEnclosedOrCrossedBy(left, top, right, bottom).map((item) => item.getMbr());
|
|
12814
|
+
}
|
|
12815
|
+
listNearestTo(point, maxItems, filter, maxDistance) {
|
|
12816
|
+
const itemsWithDistance = this.itemsArray.filter(filter).map((item) => ({
|
|
12817
|
+
item,
|
|
12818
|
+
distance: item.getMbr().getDistanceToPoint(point)
|
|
12819
|
+
}));
|
|
12820
|
+
const inRange = itemsWithDistance.filter((x) => x.distance <= maxDistance);
|
|
12821
|
+
return inRange.sort((a, b) => a.distance - b.distance).slice(0, maxItems).map((x) => x.item);
|
|
12822
|
+
}
|
|
12768
12823
|
getMbr() {
|
|
12769
12824
|
return this.Mbr;
|
|
12770
12825
|
}
|
|
12771
|
-
|
|
12826
|
+
listAll() {
|
|
12772
12827
|
return this.itemsArray.concat();
|
|
12773
12828
|
}
|
|
12774
12829
|
getZIndex(item) {
|
|
@@ -12840,7 +12895,7 @@ function toLocalTransformOp(op, containerMatrix, itemId) {
|
|
|
12840
12895
|
}
|
|
12841
12896
|
}
|
|
12842
12897
|
var BaseItem;
|
|
12843
|
-
var
|
|
12898
|
+
var init_BaseItem = __esm(() => {
|
|
12844
12899
|
init_Mbr();
|
|
12845
12900
|
init_LinkTo();
|
|
12846
12901
|
init_Transformation();
|
|
@@ -13039,7 +13094,10 @@ var init_BaseItem2 = __esm(() => {
|
|
|
13039
13094
|
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
13040
13095
|
if (!this.index?.getById(childId) && foundItem) {
|
|
13041
13096
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
13042
|
-
|
|
13097
|
+
const currentParentId = foundItem.parent;
|
|
13098
|
+
const currentParent = currentParentId !== "Board" ? this.board.items.getById(currentParentId) : undefined;
|
|
13099
|
+
const sourceIndex = currentParent?.index || this.board.items.index;
|
|
13100
|
+
sourceIndex.remove(foundItem, true);
|
|
13043
13101
|
foundItem.parent = this.getId();
|
|
13044
13102
|
foundItem.onParentChanged(this.getId());
|
|
13045
13103
|
foundItem.transformation.setLocalMatrix(localMatrix);
|
|
@@ -13284,7 +13342,7 @@ var init_Comment = __esm(() => {
|
|
|
13284
13342
|
init_Line2();
|
|
13285
13343
|
init_esm_browser();
|
|
13286
13344
|
init_LinkTo();
|
|
13287
|
-
|
|
13345
|
+
init_BaseItem();
|
|
13288
13346
|
Comment = class Comment extends BaseItem {
|
|
13289
13347
|
anchor;
|
|
13290
13348
|
events;
|
|
@@ -16668,15 +16726,15 @@ var import_slate41, setLink = (editor, link, selection) => {
|
|
|
16668
16726
|
}
|
|
16669
16727
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
16670
16728
|
import_slate41.Transforms.setNodes(editor, { fontColor: format }, {
|
|
16671
|
-
match: (n) =>
|
|
16729
|
+
match: (n) => import_slate41.Text.isText(n),
|
|
16672
16730
|
split: true
|
|
16673
16731
|
});
|
|
16674
|
-
for (const [
|
|
16675
|
-
match: (n) =>
|
|
16732
|
+
for (const [, path2] of import_slate41.Editor.nodes(editor, {
|
|
16733
|
+
match: (n) => import_slate41.Text.isText(n)
|
|
16676
16734
|
})) {
|
|
16677
16735
|
const nodeRange = import_slate41.Editor.range(editor, path2);
|
|
16678
16736
|
import_slate41.Transforms.select(editor, nodeRange);
|
|
16679
|
-
import_slate41.Transforms.setNodes(editor, { link }, { split: false, match: (n) =>
|
|
16737
|
+
import_slate41.Transforms.setNodes(editor, { link }, { split: false, match: (n) => import_slate41.Text.isText(n) });
|
|
16680
16738
|
}
|
|
16681
16739
|
};
|
|
16682
16740
|
var init_setLink = __esm(() => {
|
|
@@ -25075,7 +25133,7 @@ var init_RichText = __esm(() => {
|
|
|
25075
25133
|
init_getSelectionStyles();
|
|
25076
25134
|
init_setEditorFocus();
|
|
25077
25135
|
init_getAllTextNodesInSelection();
|
|
25078
|
-
|
|
25136
|
+
init_BaseItem();
|
|
25079
25137
|
RichText = class RichText extends BaseItem {
|
|
25080
25138
|
container;
|
|
25081
25139
|
transformation;
|
|
@@ -26041,7 +26099,7 @@ var init_AINode = __esm(() => {
|
|
|
26041
26099
|
init_Matrix();
|
|
26042
26100
|
init_Transformation();
|
|
26043
26101
|
init_Settings();
|
|
26044
|
-
|
|
26102
|
+
init_BaseItem();
|
|
26045
26103
|
AINode = class AINode extends BaseItem {
|
|
26046
26104
|
itemType = "AINode";
|
|
26047
26105
|
parent = "Board";
|
|
@@ -26388,7 +26446,7 @@ var init_Audio = __esm(() => {
|
|
|
26388
26446
|
init_Point();
|
|
26389
26447
|
init_Line();
|
|
26390
26448
|
init_Settings();
|
|
26391
|
-
|
|
26449
|
+
init_BaseItem();
|
|
26392
26450
|
AudioItem = class AudioItem extends BaseItem {
|
|
26393
26451
|
events;
|
|
26394
26452
|
extension;
|
|
@@ -41385,6 +41443,11 @@ var init_ShapeData = __esm(() => {
|
|
|
41385
41443
|
];
|
|
41386
41444
|
});
|
|
41387
41445
|
|
|
41446
|
+
// src/Items/BaseItem/index.ts
|
|
41447
|
+
var init_BaseItem2 = __esm(() => {
|
|
41448
|
+
init_BaseItem();
|
|
41449
|
+
});
|
|
41450
|
+
|
|
41388
41451
|
// src/Items/Mbr/updateRects.ts
|
|
41389
41452
|
function updateRects(board, ref, mbr, verticalOffset, horizontalOffset, fit = "contextPanel") {
|
|
41390
41453
|
const { selection, camera } = board;
|
|
@@ -41655,7 +41718,7 @@ var init_ControlPoint = __esm(() => {
|
|
|
41655
41718
|
init_Transformation2();
|
|
41656
41719
|
init_RichText2();
|
|
41657
41720
|
init_AINode2();
|
|
41658
|
-
|
|
41721
|
+
init_BaseItem2();
|
|
41659
41722
|
BoardPoint = class BoardPoint extends Point {
|
|
41660
41723
|
pointType = "Board";
|
|
41661
41724
|
serialize() {
|
|
@@ -42555,7 +42618,7 @@ var init_Connector = __esm(() => {
|
|
|
42555
42618
|
init_LinkTo();
|
|
42556
42619
|
init_HTMLRender();
|
|
42557
42620
|
init_Settings();
|
|
42558
|
-
|
|
42621
|
+
init_BaseItem();
|
|
42559
42622
|
init_Color();
|
|
42560
42623
|
init_ConnectorTypes();
|
|
42561
42624
|
CONNECTOR_ANCHOR_COLOR = {
|
|
@@ -43536,7 +43599,7 @@ var init_Sticker = __esm(() => {
|
|
|
43536
43599
|
init_SessionStorage();
|
|
43537
43600
|
init_HTMLRender();
|
|
43538
43601
|
init_Settings();
|
|
43539
|
-
|
|
43602
|
+
init_BaseItem();
|
|
43540
43603
|
init_Color();
|
|
43541
43604
|
stickerColors = {
|
|
43542
43605
|
Purple: "rgb(233, 208, 255)",
|
|
@@ -44669,7 +44732,7 @@ async function exportBoardSnapshot({
|
|
|
44669
44732
|
context.ctx.setTransform(upscaleFactor, 0, 0, upscaleFactor, 0, 0);
|
|
44670
44733
|
context.matrix.applyToContext(context.ctx);
|
|
44671
44734
|
const { left, top, right, bottom } = selection;
|
|
44672
|
-
const inView = board.items.index.
|
|
44735
|
+
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
44673
44736
|
for (const item of inView) {
|
|
44674
44737
|
item.render(context);
|
|
44675
44738
|
}
|
|
@@ -44789,7 +44852,7 @@ var init_Frame = __esm(() => {
|
|
|
44789
44852
|
init_FrameData();
|
|
44790
44853
|
init_Settings();
|
|
44791
44854
|
init_getResizeMatrix();
|
|
44792
|
-
|
|
44855
|
+
init_BaseItem2();
|
|
44793
44856
|
init_Color();
|
|
44794
44857
|
defaultFrameData = new DefaultFrameData;
|
|
44795
44858
|
Frame = class Frame extends BaseItem {
|
|
@@ -44908,7 +44971,7 @@ var init_Frame = __esm(() => {
|
|
|
44908
44971
|
return this.id;
|
|
44909
44972
|
}
|
|
44910
44973
|
getChildrenIds() {
|
|
44911
|
-
return this.index?.
|
|
44974
|
+
return this.index?.listAll().map((item) => item.getId()) || [];
|
|
44912
44975
|
}
|
|
44913
44976
|
updateMbr() {
|
|
44914
44977
|
const rect = this.path.getMbr().copy();
|
|
@@ -45344,7 +45407,7 @@ var init_Video = __esm(() => {
|
|
|
45344
45407
|
init_Path2();
|
|
45345
45408
|
init_Transformation2();
|
|
45346
45409
|
init_Settings();
|
|
45347
|
-
|
|
45410
|
+
init_BaseItem();
|
|
45348
45411
|
init_MediaHelpers();
|
|
45349
45412
|
videoIcon = conf.documentFactory.createElement("img");
|
|
45350
45413
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
@@ -45987,7 +46050,7 @@ var init_Drawing = __esm(() => {
|
|
|
45987
46050
|
init_DrawingCommand();
|
|
45988
46051
|
init_LinkTo();
|
|
45989
46052
|
init_Settings();
|
|
45990
|
-
|
|
46053
|
+
init_BaseItem();
|
|
45991
46054
|
init_Color();
|
|
45992
46055
|
Drawing = class Drawing extends BaseItem {
|
|
45993
46056
|
points;
|
|
@@ -46407,7 +46470,7 @@ var init_Group = __esm(() => {
|
|
|
46407
46470
|
init_Point();
|
|
46408
46471
|
init_Transformation();
|
|
46409
46472
|
init_LinkTo();
|
|
46410
|
-
|
|
46473
|
+
init_BaseItem();
|
|
46411
46474
|
Group = class Group extends BaseItem {
|
|
46412
46475
|
events;
|
|
46413
46476
|
linkTo;
|
|
@@ -46467,7 +46530,7 @@ var init_Group = __esm(() => {
|
|
|
46467
46530
|
return this;
|
|
46468
46531
|
}
|
|
46469
46532
|
getMbr() {
|
|
46470
|
-
const children = this.index.
|
|
46533
|
+
const children = this.index.listAll();
|
|
46471
46534
|
if (children.length === 0) {
|
|
46472
46535
|
return new Mbr(this.left, this.top, this.right, this.bottom);
|
|
46473
46536
|
}
|
|
@@ -46507,10 +46570,10 @@ var init_Group = __esm(() => {
|
|
|
46507
46570
|
this.getMbr();
|
|
46508
46571
|
}
|
|
46509
46572
|
getChildrenIds() {
|
|
46510
|
-
return this.index.
|
|
46573
|
+
return this.index.listAll().map((item) => item.getId());
|
|
46511
46574
|
}
|
|
46512
46575
|
getChildren() {
|
|
46513
|
-
return this.index.
|
|
46576
|
+
return this.index.listAll();
|
|
46514
46577
|
}
|
|
46515
46578
|
getLinkTo() {
|
|
46516
46579
|
return this.linkTo.link;
|
|
@@ -46558,7 +46621,7 @@ var init_Group = __esm(() => {
|
|
|
46558
46621
|
const ctx = context.ctx;
|
|
46559
46622
|
ctx.save();
|
|
46560
46623
|
this.transformation.applyToContext(ctx);
|
|
46561
|
-
for (const child of this.index.
|
|
46624
|
+
for (const child of this.index.listAll()) {
|
|
46562
46625
|
child.render(context);
|
|
46563
46626
|
}
|
|
46564
46627
|
ctx.restore();
|
|
@@ -46666,7 +46729,7 @@ function createDrawing(id, data, board) {
|
|
|
46666
46729
|
if (!isDrawingData(data)) {
|
|
46667
46730
|
throw new Error("Invalid data for Drawing");
|
|
46668
46731
|
}
|
|
46669
|
-
const drawing = new Drawing(board, [], board.events).setId(id).deserialize({ ...data, id });
|
|
46732
|
+
const drawing = new Drawing(board, [], board.events).setId(id).setId(id).deserialize({ ...data, id });
|
|
46670
46733
|
return drawing;
|
|
46671
46734
|
}
|
|
46672
46735
|
function createFrame(id, data, board) {
|
|
@@ -46687,7 +46750,7 @@ function createGroup(id, data, board) {
|
|
|
46687
46750
|
if (!isGroupData(data)) {
|
|
46688
46751
|
throw new Error("Invalid data for Group");
|
|
46689
46752
|
}
|
|
46690
|
-
const group = new Group(board, board.events, data.
|
|
46753
|
+
const group = new Group(board, board.events, data.childIds, id).setId(id).deserialize({ ...data, id });
|
|
46691
46754
|
return group;
|
|
46692
46755
|
}
|
|
46693
46756
|
function isStickerData(data) {
|
|
@@ -49225,7 +49288,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
49225
49288
|
}
|
|
49226
49289
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
49227
49290
|
let step = 1;
|
|
49228
|
-
while (board.index.
|
|
49291
|
+
while (board.index.listEnclosedOrCrossedBy(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item) => item.itemType !== "Connector").length > 0) {
|
|
49229
49292
|
const xDirection = step % 2 === 0 ? -1 : 1;
|
|
49230
49293
|
const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
|
|
49231
49294
|
newMbr.transform(new Matrix(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
|
|
@@ -49467,7 +49530,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
49467
49530
|
var offsets;
|
|
49468
49531
|
var init_QuickAddButtons2 = __esm(() => {
|
|
49469
49532
|
init_Items();
|
|
49470
|
-
|
|
49533
|
+
init_BaseItem();
|
|
49471
49534
|
init_SessionStorage();
|
|
49472
49535
|
init_QuickAddButtons();
|
|
49473
49536
|
init_quickAddHelpers();
|
|
@@ -49900,7 +49963,7 @@ class AlignmentHelper {
|
|
|
49900
49963
|
var RELATIVE_ALIGNMENT_COLOR = "#4778F5";
|
|
49901
49964
|
var init_RelativeAlignment = __esm(() => {
|
|
49902
49965
|
init_Items();
|
|
49903
|
-
|
|
49966
|
+
init_BaseItem2();
|
|
49904
49967
|
});
|
|
49905
49968
|
|
|
49906
49969
|
// src/Tools/RelativeAlignment/index.ts
|
|
@@ -51501,7 +51564,7 @@ var init_AddStar = __esm(() => {
|
|
|
51501
51564
|
// src/Items/Examples/Star/Star.ts
|
|
51502
51565
|
var defaultStarData, starPath, Star2;
|
|
51503
51566
|
var init_Star2 = __esm(() => {
|
|
51504
|
-
|
|
51567
|
+
init_BaseItem();
|
|
51505
51568
|
init_Point();
|
|
51506
51569
|
init_Path();
|
|
51507
51570
|
init_Line();
|
|
@@ -51683,7 +51746,7 @@ var init_AddCounter = __esm(() => {
|
|
|
51683
51746
|
// src/Items/Examples/Counter/Counter.ts
|
|
51684
51747
|
var defaultCounterData, COUNTER_DIMENSIONS, Counter;
|
|
51685
51748
|
var init_Counter = __esm(() => {
|
|
51686
|
-
|
|
51749
|
+
init_BaseItem();
|
|
51687
51750
|
init_Point();
|
|
51688
51751
|
init_Path();
|
|
51689
51752
|
init_Line();
|
|
@@ -51802,7 +51865,7 @@ var init_HotkeyRegistry = __esm(() => {
|
|
|
51802
51865
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
51803
51866
|
var defaultCardData, Card;
|
|
51804
51867
|
var init_Card = __esm(() => {
|
|
51805
|
-
|
|
51868
|
+
init_BaseItem();
|
|
51806
51869
|
init_Path();
|
|
51807
51870
|
init_RegisterItem();
|
|
51808
51871
|
init_Settings();
|
|
@@ -52052,7 +52115,7 @@ function createDeck(event, board) {
|
|
|
52052
52115
|
if (single && single.itemType === "Deck") {
|
|
52053
52116
|
return;
|
|
52054
52117
|
}
|
|
52055
|
-
const cardsOrDecks = board.selection.items.
|
|
52118
|
+
const cardsOrDecks = board.selection.items.listAll();
|
|
52056
52119
|
const onlyCards = board.selection.items.isAllItemsType("Card");
|
|
52057
52120
|
if (onlyCards) {
|
|
52058
52121
|
const deck = new Deck(board, "");
|
|
@@ -52068,12 +52131,12 @@ function createDeck(event, board) {
|
|
|
52068
52131
|
if (item.itemType === "Card") {
|
|
52069
52132
|
cards.push(item);
|
|
52070
52133
|
} else if (item.itemType === "Deck") {
|
|
52134
|
+
const deck = item;
|
|
52071
52135
|
if (mainDeck) {
|
|
52072
|
-
cards.push(...
|
|
52073
|
-
board.remove(
|
|
52074
|
-
mainDeck = item;
|
|
52136
|
+
cards.push(...deck.getDeck());
|
|
52137
|
+
board.remove(deck);
|
|
52075
52138
|
} else {
|
|
52076
|
-
mainDeck =
|
|
52139
|
+
mainDeck = deck;
|
|
52077
52140
|
}
|
|
52078
52141
|
}
|
|
52079
52142
|
});
|
|
@@ -52086,9 +52149,10 @@ function createDeck(event, board) {
|
|
|
52086
52149
|
}
|
|
52087
52150
|
var defaultDeckData, Deck;
|
|
52088
52151
|
var init_Deck = __esm(() => {
|
|
52089
|
-
|
|
52152
|
+
init_BaseItem();
|
|
52090
52153
|
init_RegisterItem();
|
|
52091
52154
|
init_Card();
|
|
52155
|
+
init_DrawingContext();
|
|
52092
52156
|
init_Settings();
|
|
52093
52157
|
init_Path2();
|
|
52094
52158
|
init_HotkeyRegistry();
|
|
@@ -52107,9 +52171,9 @@ var init_Deck = __esm(() => {
|
|
|
52107
52171
|
drawingContext = null;
|
|
52108
52172
|
constructor(board, id = "") {
|
|
52109
52173
|
super(board, id, defaultDeckData, true);
|
|
52110
|
-
this.index.
|
|
52111
|
-
this.index.
|
|
52112
|
-
this.index.
|
|
52174
|
+
this.index.listUnderPoint = () => [];
|
|
52175
|
+
this.index.listEnclosedBy = () => [];
|
|
52176
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
52113
52177
|
this.transformation.subject.subscribe(() => {
|
|
52114
52178
|
this.updateMbr();
|
|
52115
52179
|
this.subject.publish(this);
|
|
@@ -52131,7 +52195,7 @@ var init_Deck = __esm(() => {
|
|
|
52131
52195
|
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);
|
|
52132
52196
|
if (canAddItem) {
|
|
52133
52197
|
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
52134
|
-
foundItem.transformation.setLocal(this.left + (this.index?.
|
|
52198
|
+
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));
|
|
52135
52199
|
if (firstCard) {
|
|
52136
52200
|
const { scaleX, scaleY } = foundItem.transformation.getMatrixData();
|
|
52137
52201
|
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.getMatrixData();
|
|
@@ -52171,31 +52235,33 @@ var init_Deck = __esm(() => {
|
|
|
52171
52235
|
this.subject.publish(this);
|
|
52172
52236
|
}
|
|
52173
52237
|
getDeck() {
|
|
52174
|
-
return this.index?.
|
|
52238
|
+
return this.index?.listAll() || [];
|
|
52175
52239
|
}
|
|
52176
52240
|
getTopCard() {
|
|
52177
|
-
const
|
|
52241
|
+
const cards = this.index?.listAll() || [];
|
|
52242
|
+
const card = cards[cards.length - 1];
|
|
52178
52243
|
if (card) {
|
|
52179
52244
|
this.removeChildItems(card);
|
|
52180
52245
|
return card;
|
|
52181
52246
|
}
|
|
52182
52247
|
}
|
|
52183
52248
|
getCards(count) {
|
|
52184
|
-
const cards = this.index?.
|
|
52185
|
-
if (cards) {
|
|
52249
|
+
const cards = (this.index?.listAll() || []).reverse().slice(0, count);
|
|
52250
|
+
if (cards.length > 0) {
|
|
52186
52251
|
this.removeChildItems(cards);
|
|
52187
52252
|
return cards;
|
|
52188
52253
|
}
|
|
52189
52254
|
}
|
|
52190
52255
|
getBottomCard() {
|
|
52191
|
-
const card = this.index?.
|
|
52256
|
+
const card = this.index?.listAll()[0];
|
|
52192
52257
|
if (card) {
|
|
52193
52258
|
this.removeChildItems(card);
|
|
52194
52259
|
return card;
|
|
52195
52260
|
}
|
|
52196
52261
|
}
|
|
52197
52262
|
getRandomCard() {
|
|
52198
|
-
const
|
|
52263
|
+
const cards = this.index?.listAll() || [];
|
|
52264
|
+
const card = cards[Math.floor(Math.random() * cards.length)];
|
|
52199
52265
|
if (card) {
|
|
52200
52266
|
this.removeChildItems(card);
|
|
52201
52267
|
return card;
|
|
@@ -52205,20 +52271,20 @@ var init_Deck = __esm(() => {
|
|
|
52205
52271
|
if (!this.index) {
|
|
52206
52272
|
return;
|
|
52207
52273
|
}
|
|
52208
|
-
const shuffled = [...this.index.
|
|
52274
|
+
const shuffled = [...this.index.listAll()];
|
|
52209
52275
|
for (let i = shuffled.length - 1;i > 0; i--) {
|
|
52210
52276
|
const j = Math.floor(Math.random() * (i + 1));
|
|
52211
52277
|
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
|
|
52212
52278
|
}
|
|
52213
52279
|
this.emitAnimation();
|
|
52214
|
-
this.removeChildItems(this.index.
|
|
52280
|
+
this.removeChildItems(this.index.listAll());
|
|
52215
52281
|
this.addChildItems(shuffled);
|
|
52216
52282
|
}
|
|
52217
52283
|
flipDeck() {
|
|
52218
|
-
if (!this.index || !this.index.
|
|
52284
|
+
if (!this.index || !this.index.listAll().length) {
|
|
52219
52285
|
return;
|
|
52220
52286
|
}
|
|
52221
|
-
const cards = this.index.
|
|
52287
|
+
const cards = this.index.listAll();
|
|
52222
52288
|
cards[0].toggleIsOpen(cards);
|
|
52223
52289
|
const reversed = [...cards].reverse();
|
|
52224
52290
|
this.removeChildItems(cards);
|
|
@@ -52239,7 +52305,7 @@ var init_Deck = __esm(() => {
|
|
|
52239
52305
|
}
|
|
52240
52306
|
updateMbr() {
|
|
52241
52307
|
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
52242
|
-
const items = this.index.
|
|
52308
|
+
const items = this.index.listAll();
|
|
52243
52309
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
52244
52310
|
this.left = translateX;
|
|
52245
52311
|
this.top = translateY;
|
|
@@ -52307,7 +52373,7 @@ var init_Deck = __esm(() => {
|
|
|
52307
52373
|
}
|
|
52308
52374
|
renderHTML(documentFactory) {
|
|
52309
52375
|
const div = super.renderHTML(documentFactory);
|
|
52310
|
-
const cards = this.index?.
|
|
52376
|
+
const cards = this.index?.listAll();
|
|
52311
52377
|
const topCard = cards[cards.length - 1];
|
|
52312
52378
|
if (!topCard) {
|
|
52313
52379
|
return div;
|
|
@@ -52316,7 +52382,7 @@ var init_Deck = __esm(() => {
|
|
|
52316
52382
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
52317
52383
|
const topCardElement = topCard.renderHTML(documentFactory);
|
|
52318
52384
|
div.appendChild(topCardElement);
|
|
52319
|
-
const offset = ((this.index?.
|
|
52385
|
+
const offset = ((this.index?.listAll().length || 0) - 1) * 2;
|
|
52320
52386
|
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
52321
52387
|
div.id = this.getId();
|
|
52322
52388
|
div.style.width = `${this.getWidth()}px`;
|
|
@@ -52329,7 +52395,7 @@ var init_Deck = __esm(() => {
|
|
|
52329
52395
|
return div;
|
|
52330
52396
|
}
|
|
52331
52397
|
updateCache(context) {
|
|
52332
|
-
const cards = this.index?.
|
|
52398
|
+
const cards = this.index?.listAll();
|
|
52333
52399
|
const topCard = cards[cards.length - 1];
|
|
52334
52400
|
const topCardImage = topCard?.getImage();
|
|
52335
52401
|
const width2 = this.getWidth();
|
|
@@ -52343,7 +52409,7 @@ var init_Deck = __esm(() => {
|
|
|
52343
52409
|
const tempCtx = tempCanvas.getContext("2d");
|
|
52344
52410
|
if (!tempCtx)
|
|
52345
52411
|
return;
|
|
52346
|
-
const tempContext =
|
|
52412
|
+
const tempContext = new DrawingContext(context.camera, tempCtx, context.cursorCtx, context.matrix);
|
|
52347
52413
|
cards.forEach((_, index2) => {
|
|
52348
52414
|
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
52349
52415
|
});
|
|
@@ -52352,7 +52418,7 @@ var init_Deck = __esm(() => {
|
|
|
52352
52418
|
this.updateMbr();
|
|
52353
52419
|
}
|
|
52354
52420
|
getFirstCard() {
|
|
52355
|
-
return this.index?.
|
|
52421
|
+
return this.index?.listAll()[0];
|
|
52356
52422
|
}
|
|
52357
52423
|
};
|
|
52358
52424
|
registerItem({
|
|
@@ -52486,7 +52552,7 @@ var init_AddDice = __esm(() => {
|
|
|
52486
52552
|
// src/Items/Examples/CardGame/Dice/Dice.ts
|
|
52487
52553
|
var TIMEOUT = 2000, defaultDiceData, Dice;
|
|
52488
52554
|
var init_Dice = __esm(() => {
|
|
52489
|
-
|
|
52555
|
+
init_BaseItem();
|
|
52490
52556
|
init_Items();
|
|
52491
52557
|
init_RoundedRectangle();
|
|
52492
52558
|
init_Items();
|
|
@@ -52887,7 +52953,7 @@ var init_AddScreen = __esm(() => {
|
|
|
52887
52953
|
// src/Items/Examples/CardGame/Screen/Screen.ts
|
|
52888
52954
|
var screenPath, defaultScreenData, Screen;
|
|
52889
52955
|
var init_Screen = __esm(() => {
|
|
52890
|
-
|
|
52956
|
+
init_BaseItem();
|
|
52891
52957
|
init_RegisterItem();
|
|
52892
52958
|
init_Path2();
|
|
52893
52959
|
init_Line2();
|
|
@@ -53034,9 +53100,9 @@ var init_Screen = __esm(() => {
|
|
|
53034
53100
|
applyOwnerId(ownerId) {
|
|
53035
53101
|
this.ownerId = ownerId;
|
|
53036
53102
|
if (!this.ownerId) {
|
|
53037
|
-
this.index.
|
|
53038
|
-
this.index.
|
|
53039
|
-
this.index.
|
|
53103
|
+
this.index.listUnderPoint = () => [];
|
|
53104
|
+
this.index.listEnclosedBy = () => [];
|
|
53105
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
53040
53106
|
}
|
|
53041
53107
|
}
|
|
53042
53108
|
transformPath() {
|
|
@@ -53059,16 +53125,17 @@ var init_Screen = __esm(() => {
|
|
|
53059
53125
|
this.applyBackgroundUrl(this.backgroundUrl);
|
|
53060
53126
|
}
|
|
53061
53127
|
if (!this.ownerId) {
|
|
53062
|
-
this.index.
|
|
53063
|
-
this.index.
|
|
53064
|
-
this.index.
|
|
53128
|
+
this.index.listUnderPoint = () => [];
|
|
53129
|
+
this.index.listEnclosedBy = () => [];
|
|
53130
|
+
this.index.listEnclosedOrCrossedBy = () => [];
|
|
53065
53131
|
}
|
|
53066
53132
|
this.transformPath();
|
|
53067
53133
|
this.subject.publish(this);
|
|
53068
53134
|
return this;
|
|
53069
53135
|
}
|
|
53070
53136
|
getRandomItem() {
|
|
53071
|
-
const
|
|
53137
|
+
const items = this.index?.listAll() || [];
|
|
53138
|
+
const item = items[Math.floor(Math.random() * items.length)];
|
|
53072
53139
|
if (item) {
|
|
53073
53140
|
this.removeChildItems(item);
|
|
53074
53141
|
return item;
|
|
@@ -53117,7 +53184,7 @@ var init_Screen2 = __esm(() => {
|
|
|
53117
53184
|
|
|
53118
53185
|
// src/Items/index.ts
|
|
53119
53186
|
var init_Items = __esm(() => {
|
|
53120
|
-
|
|
53187
|
+
init_BaseItem2();
|
|
53121
53188
|
init_Point2();
|
|
53122
53189
|
init_Line2();
|
|
53123
53190
|
init_Curve2();
|
|
@@ -53992,7 +54059,7 @@ var init_Shape = __esm(() => {
|
|
|
53992
54059
|
init_Connector2();
|
|
53993
54060
|
init_ControlPoint();
|
|
53994
54061
|
init_Settings();
|
|
53995
|
-
|
|
54062
|
+
init_BaseItem();
|
|
53996
54063
|
init_Color();
|
|
53997
54064
|
defaultShapeData = new DefaultShapeData;
|
|
53998
54065
|
Shapes = { ...BasicShapes, ...BPMN };
|
|
@@ -54518,7 +54585,7 @@ var init_Placeholder2 = __esm(() => {
|
|
|
54518
54585
|
init_Transformation();
|
|
54519
54586
|
init_PlaceholderCommand();
|
|
54520
54587
|
init_getResizeMatrix();
|
|
54521
|
-
|
|
54588
|
+
init_BaseItem();
|
|
54522
54589
|
Placeholder2 = class Placeholder2 extends BaseItem {
|
|
54523
54590
|
events;
|
|
54524
54591
|
miroData;
|
|
@@ -54827,7 +54894,7 @@ var init_Image = __esm(() => {
|
|
|
54827
54894
|
init_Placeholder2();
|
|
54828
54895
|
init_LinkTo();
|
|
54829
54896
|
init_Settings();
|
|
54830
|
-
|
|
54897
|
+
init_BaseItem();
|
|
54831
54898
|
init_MediaHelpers();
|
|
54832
54899
|
ImageItem = class ImageItem extends BaseItem {
|
|
54833
54900
|
events;
|
|
@@ -55390,10 +55457,20 @@ function handleBoardEventMessage(message, board) {
|
|
|
55390
55457
|
if (isEventFromCurrentUser) {
|
|
55391
55458
|
return;
|
|
55392
55459
|
}
|
|
55393
|
-
|
|
55394
|
-
|
|
55395
|
-
|
|
55396
|
-
|
|
55460
|
+
if ("operations" in event.body) {
|
|
55461
|
+
log.insertEventsFromOtherConnections({
|
|
55462
|
+
...event,
|
|
55463
|
+
body: {
|
|
55464
|
+
...event.body,
|
|
55465
|
+
userId: Number(message.userId)
|
|
55466
|
+
}
|
|
55467
|
+
});
|
|
55468
|
+
} else {
|
|
55469
|
+
log.insertEventsFromOtherConnections({
|
|
55470
|
+
...event,
|
|
55471
|
+
userId: Number(message.userId)
|
|
55472
|
+
});
|
|
55473
|
+
}
|
|
55397
55474
|
const last = log.getLastConfirmed();
|
|
55398
55475
|
if (last) {
|
|
55399
55476
|
board.events.subject.publish(last);
|
|
@@ -55411,7 +55488,7 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
55411
55488
|
handleHTMLSnapshotApplication(msg.JSONSnapshot, board);
|
|
55412
55489
|
log.list.clearConfirmedRecords();
|
|
55413
55490
|
}
|
|
55414
|
-
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
55491
|
+
handleBoardEventListApplication(expandEvents(msg.eventsSinceLastSnapshot), board);
|
|
55415
55492
|
board.setInterfaceType(msg.mode);
|
|
55416
55493
|
board.subject.publish();
|
|
55417
55494
|
onBoardLoad(board);
|
|
@@ -57763,7 +57840,7 @@ init_Settings();
|
|
|
57763
57840
|
init_QuickAddButtons3();
|
|
57764
57841
|
|
|
57765
57842
|
// src/Selection/SelectionItems.ts
|
|
57766
|
-
|
|
57843
|
+
init_BaseItem2();
|
|
57767
57844
|
|
|
57768
57845
|
class SelectionItems {
|
|
57769
57846
|
items = new Map;
|
|
@@ -57790,6 +57867,9 @@ class SelectionItems {
|
|
|
57790
57867
|
list() {
|
|
57791
57868
|
return Array.from(this.items.values());
|
|
57792
57869
|
}
|
|
57870
|
+
listAll() {
|
|
57871
|
+
return this.list();
|
|
57872
|
+
}
|
|
57793
57873
|
isEmpty() {
|
|
57794
57874
|
return this.items.size === 0;
|
|
57795
57875
|
}
|
|
@@ -58085,7 +58165,7 @@ init_RichText();
|
|
|
58085
58165
|
init_AINode();
|
|
58086
58166
|
init_Sticker();
|
|
58087
58167
|
init_Frame();
|
|
58088
|
-
|
|
58168
|
+
init_BaseItem2();
|
|
58089
58169
|
function handleMultipleItemsResize({
|
|
58090
58170
|
board,
|
|
58091
58171
|
resize,
|
|
@@ -58468,7 +58548,7 @@ init_Image();
|
|
|
58468
58548
|
init_SessionStorage();
|
|
58469
58549
|
init_Point();
|
|
58470
58550
|
init_Items();
|
|
58471
|
-
|
|
58551
|
+
init_BaseItem2();
|
|
58472
58552
|
function transformItems({
|
|
58473
58553
|
board,
|
|
58474
58554
|
selection,
|
|
@@ -61253,8 +61333,9 @@ class Board {
|
|
|
61253
61333
|
const data = Array.from(items.children).map((el) => this.parseHTML(el));
|
|
61254
61334
|
for (const parsedData of data) {
|
|
61255
61335
|
if ("childrenMap" in parsedData) {
|
|
61256
|
-
const
|
|
61257
|
-
const
|
|
61336
|
+
const frameData = parsedData;
|
|
61337
|
+
const addedFrame = this.add(this.createItem(this.getNewItemId(), frameData.data));
|
|
61338
|
+
const addedChildren = Object.values(frameData.childrenMap).map((childData) => {
|
|
61258
61339
|
const created = this.createItem(this.getNewItemId(), childData);
|
|
61259
61340
|
const added = this.add(created);
|
|
61260
61341
|
idsMap[childData.id] = added.getId();
|
|
@@ -61267,17 +61348,18 @@ class Board {
|
|
|
61267
61348
|
return added;
|
|
61268
61349
|
});
|
|
61269
61350
|
addedFrame.addChildItems(addedChildren);
|
|
61270
|
-
|
|
61271
|
-
idsMap[
|
|
61351
|
+
frameData.data.children = addedChildren.map((item) => item.getId());
|
|
61352
|
+
idsMap[frameData.data.id] = addedFrame.getId();
|
|
61272
61353
|
} else {
|
|
61273
|
-
const
|
|
61354
|
+
const itemData = parsedData;
|
|
61355
|
+
const added = this.add(this.createItem(this.getNewItemId(), itemData));
|
|
61274
61356
|
if (added.itemType === "Connector") {
|
|
61275
61357
|
addedConnectors.push({
|
|
61276
61358
|
item: added,
|
|
61277
|
-
data:
|
|
61359
|
+
data: itemData
|
|
61278
61360
|
});
|
|
61279
61361
|
}
|
|
61280
|
-
idsMap[
|
|
61362
|
+
idsMap[itemData.id] = added.getId();
|
|
61281
61363
|
}
|
|
61282
61364
|
}
|
|
61283
61365
|
addedConnectors.forEach((connector) => {
|
|
@@ -61321,12 +61403,13 @@ class Board {
|
|
|
61321
61403
|
this.index.insert(item);
|
|
61322
61404
|
return item;
|
|
61323
61405
|
};
|
|
61324
|
-
for (const
|
|
61325
|
-
if ("childrenMap" in
|
|
61326
|
-
|
|
61327
|
-
|
|
61406
|
+
for (const rawItemData of items) {
|
|
61407
|
+
if ("childrenMap" in rawItemData) {
|
|
61408
|
+
const frameData = rawItemData;
|
|
61409
|
+
Object.values(frameData.childrenMap).map((childData) => addItem(childData));
|
|
61410
|
+
addItem(frameData.data);
|
|
61328
61411
|
} else {
|
|
61329
|
-
addItem(
|
|
61412
|
+
addItem(rawItemData);
|
|
61330
61413
|
}
|
|
61331
61414
|
}
|
|
61332
61415
|
for (const key in createdConnectors) {
|
|
@@ -61759,8 +61842,9 @@ class Board {
|
|
|
61759
61842
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
61760
61843
|
}
|
|
61761
61844
|
}
|
|
61762
|
-
|
|
61763
|
-
|
|
61845
|
+
const itemDataWithChildren = itemData;
|
|
61846
|
+
if ("children" in itemDataWithChildren && itemDataWithChildren.children?.length) {
|
|
61847
|
+
itemDataWithChildren.children = itemDataWithChildren.children.map((childId) => newItemIdMap[childId]);
|
|
61764
61848
|
}
|
|
61765
61849
|
newMap[newItemId] = itemData;
|
|
61766
61850
|
}
|
|
@@ -61943,7 +62027,7 @@ function initI18N(i18nInstance) {
|
|
|
61943
62027
|
// src/index.ts
|
|
61944
62028
|
init_MediaHelpers();
|
|
61945
62029
|
init_CreateCommand();
|
|
61946
|
-
|
|
62030
|
+
init_BaseItem();
|
|
61947
62031
|
init_Events();
|
|
61948
62032
|
BaseItem.createCommand = createCommand;
|
|
61949
62033
|
Events.createCommand = createCommand;
|