microboard-temp 0.4.58 → 0.4.59
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 +875 -861
- package/dist/cjs/index.js +875 -861
- package/dist/cjs/node.js +875 -861
- package/dist/esm/browser.js +875 -861
- package/dist/esm/index.js +875 -861
- package/dist/esm/node.js +875 -861
- package/dist/types/Items/Frame/FrameCommand.d.ts +2 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -801,8 +801,8 @@ class BoardCommand {
|
|
|
801
801
|
switch (operation.method) {
|
|
802
802
|
case "bringToFront": {
|
|
803
803
|
for (const id in operation.prevZIndex) {
|
|
804
|
-
const
|
|
805
|
-
if (!
|
|
804
|
+
const item2 = this.board.items.getById(id);
|
|
805
|
+
if (!item2) {
|
|
806
806
|
delete operation.prevZIndex.id;
|
|
807
807
|
}
|
|
808
808
|
}
|
|
@@ -814,8 +814,8 @@ class BoardCommand {
|
|
|
814
814
|
}
|
|
815
815
|
case "sendToBack": {
|
|
816
816
|
for (const id in operation.prevZIndex) {
|
|
817
|
-
const
|
|
818
|
-
if (!
|
|
817
|
+
const item2 = this.board.items.getById(id);
|
|
818
|
+
if (!item2) {
|
|
819
819
|
delete operation.prevZIndex.id;
|
|
820
820
|
}
|
|
821
821
|
}
|
|
@@ -829,11 +829,11 @@ class BoardCommand {
|
|
|
829
829
|
case "moveSecondBeforeFirst":
|
|
830
830
|
case "moveToZIndex": {
|
|
831
831
|
const items = this.board.items;
|
|
832
|
-
const
|
|
833
|
-
if (!
|
|
832
|
+
const item2 = items.getById(operation.item);
|
|
833
|
+
if (!item2) {
|
|
834
834
|
throw new Error("Get reverse board operation. Item not found");
|
|
835
835
|
}
|
|
836
|
-
const zIndex = this.board.getZIndex(
|
|
836
|
+
const zIndex = this.board.getZIndex(item2);
|
|
837
837
|
return {
|
|
838
838
|
class: "Board",
|
|
839
839
|
method: "moveToZIndex",
|
|
@@ -843,8 +843,8 @@ class BoardCommand {
|
|
|
843
843
|
}
|
|
844
844
|
case "moveManyToZIndex": {
|
|
845
845
|
for (const id in operation.item) {
|
|
846
|
-
const
|
|
847
|
-
if (!
|
|
846
|
+
const item2 = this.board.items.getById(id);
|
|
847
|
+
if (!item2) {
|
|
848
848
|
delete operation.item.id;
|
|
849
849
|
}
|
|
850
850
|
}
|
|
@@ -861,15 +861,15 @@ class BoardCommand {
|
|
|
861
861
|
const items = this.board.items;
|
|
862
862
|
const reverse = [];
|
|
863
863
|
for (const itemId of operation.item) {
|
|
864
|
-
const
|
|
865
|
-
if (!
|
|
864
|
+
const item2 = items.getById(itemId);
|
|
865
|
+
if (!item2) {
|
|
866
866
|
throw new Error("Get reverse board operation. Item not found");
|
|
867
867
|
}
|
|
868
868
|
reverse.push({
|
|
869
869
|
class: "Board",
|
|
870
870
|
method: "add",
|
|
871
871
|
item: itemId,
|
|
872
|
-
data:
|
|
872
|
+
data: item2.serialize()
|
|
873
873
|
});
|
|
874
874
|
}
|
|
875
875
|
return reverse;
|
|
@@ -892,32 +892,32 @@ class BoardCommand {
|
|
|
892
892
|
const items = this.board.items;
|
|
893
893
|
const reverse = [];
|
|
894
894
|
for (const itemId of operation.item) {
|
|
895
|
-
const
|
|
896
|
-
if (!
|
|
895
|
+
const item2 = items.getById(itemId);
|
|
896
|
+
if (!item2 || item2.itemType !== "Group") {
|
|
897
897
|
throw new Error("Get reverse board operation. Item not found");
|
|
898
898
|
}
|
|
899
899
|
reverse.push({
|
|
900
900
|
class: "Board",
|
|
901
901
|
method: "addLockedGroup",
|
|
902
902
|
item: itemId,
|
|
903
|
-
data:
|
|
903
|
+
data: item2.serialize()
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
return reverse;
|
|
907
907
|
}
|
|
908
908
|
case "duplicate":
|
|
909
909
|
case "paste": {
|
|
910
|
-
const
|
|
910
|
+
const item2 = [];
|
|
911
911
|
const map = operation.itemsMap;
|
|
912
912
|
for (const key in map) {
|
|
913
913
|
if (map.hasOwnProperty(key)) {
|
|
914
|
-
|
|
914
|
+
item2.push(key);
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
917
|
return {
|
|
918
918
|
class: "Board",
|
|
919
919
|
method: "remove",
|
|
920
|
-
item
|
|
920
|
+
item: item2
|
|
921
921
|
};
|
|
922
922
|
}
|
|
923
923
|
}
|
|
@@ -7235,11 +7235,11 @@ class SubjectOperation {
|
|
|
7235
7235
|
}
|
|
7236
7236
|
|
|
7237
7237
|
// src/Items/ItemsCommandUtils.ts
|
|
7238
|
-
function mapItemsByOperation(
|
|
7239
|
-
const items = Array.isArray(
|
|
7240
|
-
return items.map((
|
|
7241
|
-
const operation = getCallback(
|
|
7242
|
-
return { item:
|
|
7238
|
+
function mapItemsByOperation(item2, getCallback) {
|
|
7239
|
+
const items = Array.isArray(item2) ? item2 : [item2];
|
|
7240
|
+
return items.map((item3) => {
|
|
7241
|
+
const operation = getCallback(item3);
|
|
7242
|
+
return { item: item3, operation };
|
|
7243
7243
|
});
|
|
7244
7244
|
}
|
|
7245
7245
|
|
|
@@ -7264,8 +7264,8 @@ class TransformationCommand {
|
|
|
7264
7264
|
}
|
|
7265
7265
|
}
|
|
7266
7266
|
revert() {
|
|
7267
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
7268
|
-
|
|
7267
|
+
this.reverse.forEach(({ item: item2, operation }) => {
|
|
7268
|
+
item2.apply(operation);
|
|
7269
7269
|
});
|
|
7270
7270
|
}
|
|
7271
7271
|
getReverse() {
|
|
@@ -8007,8 +8007,8 @@ class Path {
|
|
|
8007
8007
|
}
|
|
8008
8008
|
getIntersectionPoints(segment) {
|
|
8009
8009
|
let intersections = [];
|
|
8010
|
-
for (const
|
|
8011
|
-
intersections = intersections.concat(
|
|
8010
|
+
for (const item2 of this.segments) {
|
|
8011
|
+
intersections = intersections.concat(item2.getIntersectionPoints(segment));
|
|
8012
8012
|
}
|
|
8013
8013
|
return intersections;
|
|
8014
8014
|
}
|
|
@@ -8073,8 +8073,8 @@ class Path {
|
|
|
8073
8073
|
}
|
|
8074
8074
|
isOpenEnclosedOrCrossedBy(rectangle) {
|
|
8075
8075
|
let is = false;
|
|
8076
|
-
for (const
|
|
8077
|
-
is = is ||
|
|
8076
|
+
for (const item2 of this.segments) {
|
|
8077
|
+
is = is || item2.isEnclosedOrCrossedBy(rectangle);
|
|
8078
8078
|
}
|
|
8079
8079
|
return is;
|
|
8080
8080
|
}
|
|
@@ -8487,8 +8487,8 @@ class ConnectorCommand {
|
|
|
8487
8487
|
}
|
|
8488
8488
|
}
|
|
8489
8489
|
revert() {
|
|
8490
|
-
for (const { item, operation } of this.reverse) {
|
|
8491
|
-
|
|
8490
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
8491
|
+
item2.apply(operation);
|
|
8492
8492
|
}
|
|
8493
8493
|
}
|
|
8494
8494
|
getReverse() {
|
|
@@ -8645,11 +8645,11 @@ class SessionStorage {
|
|
|
8645
8645
|
}
|
|
8646
8646
|
get(key) {
|
|
8647
8647
|
const boardId = this.getBoardId() || "";
|
|
8648
|
-
const
|
|
8649
|
-
if (!
|
|
8648
|
+
const item2 = _sessionStorage.getItem(boardId + "_" + key);
|
|
8649
|
+
if (!item2) {
|
|
8650
8650
|
return;
|
|
8651
8651
|
}
|
|
8652
|
-
return JSON.parse(
|
|
8652
|
+
return JSON.parse(item2);
|
|
8653
8653
|
}
|
|
8654
8654
|
remove(key) {
|
|
8655
8655
|
const boardId = this.getBoardId() || "";
|
|
@@ -9429,8 +9429,8 @@ class LinkToCommand {
|
|
|
9429
9429
|
}
|
|
9430
9430
|
}
|
|
9431
9431
|
revert() {
|
|
9432
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
9433
|
-
|
|
9432
|
+
this.reverse.forEach(({ item: item2, operation }) => {
|
|
9433
|
+
item2.apply(operation);
|
|
9434
9434
|
});
|
|
9435
9435
|
}
|
|
9436
9436
|
getReverse() {
|
|
@@ -10727,9 +10727,9 @@ function handleSplitListItem(editor) {
|
|
|
10727
10727
|
import_slate5.Transforms.insertNodes(editor, {
|
|
10728
10728
|
type: listType,
|
|
10729
10729
|
listLevel: listNode.listLevel || 0,
|
|
10730
|
-
children: itemsAfter.map((
|
|
10730
|
+
children: itemsAfter.map((item2) => ({
|
|
10731
10731
|
type: "list_item",
|
|
10732
|
-
children:
|
|
10732
|
+
children: item2.children
|
|
10733
10733
|
}))
|
|
10734
10734
|
}, { at: newListPath });
|
|
10735
10735
|
}
|
|
@@ -12706,10 +12706,10 @@ function initializeDocument(effects) {
|
|
|
12706
12706
|
return start;
|
|
12707
12707
|
function start(code) {
|
|
12708
12708
|
if (continued < stack.length) {
|
|
12709
|
-
const
|
|
12710
|
-
self2.containerState =
|
|
12711
|
-
ok(
|
|
12712
|
-
return effects.attempt(
|
|
12709
|
+
const item2 = stack[continued];
|
|
12710
|
+
self2.containerState = item2[1];
|
|
12711
|
+
ok(item2[0].continuation, "expected `continuation` to be defined on container construct");
|
|
12712
|
+
return effects.attempt(item2[0].continuation, documentContinue, checkNewContainers)(code);
|
|
12713
12713
|
}
|
|
12714
12714
|
return checkNewContainers(code);
|
|
12715
12715
|
}
|
|
@@ -13685,17 +13685,17 @@ class SpliceBuffer {
|
|
|
13685
13685
|
this.setCursor(Number.POSITIVE_INFINITY);
|
|
13686
13686
|
return this.left.pop();
|
|
13687
13687
|
}
|
|
13688
|
-
push(
|
|
13688
|
+
push(item2) {
|
|
13689
13689
|
this.setCursor(Number.POSITIVE_INFINITY);
|
|
13690
|
-
this.left.push(
|
|
13690
|
+
this.left.push(item2);
|
|
13691
13691
|
}
|
|
13692
13692
|
pushMany(items) {
|
|
13693
13693
|
this.setCursor(Number.POSITIVE_INFINITY);
|
|
13694
13694
|
chunkedPush(this.left, items);
|
|
13695
13695
|
}
|
|
13696
|
-
unshift(
|
|
13696
|
+
unshift(item2) {
|
|
13697
13697
|
this.setCursor(0);
|
|
13698
|
-
this.right.push(
|
|
13698
|
+
this.right.push(item2);
|
|
13699
13699
|
}
|
|
13700
13700
|
unshiftMany(items) {
|
|
13701
13701
|
this.setCursor(0);
|
|
@@ -15726,8 +15726,8 @@ function initializeFactory(field) {
|
|
|
15726
15726
|
if (list2) {
|
|
15727
15727
|
ok(Array.isArray(list2), "expected `disable.null` to be populated");
|
|
15728
15728
|
while (++index2 < list2.length) {
|
|
15729
|
-
const
|
|
15730
|
-
if (!
|
|
15729
|
+
const item2 = list2[index2];
|
|
15730
|
+
if (!item2.previous || item2.previous.call(self2, self2.previous)) {
|
|
15731
15731
|
return true;
|
|
15732
15732
|
}
|
|
15733
15733
|
}
|
|
@@ -16558,14 +16558,14 @@ function compiler(options) {
|
|
|
16558
16558
|
length++;
|
|
16559
16559
|
}
|
|
16560
16560
|
if (event[1].type === types.listItemPrefix) {
|
|
16561
|
-
const
|
|
16561
|
+
const item2 = {
|
|
16562
16562
|
type: "listItem",
|
|
16563
16563
|
_spread: false,
|
|
16564
16564
|
start: Object.assign({}, event[1].start),
|
|
16565
16565
|
end: undefined
|
|
16566
16566
|
};
|
|
16567
|
-
listItem2 =
|
|
16568
|
-
events.splice(index2, 0, ["enter",
|
|
16567
|
+
listItem2 = item2;
|
|
16568
|
+
events.splice(index2, 0, ["enter", item2, event[2]]);
|
|
16569
16569
|
index2++;
|
|
16570
16570
|
length++;
|
|
16571
16571
|
firstBlankLineIndex = undefined;
|
|
@@ -17363,14 +17363,14 @@ class MarkdownProcessor {
|
|
|
17363
17363
|
if (err || !file) {
|
|
17364
17364
|
throw err;
|
|
17365
17365
|
}
|
|
17366
|
-
const nodes = file.result.map((
|
|
17366
|
+
const nodes = file.result.map((item2) => {
|
|
17367
17367
|
setNodeStyles({
|
|
17368
|
-
node:
|
|
17368
|
+
node: item2,
|
|
17369
17369
|
editor: this.editor,
|
|
17370
17370
|
horisontalAlignment: "left",
|
|
17371
|
-
isPaddingTopNeeded:
|
|
17371
|
+
isPaddingTopNeeded: item2.type !== "code_block"
|
|
17372
17372
|
});
|
|
17373
|
-
return
|
|
17373
|
+
return item2;
|
|
17374
17374
|
});
|
|
17375
17375
|
if (isNewParagraphNeeded) {
|
|
17376
17376
|
nodes.push(createParagraphNode("", this.editor));
|
|
@@ -18348,8 +18348,8 @@ class ShapeCommand {
|
|
|
18348
18348
|
}
|
|
18349
18349
|
}
|
|
18350
18350
|
revert() {
|
|
18351
|
-
for (const { item, operation } of this.reverse) {
|
|
18352
|
-
|
|
18351
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
18352
|
+
item2.apply(operation);
|
|
18353
18353
|
}
|
|
18354
18354
|
}
|
|
18355
18355
|
getReverse() {
|
|
@@ -18431,8 +18431,8 @@ class RichTextCommand {
|
|
|
18431
18431
|
}
|
|
18432
18432
|
}
|
|
18433
18433
|
revert() {
|
|
18434
|
-
for (const { item, operation } of this.reverse) {
|
|
18435
|
-
const richText = this.board.items.getById(
|
|
18434
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
18435
|
+
const richText = this.board.items.getById(item2);
|
|
18436
18436
|
if (!richText) {
|
|
18437
18437
|
continue;
|
|
18438
18438
|
}
|
|
@@ -18451,12 +18451,12 @@ class RichTextCommand {
|
|
|
18451
18451
|
case "setSelectionFontColor":
|
|
18452
18452
|
case "setSelectionBlockType":
|
|
18453
18453
|
const inverseOps = this.operation.ops.map((op) => import_slate34.Operation.inverse(op)).reverse();
|
|
18454
|
-
return items.map((
|
|
18454
|
+
return items.map((item2) => {
|
|
18455
18455
|
const operation = {
|
|
18456
18456
|
...this.operation,
|
|
18457
18457
|
ops: inverseOps
|
|
18458
18458
|
};
|
|
18459
|
-
return { item, operation };
|
|
18459
|
+
return { item: item2, operation };
|
|
18460
18460
|
});
|
|
18461
18461
|
case "setFontColor":
|
|
18462
18462
|
return items.map((id) => ({
|
|
@@ -18548,13 +18548,13 @@ class RichTextGroupCommand {
|
|
|
18548
18548
|
this.reverseOps = this.getReverse();
|
|
18549
18549
|
}
|
|
18550
18550
|
apply() {
|
|
18551
|
-
for (const { item, operation } of this.forwardOps) {
|
|
18552
|
-
|
|
18551
|
+
for (const { item: item2, operation } of this.forwardOps) {
|
|
18552
|
+
item2.applyCommand(operation);
|
|
18553
18553
|
}
|
|
18554
18554
|
}
|
|
18555
18555
|
revert() {
|
|
18556
|
-
for (const { item, operation } of this.reverseOps) {
|
|
18557
|
-
|
|
18556
|
+
for (const { item: item2, operation } of this.reverseOps) {
|
|
18557
|
+
item2.applyCommand(operation);
|
|
18558
18558
|
}
|
|
18559
18559
|
}
|
|
18560
18560
|
getForward() {
|
|
@@ -18669,8 +18669,8 @@ class DrawingCommand {
|
|
|
18669
18669
|
item;
|
|
18670
18670
|
operation;
|
|
18671
18671
|
reverse;
|
|
18672
|
-
constructor(
|
|
18673
|
-
this.item =
|
|
18672
|
+
constructor(item2, operation) {
|
|
18673
|
+
this.item = item2;
|
|
18674
18674
|
this.operation = operation;
|
|
18675
18675
|
this.reverse = this.getReverse();
|
|
18676
18676
|
}
|
|
@@ -18679,52 +18679,52 @@ class DrawingCommand {
|
|
|
18679
18679
|
return this;
|
|
18680
18680
|
}
|
|
18681
18681
|
apply() {
|
|
18682
|
-
for (const
|
|
18683
|
-
|
|
18682
|
+
for (const item2 of this.item) {
|
|
18683
|
+
item2.apply(this.operation);
|
|
18684
18684
|
}
|
|
18685
18685
|
}
|
|
18686
18686
|
revert() {
|
|
18687
|
-
for (const { item, operation } of this.reverse) {
|
|
18688
|
-
|
|
18687
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
18688
|
+
item2.apply(operation);
|
|
18689
18689
|
}
|
|
18690
18690
|
}
|
|
18691
18691
|
getReverse() {
|
|
18692
18692
|
const reverse = [];
|
|
18693
|
-
for (const
|
|
18694
|
-
reverse.push({ item, operation: this.getReverseOperation(
|
|
18693
|
+
for (const item2 of this.item) {
|
|
18694
|
+
reverse.push({ item: item2, operation: this.getReverseOperation(item2) });
|
|
18695
18695
|
}
|
|
18696
18696
|
return reverse;
|
|
18697
18697
|
}
|
|
18698
|
-
getReverseOperation(
|
|
18698
|
+
getReverseOperation(item2) {
|
|
18699
18699
|
switch (this.operation.method) {
|
|
18700
18700
|
case "setStrokeColor":
|
|
18701
18701
|
return {
|
|
18702
18702
|
class: "Drawing",
|
|
18703
18703
|
method: "setStrokeColor",
|
|
18704
|
-
item: [
|
|
18705
|
-
color:
|
|
18704
|
+
item: [item2.getId()],
|
|
18705
|
+
color: item2.getStrokeColor()
|
|
18706
18706
|
};
|
|
18707
18707
|
case "setStrokeWidth":
|
|
18708
18708
|
return {
|
|
18709
18709
|
class: "Drawing",
|
|
18710
18710
|
method: "setStrokeWidth",
|
|
18711
|
-
item: [
|
|
18711
|
+
item: [item2.getId()],
|
|
18712
18712
|
width: this.operation.prevWidth,
|
|
18713
|
-
prevWidth:
|
|
18713
|
+
prevWidth: item2.getStrokeWidth()
|
|
18714
18714
|
};
|
|
18715
18715
|
case "setStrokeOpacity":
|
|
18716
18716
|
return {
|
|
18717
18717
|
class: "Drawing",
|
|
18718
18718
|
method: "setStrokeOpacity",
|
|
18719
|
-
item: [
|
|
18720
|
-
opacity:
|
|
18719
|
+
item: [item2.getId()],
|
|
18720
|
+
opacity: item2.getStrokeOpacity()
|
|
18721
18721
|
};
|
|
18722
18722
|
case "setStrokeStyle":
|
|
18723
18723
|
return {
|
|
18724
18724
|
class: "Drawing",
|
|
18725
18725
|
method: "setStrokeStyle",
|
|
18726
|
-
item: [
|
|
18727
|
-
style:
|
|
18726
|
+
item: [item2.getId()],
|
|
18727
|
+
style: item2.getBorderStyle()
|
|
18728
18728
|
};
|
|
18729
18729
|
}
|
|
18730
18730
|
}
|
|
@@ -18746,8 +18746,8 @@ class StickerCommand {
|
|
|
18746
18746
|
}
|
|
18747
18747
|
}
|
|
18748
18748
|
revert() {
|
|
18749
|
-
for (const { item, operation } of this.reverse) {
|
|
18750
|
-
|
|
18749
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
18750
|
+
item2.apply(operation);
|
|
18751
18751
|
}
|
|
18752
18752
|
}
|
|
18753
18753
|
getReverse() {
|
|
@@ -18764,7 +18764,7 @@ class StickerCommand {
|
|
|
18764
18764
|
}
|
|
18765
18765
|
|
|
18766
18766
|
// src/Items/Frame/FrameCommand.ts
|
|
18767
|
-
class FrameCommand
|
|
18767
|
+
class FrameCommand {
|
|
18768
18768
|
frame;
|
|
18769
18769
|
operation;
|
|
18770
18770
|
reverse;
|
|
@@ -18779,8 +18779,8 @@ class FrameCommand extends BaseCommand {
|
|
|
18779
18779
|
}
|
|
18780
18780
|
}
|
|
18781
18781
|
revert() {
|
|
18782
|
-
for (const { item, operation } of this.reverse) {
|
|
18783
|
-
|
|
18782
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
18783
|
+
item2.apply(operation);
|
|
18784
18784
|
}
|
|
18785
18785
|
}
|
|
18786
18786
|
getReverse() {
|
|
@@ -18822,7 +18822,21 @@ class FrameCommand extends BaseCommand {
|
|
|
18822
18822
|
};
|
|
18823
18823
|
});
|
|
18824
18824
|
default:
|
|
18825
|
-
|
|
18825
|
+
const op = this.operation;
|
|
18826
|
+
let newData = {};
|
|
18827
|
+
if (op.prevData) {
|
|
18828
|
+
newData = { ...op.prevData };
|
|
18829
|
+
} else {
|
|
18830
|
+
Object.keys(op.newData).forEach((key) => {
|
|
18831
|
+
if (item[key]) {
|
|
18832
|
+
newData[key] = item[key];
|
|
18833
|
+
}
|
|
18834
|
+
});
|
|
18835
|
+
}
|
|
18836
|
+
return {
|
|
18837
|
+
...op,
|
|
18838
|
+
newData
|
|
18839
|
+
};
|
|
18826
18840
|
}
|
|
18827
18841
|
}
|
|
18828
18842
|
}
|
|
@@ -18843,8 +18857,8 @@ class CommentCommand {
|
|
|
18843
18857
|
}
|
|
18844
18858
|
}
|
|
18845
18859
|
revert() {
|
|
18846
|
-
this.reverse.forEach(({ item, operation }) => {
|
|
18847
|
-
|
|
18860
|
+
this.reverse.forEach(({ item: item2, operation }) => {
|
|
18861
|
+
item2.apply(operation);
|
|
18848
18862
|
});
|
|
18849
18863
|
}
|
|
18850
18864
|
getReverse() {
|
|
@@ -19306,8 +19320,8 @@ class GroupCommand {
|
|
|
19306
19320
|
}
|
|
19307
19321
|
}
|
|
19308
19322
|
revert() {
|
|
19309
|
-
for (const { item, operation } of this.reverse) {
|
|
19310
|
-
|
|
19323
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
19324
|
+
item2.apply(operation);
|
|
19311
19325
|
}
|
|
19312
19326
|
}
|
|
19313
19327
|
getReverse() {
|
|
@@ -19360,8 +19374,8 @@ class PlaceholderCommand {
|
|
|
19360
19374
|
}
|
|
19361
19375
|
}
|
|
19362
19376
|
revert() {
|
|
19363
|
-
for (const { item, operation } of this.reverse) {
|
|
19364
|
-
|
|
19377
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
19378
|
+
item2.apply(operation);
|
|
19365
19379
|
}
|
|
19366
19380
|
}
|
|
19367
19381
|
getReverse() {
|
|
@@ -19455,26 +19469,26 @@ class BaseCommand {
|
|
|
19455
19469
|
return this;
|
|
19456
19470
|
}
|
|
19457
19471
|
apply() {
|
|
19458
|
-
for (const
|
|
19459
|
-
|
|
19472
|
+
for (const item2 of this.items) {
|
|
19473
|
+
item2.apply(this.operation);
|
|
19460
19474
|
}
|
|
19461
19475
|
}
|
|
19462
19476
|
revert() {
|
|
19463
|
-
for (const { item, operation } of this.reverse) {
|
|
19464
|
-
|
|
19477
|
+
for (const { item: item2, operation } of this.reverse) {
|
|
19478
|
+
item2.apply(operation);
|
|
19465
19479
|
}
|
|
19466
19480
|
}
|
|
19467
19481
|
getReverse() {
|
|
19468
19482
|
const items = this.items;
|
|
19469
|
-
return mapItemsByOperation(items, (
|
|
19483
|
+
return mapItemsByOperation(items, (item2) => {
|
|
19470
19484
|
const op = this.operation;
|
|
19471
19485
|
let newData = {};
|
|
19472
19486
|
if (op.prevData) {
|
|
19473
19487
|
newData = { ...op.prevData };
|
|
19474
19488
|
} else {
|
|
19475
19489
|
Object.keys(op.newData).forEach((key) => {
|
|
19476
|
-
if (
|
|
19477
|
-
newData[key] =
|
|
19490
|
+
if (item2[key]) {
|
|
19491
|
+
newData[key] = item2[key];
|
|
19478
19492
|
}
|
|
19479
19493
|
});
|
|
19480
19494
|
}
|
|
@@ -19502,37 +19516,37 @@ var itemCommandFactories = {
|
|
|
19502
19516
|
LinkTo: createLinkToCommand
|
|
19503
19517
|
};
|
|
19504
19518
|
function createConnectorCommand(items, operation) {
|
|
19505
|
-
return new ConnectorCommand(items.filter((
|
|
19519
|
+
return new ConnectorCommand(items.filter((item2) => item2.itemType === "Connector"), operation);
|
|
19506
19520
|
}
|
|
19507
19521
|
function createShapeCommand(items, operation) {
|
|
19508
|
-
return new ShapeCommand(items.filter((
|
|
19522
|
+
return new ShapeCommand(items.filter((item2) => item2.itemType === "Shape"), operation);
|
|
19509
19523
|
}
|
|
19510
19524
|
function createDrawingCommand(items, operation) {
|
|
19511
|
-
return new DrawingCommand(items.filter((
|
|
19525
|
+
return new DrawingCommand(items.filter((item2) => item2.itemType === "Drawing"), operation);
|
|
19512
19526
|
}
|
|
19513
19527
|
function createCommentCommand(items, operation) {
|
|
19514
|
-
return new CommentCommand(items.filter((
|
|
19528
|
+
return new CommentCommand(items.filter((item2) => item2.itemType === "Comment"), operation);
|
|
19515
19529
|
}
|
|
19516
19530
|
function createStickerCommand(items, operation) {
|
|
19517
|
-
return new StickerCommand(items.filter((
|
|
19531
|
+
return new StickerCommand(items.filter((item2) => item2.itemType === "Sticker"), operation);
|
|
19518
19532
|
}
|
|
19519
19533
|
function createFrameCommand(items, operation) {
|
|
19520
|
-
return new FrameCommand(items.filter((
|
|
19534
|
+
return new FrameCommand(items.filter((item2) => item2.itemType === "Frame"), operation);
|
|
19521
19535
|
}
|
|
19522
19536
|
function createPlaceholderCommand(items, operation) {
|
|
19523
|
-
return new PlaceholderCommand(items.filter((
|
|
19537
|
+
return new PlaceholderCommand(items.filter((item2) => item2.itemType === "Placeholder"), operation);
|
|
19524
19538
|
}
|
|
19525
19539
|
function createGroupCommand(items, operation) {
|
|
19526
|
-
return new GroupCommand(items.filter((
|
|
19540
|
+
return new GroupCommand(items.filter((item2) => item2.itemType === "Group"), operation);
|
|
19527
19541
|
}
|
|
19528
19542
|
function createImageCommand(items, operation) {
|
|
19529
|
-
return new ImageCommand(items.filter((
|
|
19543
|
+
return new ImageCommand(items.filter((item2) => item2.itemType === "Image"), operation);
|
|
19530
19544
|
}
|
|
19531
19545
|
function createVideoCommand(items, operation) {
|
|
19532
|
-
return new VideoCommand(items.filter((
|
|
19546
|
+
return new VideoCommand(items.filter((item2) => item2.itemType === "Video"), operation);
|
|
19533
19547
|
}
|
|
19534
19548
|
function createAudioCommand(items, operation) {
|
|
19535
|
-
return new AudioCommand(items.filter((
|
|
19549
|
+
return new AudioCommand(items.filter((item2) => item2.itemType === "Audio"), operation);
|
|
19536
19550
|
}
|
|
19537
19551
|
function createRichTextCommand(items, operation, board) {
|
|
19538
19552
|
if (!board) {
|
|
@@ -19540,8 +19554,8 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19540
19554
|
}
|
|
19541
19555
|
if (operation.method === "groupEdit") {
|
|
19542
19556
|
const texts = [];
|
|
19543
|
-
for (const { item } of operation.itemsOps) {
|
|
19544
|
-
const found = board.items.findById(
|
|
19557
|
+
for (const { item: item2 } of operation.itemsOps) {
|
|
19558
|
+
const found = board.items.findById(item2);
|
|
19545
19559
|
const text3 = found?.getRichText();
|
|
19546
19560
|
if (text3) {
|
|
19547
19561
|
texts.push(text3);
|
|
@@ -19549,14 +19563,14 @@ function createRichTextCommand(items, operation, board) {
|
|
|
19549
19563
|
}
|
|
19550
19564
|
return new RichTextGroupCommand(texts, operation);
|
|
19551
19565
|
} else {
|
|
19552
|
-
return new RichTextCommand(board, items.map((
|
|
19566
|
+
return new RichTextCommand(board, items.map((item2) => item2.getId()), operation);
|
|
19553
19567
|
}
|
|
19554
19568
|
}
|
|
19555
19569
|
function createTransformationCommand(items, operation) {
|
|
19556
|
-
return new TransformationCommand(items.map((
|
|
19570
|
+
return new TransformationCommand(items.map((item2) => item2.transformation), operation);
|
|
19557
19571
|
}
|
|
19558
19572
|
function createLinkToCommand(items, operation) {
|
|
19559
|
-
return new LinkToCommand(items.map((
|
|
19573
|
+
return new LinkToCommand(items.map((item2) => item2.linkTo), operation);
|
|
19560
19574
|
}
|
|
19561
19575
|
function createCommand(board, operation) {
|
|
19562
19576
|
try {
|
|
@@ -19574,13 +19588,13 @@ function createCommand(board, operation) {
|
|
|
19574
19588
|
default: {
|
|
19575
19589
|
const itemType = operation.class;
|
|
19576
19590
|
const itemIdList = "item" in operation ? Array.isArray(operation.item) ? operation.item : [operation.item] : ("items" in operation) ? Object.keys(operation.items) : operation.itemsOps.map((itemOp) => itemOp.item);
|
|
19577
|
-
const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((
|
|
19578
|
-
if (typeof
|
|
19579
|
-
console.warn(`Item with ID ${
|
|
19591
|
+
const items = itemIdList.map((itemId) => board.items.findById(itemId) ?? itemId).filter((item2) => {
|
|
19592
|
+
if (typeof item2 === "string") {
|
|
19593
|
+
console.warn(`Item with ID ${item2} not found for operation ${operation.class}.${operation.method}`);
|
|
19580
19594
|
return false;
|
|
19581
19595
|
}
|
|
19582
|
-
if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" &&
|
|
19583
|
-
console.warn(`Item with ID ${
|
|
19596
|
+
if (operation.class !== "Transformation" && operation.class !== "RichText" && operation.class !== "LinkTo" && item2.itemType !== operation.class) {
|
|
19597
|
+
console.warn(`Item with ID ${item2} is not of operation type: ${itemType}.`);
|
|
19584
19598
|
return false;
|
|
19585
19599
|
}
|
|
19586
19600
|
return true;
|
|
@@ -19881,20 +19895,20 @@ class RBush {
|
|
|
19881
19895
|
}
|
|
19882
19896
|
return this;
|
|
19883
19897
|
}
|
|
19884
|
-
insert(
|
|
19885
|
-
if (
|
|
19886
|
-
this._insert(
|
|
19898
|
+
insert(item2) {
|
|
19899
|
+
if (item2)
|
|
19900
|
+
this._insert(item2, this.data.height - 1);
|
|
19887
19901
|
return this;
|
|
19888
19902
|
}
|
|
19889
19903
|
clear() {
|
|
19890
19904
|
this.data = createNode([]);
|
|
19891
19905
|
return this;
|
|
19892
19906
|
}
|
|
19893
|
-
remove(
|
|
19894
|
-
if (!
|
|
19907
|
+
remove(item2, equalsFn) {
|
|
19908
|
+
if (!item2)
|
|
19895
19909
|
return this;
|
|
19896
19910
|
let node2 = this.data;
|
|
19897
|
-
const bbox = this.toBBox(
|
|
19911
|
+
const bbox = this.toBBox(item2);
|
|
19898
19912
|
const path2 = [];
|
|
19899
19913
|
const indexes = [];
|
|
19900
19914
|
let i, parent, goingUp;
|
|
@@ -19906,7 +19920,7 @@ class RBush {
|
|
|
19906
19920
|
goingUp = true;
|
|
19907
19921
|
}
|
|
19908
19922
|
if (node2.leaf) {
|
|
19909
|
-
const index2 = findItem(
|
|
19923
|
+
const index2 = findItem(item2, node2.children, equalsFn);
|
|
19910
19924
|
if (index2 !== -1) {
|
|
19911
19925
|
node2.children.splice(index2, 1);
|
|
19912
19926
|
path2.push(node2);
|
|
@@ -19929,8 +19943,8 @@ class RBush {
|
|
|
19929
19943
|
}
|
|
19930
19944
|
return this;
|
|
19931
19945
|
}
|
|
19932
|
-
toBBox(
|
|
19933
|
-
return
|
|
19946
|
+
toBBox(item2) {
|
|
19947
|
+
return item2;
|
|
19934
19948
|
}
|
|
19935
19949
|
compareMinX(a, b) {
|
|
19936
19950
|
return a.minX - b.minX;
|
|
@@ -20013,11 +20027,11 @@ class RBush {
|
|
|
20013
20027
|
}
|
|
20014
20028
|
return node2;
|
|
20015
20029
|
}
|
|
20016
|
-
_insert(
|
|
20017
|
-
const bbox = isNode ?
|
|
20030
|
+
_insert(item2, level, isNode) {
|
|
20031
|
+
const bbox = isNode ? item2 : this.toBBox(item2);
|
|
20018
20032
|
const insertPath = [];
|
|
20019
20033
|
const node2 = this._chooseSubtree(bbox, this.data, level, insertPath);
|
|
20020
|
-
node2.children.push(
|
|
20034
|
+
node2.children.push(item2);
|
|
20021
20035
|
extend2(node2, bbox);
|
|
20022
20036
|
while (level >= 0) {
|
|
20023
20037
|
if (insertPath[level].children.length > this._maxEntries) {
|
|
@@ -20116,11 +20130,11 @@ class RBush {
|
|
|
20116
20130
|
}
|
|
20117
20131
|
}
|
|
20118
20132
|
}
|
|
20119
|
-
function findItem(
|
|
20133
|
+
function findItem(item2, items, equalsFn) {
|
|
20120
20134
|
if (!equalsFn)
|
|
20121
|
-
return items.indexOf(
|
|
20135
|
+
return items.indexOf(item2);
|
|
20122
20136
|
for (let i = 0;i < items.length; i++) {
|
|
20123
|
-
if (equalsFn(
|
|
20137
|
+
if (equalsFn(item2, items[i]))
|
|
20124
20138
|
return i;
|
|
20125
20139
|
}
|
|
20126
20140
|
return -1;
|
|
@@ -20211,8 +20225,8 @@ class TinyQueue {
|
|
|
20211
20225
|
this._down(i);
|
|
20212
20226
|
}
|
|
20213
20227
|
}
|
|
20214
|
-
push(
|
|
20215
|
-
this.data.push(
|
|
20228
|
+
push(item2) {
|
|
20229
|
+
this.data.push(item2);
|
|
20216
20230
|
this.length++;
|
|
20217
20231
|
this._up(this.length - 1);
|
|
20218
20232
|
}
|
|
@@ -20233,21 +20247,21 @@ class TinyQueue {
|
|
|
20233
20247
|
}
|
|
20234
20248
|
_up(pos) {
|
|
20235
20249
|
const { data, compare } = this;
|
|
20236
|
-
const
|
|
20250
|
+
const item2 = data[pos];
|
|
20237
20251
|
while (pos > 0) {
|
|
20238
20252
|
const parent = pos - 1 >> 1;
|
|
20239
20253
|
const current = data[parent];
|
|
20240
|
-
if (compare(
|
|
20254
|
+
if (compare(item2, current) >= 0)
|
|
20241
20255
|
break;
|
|
20242
20256
|
data[pos] = current;
|
|
20243
20257
|
pos = parent;
|
|
20244
20258
|
}
|
|
20245
|
-
data[pos] =
|
|
20259
|
+
data[pos] = item2;
|
|
20246
20260
|
}
|
|
20247
20261
|
_down(pos) {
|
|
20248
20262
|
const { data, compare } = this;
|
|
20249
20263
|
const halfLength = this.length >> 1;
|
|
20250
|
-
const
|
|
20264
|
+
const item2 = data[pos];
|
|
20251
20265
|
while (pos < halfLength) {
|
|
20252
20266
|
let left = (pos << 1) + 1;
|
|
20253
20267
|
let best = data[left];
|
|
@@ -20256,12 +20270,12 @@ class TinyQueue {
|
|
|
20256
20270
|
left = right;
|
|
20257
20271
|
best = data[right];
|
|
20258
20272
|
}
|
|
20259
|
-
if (compare(best,
|
|
20273
|
+
if (compare(best, item2) >= 0)
|
|
20260
20274
|
break;
|
|
20261
20275
|
data[pos] = best;
|
|
20262
20276
|
pos = left;
|
|
20263
20277
|
}
|
|
20264
|
-
data[pos] =
|
|
20278
|
+
data[pos] = item2;
|
|
20265
20279
|
}
|
|
20266
20280
|
}
|
|
20267
20281
|
function defaultCompare2(a, b) {
|
|
@@ -20349,10 +20363,10 @@ class RTreeIndex {
|
|
|
20349
20363
|
return container ? container.item : undefined;
|
|
20350
20364
|
}
|
|
20351
20365
|
remove(id) {
|
|
20352
|
-
const
|
|
20353
|
-
if (
|
|
20366
|
+
const item2 = this.map.get(id);
|
|
20367
|
+
if (item2) {
|
|
20354
20368
|
this.map.delete(id);
|
|
20355
|
-
this.tree.remove(
|
|
20369
|
+
this.tree.remove(item2);
|
|
20356
20370
|
}
|
|
20357
20371
|
}
|
|
20358
20372
|
list() {
|
|
@@ -20424,11 +20438,11 @@ class Container extends Mbr {
|
|
|
20424
20438
|
item;
|
|
20425
20439
|
layer;
|
|
20426
20440
|
zIndex;
|
|
20427
|
-
constructor(id,
|
|
20428
|
-
const rect =
|
|
20441
|
+
constructor(id, item2, layer, zIndex) {
|
|
20442
|
+
const rect = item2.getMbrWithChildren();
|
|
20429
20443
|
super(rect.left, rect.top, rect.right, rect.bottom);
|
|
20430
20444
|
this.id = id;
|
|
20431
|
-
this.item =
|
|
20445
|
+
this.item = item2;
|
|
20432
20446
|
this.layer = layer;
|
|
20433
20447
|
this.zIndex = zIndex;
|
|
20434
20448
|
}
|
|
@@ -20445,7 +20459,7 @@ class LayeredIndex {
|
|
|
20445
20459
|
this.getZIndex = this.getZIndex.bind(this);
|
|
20446
20460
|
this.layers.newOnTop();
|
|
20447
20461
|
}
|
|
20448
|
-
isT(
|
|
20462
|
+
isT(item2) {
|
|
20449
20463
|
return true;
|
|
20450
20464
|
}
|
|
20451
20465
|
findById(id) {
|
|
@@ -20509,8 +20523,8 @@ class LayeredIndex {
|
|
|
20509
20523
|
}
|
|
20510
20524
|
getContainersFromItems(items) {
|
|
20511
20525
|
const containers = [];
|
|
20512
|
-
for (const
|
|
20513
|
-
const container = this.map.get(
|
|
20526
|
+
for (const item2 of items) {
|
|
20527
|
+
const container = this.map.get(item2.getId());
|
|
20514
20528
|
if (container) {
|
|
20515
20529
|
containers.push(container);
|
|
20516
20530
|
}
|
|
@@ -20587,9 +20601,9 @@ class LayeredIndex {
|
|
|
20587
20601
|
}
|
|
20588
20602
|
}
|
|
20589
20603
|
}
|
|
20590
|
-
insert(
|
|
20591
|
-
const toInsert = new Container(
|
|
20592
|
-
const bounds =
|
|
20604
|
+
insert(item2) {
|
|
20605
|
+
const toInsert = new Container(item2.getId(), item2, 0, this.getZIndex(item2));
|
|
20606
|
+
const bounds = item2.getMbrWithChildren();
|
|
20593
20607
|
const inBounds = this.getRectsEnclosedOrCrossedBy(bounds);
|
|
20594
20608
|
if (inBounds.length === 0) {
|
|
20595
20609
|
return this.insertContainer(toInsert);
|
|
@@ -20656,20 +20670,20 @@ class LayeredIndex {
|
|
|
20656
20670
|
}
|
|
20657
20671
|
}
|
|
20658
20672
|
}
|
|
20659
|
-
change(
|
|
20660
|
-
const id =
|
|
20673
|
+
change(item2) {
|
|
20674
|
+
const id = item2.getId();
|
|
20661
20675
|
const container = this.map.get(id);
|
|
20662
20676
|
if (container) {
|
|
20663
20677
|
const layer = this.layers.get(container.layer);
|
|
20664
20678
|
if (layer) {
|
|
20665
20679
|
layer.remove(id);
|
|
20666
20680
|
this.map.delete(id);
|
|
20667
|
-
this.insert(
|
|
20681
|
+
this.insert(item2);
|
|
20668
20682
|
}
|
|
20669
20683
|
}
|
|
20670
20684
|
}
|
|
20671
|
-
remove(
|
|
20672
|
-
const id =
|
|
20685
|
+
remove(item2) {
|
|
20686
|
+
const id = item2.getId();
|
|
20673
20687
|
const container = this.map.get(id);
|
|
20674
20688
|
if (container) {
|
|
20675
20689
|
const layer = this.layers.get(container.layer);
|
|
@@ -20695,13 +20709,13 @@ class LayeredIndex {
|
|
|
20695
20709
|
return items;
|
|
20696
20710
|
}
|
|
20697
20711
|
batchInsert(items) {
|
|
20698
|
-
for (const
|
|
20699
|
-
this.insert(
|
|
20712
|
+
for (const item2 of items) {
|
|
20713
|
+
this.insert(item2);
|
|
20700
20714
|
}
|
|
20701
20715
|
}
|
|
20702
20716
|
batchChange(items) {
|
|
20703
|
-
for (const
|
|
20704
|
-
this.change(
|
|
20717
|
+
for (const item2 of items) {
|
|
20718
|
+
this.change(item2);
|
|
20705
20719
|
}
|
|
20706
20720
|
}
|
|
20707
20721
|
}
|
|
@@ -20710,8 +20724,8 @@ class LayeredIndex {
|
|
|
20710
20724
|
class SpatialIndex {
|
|
20711
20725
|
subject = new Subject;
|
|
20712
20726
|
itemsArray = [];
|
|
20713
|
-
itemsIndex = new LayeredIndex((
|
|
20714
|
-
return this.itemsArray.indexOf(
|
|
20727
|
+
itemsIndex = new LayeredIndex((item2) => {
|
|
20728
|
+
return this.itemsArray.indexOf(item2);
|
|
20715
20729
|
});
|
|
20716
20730
|
Mbr = new Mbr;
|
|
20717
20731
|
items;
|
|
@@ -20720,79 +20734,79 @@ class SpatialIndex {
|
|
|
20720
20734
|
}
|
|
20721
20735
|
clear() {
|
|
20722
20736
|
this.itemsArray = [];
|
|
20723
|
-
this.itemsIndex = new LayeredIndex((
|
|
20724
|
-
return this.itemsArray.indexOf(
|
|
20737
|
+
this.itemsIndex = new LayeredIndex((item2) => {
|
|
20738
|
+
return this.itemsArray.indexOf(item2);
|
|
20725
20739
|
});
|
|
20726
20740
|
this.Mbr = new Mbr;
|
|
20727
20741
|
}
|
|
20728
|
-
insert(
|
|
20729
|
-
this.itemsArray.push(
|
|
20730
|
-
this.itemsIndex.insert(
|
|
20742
|
+
insert(item2) {
|
|
20743
|
+
this.itemsArray.push(item2);
|
|
20744
|
+
this.itemsIndex.insert(item2);
|
|
20731
20745
|
if (conf.isNode()) {
|
|
20732
20746
|
return;
|
|
20733
20747
|
}
|
|
20734
20748
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20735
|
-
this.Mbr =
|
|
20749
|
+
this.Mbr = item2.getMbr().copy();
|
|
20736
20750
|
} else {
|
|
20737
|
-
this.Mbr.combine([
|
|
20751
|
+
this.Mbr.combine([item2.getMbr()]);
|
|
20738
20752
|
}
|
|
20739
|
-
|
|
20753
|
+
item2.subject.subscribe(this.change);
|
|
20740
20754
|
this.subject.publish(this.items);
|
|
20741
20755
|
}
|
|
20742
|
-
change = (
|
|
20743
|
-
this.itemsIndex.change(
|
|
20756
|
+
change = (item2) => {
|
|
20757
|
+
this.itemsIndex.change(item2);
|
|
20744
20758
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
20745
|
-
this.Mbr =
|
|
20759
|
+
this.Mbr = item2.getMbrWithChildren().copy();
|
|
20746
20760
|
} else {
|
|
20747
|
-
this.Mbr.combine([
|
|
20761
|
+
this.Mbr.combine([item2.getMbrWithChildren()]);
|
|
20748
20762
|
}
|
|
20749
20763
|
this.subject.publish(this.items);
|
|
20750
20764
|
};
|
|
20751
|
-
remove(
|
|
20752
|
-
if ("index" in
|
|
20753
|
-
|
|
20765
|
+
remove(item2) {
|
|
20766
|
+
if ("index" in item2 && item2.index) {
|
|
20767
|
+
item2.removeChildItems(item2.index.list());
|
|
20754
20768
|
}
|
|
20755
|
-
this.itemsArray.splice(this.itemsArray.indexOf(
|
|
20756
|
-
this.itemsIndex.remove(
|
|
20769
|
+
this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
|
|
20770
|
+
this.itemsIndex.remove(item2);
|
|
20757
20771
|
this.Mbr = new Mbr;
|
|
20758
|
-
this.itemsArray.forEach((
|
|
20772
|
+
this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbrWithChildren()]));
|
|
20759
20773
|
this.subject.publish(this.items);
|
|
20760
20774
|
}
|
|
20761
20775
|
copy() {
|
|
20762
|
-
return this.getItemsWithIncludedChildren(this.itemsArray).map((
|
|
20763
|
-
...
|
|
20764
|
-
id:
|
|
20776
|
+
return this.getItemsWithIncludedChildren(this.itemsArray).map((item2) => ({
|
|
20777
|
+
...item2.serialize(true),
|
|
20778
|
+
id: item2.getId()
|
|
20765
20779
|
}));
|
|
20766
20780
|
}
|
|
20767
20781
|
getItemsWithIncludedChildren(items) {
|
|
20768
|
-
return items.flatMap((
|
|
20769
|
-
if ("index" in
|
|
20770
|
-
return [
|
|
20782
|
+
return items.flatMap((item2) => {
|
|
20783
|
+
if ("index" in item2 && item2.index) {
|
|
20784
|
+
return [item2, ...item2.index.list()];
|
|
20771
20785
|
}
|
|
20772
|
-
return
|
|
20786
|
+
return item2;
|
|
20773
20787
|
});
|
|
20774
20788
|
}
|
|
20775
|
-
getItemChildren(
|
|
20776
|
-
if ("index" in
|
|
20777
|
-
return
|
|
20789
|
+
getItemChildren(item2) {
|
|
20790
|
+
if ("index" in item2 && item2.index) {
|
|
20791
|
+
return item2.index.list();
|
|
20778
20792
|
}
|
|
20779
20793
|
return [];
|
|
20780
20794
|
}
|
|
20781
|
-
getItemParent(
|
|
20782
|
-
if (
|
|
20795
|
+
getItemParent(item2) {
|
|
20796
|
+
if (item2.parent === "Board") {
|
|
20783
20797
|
return;
|
|
20784
20798
|
}
|
|
20785
|
-
return this.getById(
|
|
20799
|
+
return this.getById(item2.parent);
|
|
20786
20800
|
}
|
|
20787
|
-
moveToZIndex(
|
|
20788
|
-
const index2 = this.itemsArray.indexOf(
|
|
20801
|
+
moveToZIndex(item2, zIndex) {
|
|
20802
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
20789
20803
|
this.itemsArray.splice(index2, 1);
|
|
20790
|
-
this.itemsArray.splice(zIndex, 0,
|
|
20791
|
-
this.change(
|
|
20804
|
+
this.itemsArray.splice(zIndex, 0, item2);
|
|
20805
|
+
this.change(item2);
|
|
20792
20806
|
this.subject.publish(this.items);
|
|
20793
20807
|
}
|
|
20794
20808
|
moveManyToZIndex(itemsRecord) {
|
|
20795
|
-
const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((
|
|
20809
|
+
const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
|
|
20796
20810
|
const zIndex = Object.values(itemsRecord);
|
|
20797
20811
|
for (let i = 0;i < zIndex.length; i++) {
|
|
20798
20812
|
const index2 = zIndex[i];
|
|
@@ -20800,39 +20814,39 @@ class SpatialIndex {
|
|
|
20800
20814
|
}
|
|
20801
20815
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20802
20816
|
}
|
|
20803
|
-
sendToBack(
|
|
20804
|
-
const index2 = this.itemsArray.indexOf(
|
|
20817
|
+
sendToBack(item2, shouldPublish = true) {
|
|
20818
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
20805
20819
|
this.itemsArray.splice(index2, 1);
|
|
20806
|
-
this.itemsArray.unshift(
|
|
20807
|
-
this.itemsIndex.change(
|
|
20820
|
+
this.itemsArray.unshift(item2);
|
|
20821
|
+
this.itemsIndex.change(item2);
|
|
20808
20822
|
if (shouldPublish) {
|
|
20809
20823
|
this.subject.publish(this.items);
|
|
20810
20824
|
}
|
|
20811
20825
|
}
|
|
20812
20826
|
sendManyToBack(items) {
|
|
20813
20827
|
const newItems = [...items];
|
|
20814
|
-
this.itemsArray.forEach((
|
|
20815
|
-
if (!items.includes(
|
|
20816
|
-
newItems.push(
|
|
20828
|
+
this.itemsArray.forEach((item2) => {
|
|
20829
|
+
if (!items.includes(item2)) {
|
|
20830
|
+
newItems.push(item2);
|
|
20817
20831
|
}
|
|
20818
20832
|
});
|
|
20819
20833
|
this.itemsArray = newItems;
|
|
20820
20834
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20821
20835
|
}
|
|
20822
|
-
bringToFront(
|
|
20823
|
-
const index2 = this.itemsArray.indexOf(
|
|
20836
|
+
bringToFront(item2, shouldPublish = true) {
|
|
20837
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
20824
20838
|
this.itemsArray.splice(index2, 1);
|
|
20825
|
-
this.itemsArray.push(
|
|
20826
|
-
this.itemsIndex.change(
|
|
20839
|
+
this.itemsArray.push(item2);
|
|
20840
|
+
this.itemsIndex.change(item2);
|
|
20827
20841
|
if (shouldPublish) {
|
|
20828
20842
|
this.subject.publish(this.items);
|
|
20829
20843
|
}
|
|
20830
20844
|
}
|
|
20831
20845
|
bringManyToFront(items) {
|
|
20832
20846
|
const newItems = [];
|
|
20833
|
-
this.itemsArray.forEach((
|
|
20834
|
-
if (!items.includes(
|
|
20835
|
-
newItems.push(
|
|
20847
|
+
this.itemsArray.forEach((item2) => {
|
|
20848
|
+
if (!items.includes(item2)) {
|
|
20849
|
+
newItems.push(item2);
|
|
20836
20850
|
}
|
|
20837
20851
|
});
|
|
20838
20852
|
newItems.push(...items);
|
|
@@ -20858,9 +20872,9 @@ class SpatialIndex {
|
|
|
20858
20872
|
this.subject.publish(this.items);
|
|
20859
20873
|
}
|
|
20860
20874
|
getById(id) {
|
|
20861
|
-
const
|
|
20862
|
-
if (
|
|
20863
|
-
return
|
|
20875
|
+
const item2 = this.getItemsWithIncludedChildren(this.itemsArray).find((item3) => item3.getId() === id);
|
|
20876
|
+
if (item2) {
|
|
20877
|
+
return item2;
|
|
20864
20878
|
}
|
|
20865
20879
|
}
|
|
20866
20880
|
findById(id) {
|
|
@@ -20870,10 +20884,10 @@ class SpatialIndex {
|
|
|
20870
20884
|
const mbr = new Mbr(left, top, right, bottom);
|
|
20871
20885
|
const items = this.itemsIndex.getEnclosed(mbr);
|
|
20872
20886
|
const children = [];
|
|
20873
|
-
const clearItems = items.filter((
|
|
20874
|
-
if ("index" in
|
|
20875
|
-
children.push(...
|
|
20876
|
-
if (!
|
|
20887
|
+
const clearItems = items.filter((item2) => {
|
|
20888
|
+
if ("index" in item2 && item2.index) {
|
|
20889
|
+
children.push(...item2.index.getEnclosed(left, top, right, bottom));
|
|
20890
|
+
if (!item2.getMbr().isEnclosedBy(mbr)) {
|
|
20877
20891
|
return false;
|
|
20878
20892
|
}
|
|
20879
20893
|
}
|
|
@@ -20885,10 +20899,10 @@ class SpatialIndex {
|
|
|
20885
20899
|
const mbr = new Mbr(left, top, right, bottom);
|
|
20886
20900
|
const items = this.itemsIndex.getEnclosedOrCrossedBy(mbr);
|
|
20887
20901
|
const children = [];
|
|
20888
|
-
const clearItems = items.filter((
|
|
20889
|
-
if ("index" in
|
|
20890
|
-
children.push(...
|
|
20891
|
-
if (!
|
|
20902
|
+
const clearItems = items.filter((item2) => {
|
|
20903
|
+
if ("index" in item2 && item2.index) {
|
|
20904
|
+
children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
|
|
20905
|
+
if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
20892
20906
|
return false;
|
|
20893
20907
|
}
|
|
20894
20908
|
}
|
|
@@ -20899,10 +20913,10 @@ class SpatialIndex {
|
|
|
20899
20913
|
getUnderPoint(point3, tolerance = 5) {
|
|
20900
20914
|
const items = this.itemsIndex.getUnderPoint(point3, tolerance);
|
|
20901
20915
|
const children = [];
|
|
20902
|
-
const clearItems = items.filter((
|
|
20903
|
-
if ("index" in
|
|
20904
|
-
children.push(...
|
|
20905
|
-
if (!
|
|
20916
|
+
const clearItems = items.filter((item2) => {
|
|
20917
|
+
if ("index" in item2 && item2.index) {
|
|
20918
|
+
children.push(...item2.index.getUnderPoint(point3, tolerance));
|
|
20919
|
+
if (!item2.getMbr().isUnderPoint(point3)) {
|
|
20906
20920
|
return false;
|
|
20907
20921
|
}
|
|
20908
20922
|
}
|
|
@@ -20914,10 +20928,10 @@ class SpatialIndex {
|
|
|
20914
20928
|
const mbr = new Mbr(left, top, right, bottom);
|
|
20915
20929
|
const items = this.itemsIndex.getRectsEnclosedOrCrossedBy(mbr);
|
|
20916
20930
|
const children = [];
|
|
20917
|
-
const clearItems = items.filter((
|
|
20918
|
-
if ("index" in
|
|
20919
|
-
children.push(...
|
|
20920
|
-
if (!
|
|
20931
|
+
const clearItems = items.filter((item2) => {
|
|
20932
|
+
if ("index" in item2 && item2.index) {
|
|
20933
|
+
children.push(...item2.index.getEnclosedOrCrossed(left, top, right, bottom));
|
|
20934
|
+
if (!item2.getMbr().isEnclosedOrCrossedBy(mbr)) {
|
|
20921
20935
|
return false;
|
|
20922
20936
|
}
|
|
20923
20937
|
}
|
|
@@ -20929,26 +20943,26 @@ class SpatialIndex {
|
|
|
20929
20943
|
return this.getRectsEnclosedOrCrossed(left, top, right, bottom);
|
|
20930
20944
|
}
|
|
20931
20945
|
getComments() {
|
|
20932
|
-
return this.itemsArray.filter((
|
|
20946
|
+
return this.itemsArray.filter((item2) => item2 instanceof Comment);
|
|
20933
20947
|
}
|
|
20934
20948
|
getMbr() {
|
|
20935
20949
|
return this.Mbr;
|
|
20936
20950
|
}
|
|
20937
20951
|
getNearestTo(point3, maxItems, filter, maxDistance) {
|
|
20938
20952
|
const allItems = this.getItemsWithIncludedChildren(this.itemsArray);
|
|
20939
|
-
const filtered = allItems.filter((
|
|
20940
|
-
const withDistance = filtered.map((
|
|
20941
|
-
item,
|
|
20942
|
-
distance: point3.getDistance(
|
|
20953
|
+
const filtered = allItems.filter((item2) => filter(item2));
|
|
20954
|
+
const withDistance = filtered.map((item2) => ({
|
|
20955
|
+
item: item2,
|
|
20956
|
+
distance: point3.getDistance(item2.getMbr().getCenter())
|
|
20943
20957
|
})).filter(({ distance }) => distance <= maxDistance);
|
|
20944
20958
|
withDistance.sort((a, b) => a.distance - b.distance);
|
|
20945
|
-
return withDistance.slice(0, maxItems).map(({ item }) =>
|
|
20959
|
+
return withDistance.slice(0, maxItems).map(({ item: item2 }) => item2);
|
|
20946
20960
|
}
|
|
20947
20961
|
list() {
|
|
20948
20962
|
return this.getItemsWithIncludedChildren(this.itemsArray).concat();
|
|
20949
20963
|
}
|
|
20950
|
-
getZIndex(
|
|
20951
|
-
const index2 = this.itemsArray.indexOf(
|
|
20964
|
+
getZIndex(item2) {
|
|
20965
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
20952
20966
|
if (index2 === -1) {
|
|
20953
20967
|
return this.getLastZIndex();
|
|
20954
20968
|
}
|
|
@@ -20978,14 +20992,14 @@ class Items {
|
|
|
20978
20992
|
this.pointer = pointer;
|
|
20979
20993
|
this.subject = subject;
|
|
20980
20994
|
}
|
|
20981
|
-
update(
|
|
20982
|
-
this.index.change(
|
|
20995
|
+
update(item2) {
|
|
20996
|
+
this.index.change(item2);
|
|
20983
20997
|
}
|
|
20984
20998
|
listAll() {
|
|
20985
20999
|
return this.index.list();
|
|
20986
21000
|
}
|
|
20987
21001
|
listGroupItems() {
|
|
20988
|
-
return this.index.list().filter((
|
|
21002
|
+
return this.index.list().filter((item2) => ("index" in item2) && item2.index);
|
|
20989
21003
|
}
|
|
20990
21004
|
getById(id) {
|
|
20991
21005
|
return this.index.getById(id);
|
|
@@ -21000,7 +21014,7 @@ class Items {
|
|
|
21000
21014
|
return this.index.getEnclosedOrCrossed(left, top, right, bottom);
|
|
21001
21015
|
}
|
|
21002
21016
|
getGroupItemsEnclosedOrCrossed(left, top, right, bottom) {
|
|
21003
|
-
return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((
|
|
21017
|
+
return this.index.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => item2 instanceof BaseItem && item2.index);
|
|
21004
21018
|
}
|
|
21005
21019
|
getUnderPoint(point3, tolerance = 5) {
|
|
21006
21020
|
return this.index.getUnderPoint(point3, tolerance);
|
|
@@ -21028,28 +21042,28 @@ class Items {
|
|
|
21028
21042
|
const unmodifiedSize = size;
|
|
21029
21043
|
size = 16;
|
|
21030
21044
|
const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
|
|
21031
|
-
const groups = tolerated.filter((
|
|
21045
|
+
const groups = tolerated.filter((item2) => item2.itemType === "Group");
|
|
21032
21046
|
if (groups.length > 0) {
|
|
21033
21047
|
return groups;
|
|
21034
21048
|
}
|
|
21035
|
-
let enclosed = tolerated.some((
|
|
21049
|
+
let enclosed = tolerated.some((item2) => item2 instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
|
|
21036
21050
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
21037
21051
|
if (enclosed.length === 0) {
|
|
21038
21052
|
enclosed = underPointer;
|
|
21039
21053
|
}
|
|
21040
|
-
if (underPointer.some((
|
|
21054
|
+
if (underPointer.some((item2) => item2.itemType === "Drawing")) {
|
|
21041
21055
|
enclosed = [...underPointer, ...enclosed];
|
|
21042
21056
|
}
|
|
21043
|
-
const { nearest } = enclosed.reduce((acc,
|
|
21044
|
-
const area =
|
|
21045
|
-
if (
|
|
21057
|
+
const { nearest } = enclosed.reduce((acc, item2) => {
|
|
21058
|
+
const area = item2.getMbr().getHeight() * item2.getMbr().getWidth();
|
|
21059
|
+
if (item2.itemType === "Drawing" && !item2.isPointNearLine(this.pointer.point)) {
|
|
21046
21060
|
return acc;
|
|
21047
21061
|
}
|
|
21048
|
-
const isItemTransparent =
|
|
21049
|
-
const itemZIndex = this.getZIndex(
|
|
21062
|
+
const isItemTransparent = item2 instanceof Shape && item2?.getBackgroundColor() === "none";
|
|
21063
|
+
const itemZIndex = this.getZIndex(item2);
|
|
21050
21064
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
21051
21065
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
21052
|
-
return { nearest:
|
|
21066
|
+
return { nearest: item2, area };
|
|
21053
21067
|
}
|
|
21054
21068
|
return acc;
|
|
21055
21069
|
}, { nearest: undefined, area: Infinity });
|
|
@@ -21061,8 +21075,8 @@ class Items {
|
|
|
21061
21075
|
getNearPointer(maxDistance = 100, maxItems = 10, filter = () => true) {
|
|
21062
21076
|
return this.index.getNearestTo(this.pointer.point, maxItems, filter, maxDistance);
|
|
21063
21077
|
}
|
|
21064
|
-
getZIndex(
|
|
21065
|
-
return this.index.getZIndex(
|
|
21078
|
+
getZIndex(item2) {
|
|
21079
|
+
return this.index.getZIndex(item2);
|
|
21066
21080
|
}
|
|
21067
21081
|
getByZIndex(index2) {
|
|
21068
21082
|
return this.index.getByZIndex(index2);
|
|
@@ -21071,11 +21085,11 @@ class Items {
|
|
|
21071
21085
|
return this.index.getLastZIndex();
|
|
21072
21086
|
}
|
|
21073
21087
|
getLinkedConnectorsById(id) {
|
|
21074
|
-
return this.listAll().filter((
|
|
21075
|
-
if (!(
|
|
21088
|
+
return this.listAll().filter((item2) => {
|
|
21089
|
+
if (!(item2 instanceof Connector2)) {
|
|
21076
21090
|
return false;
|
|
21077
21091
|
}
|
|
21078
|
-
const { startItem, endItem } =
|
|
21092
|
+
const { startItem, endItem } = item2.getConnectedItems();
|
|
21079
21093
|
if (startItem?.getId() === id || endItem?.getId() === id) {
|
|
21080
21094
|
return true;
|
|
21081
21095
|
}
|
|
@@ -21086,11 +21100,11 @@ class Items {
|
|
|
21086
21100
|
if (!startPointerItemId && !endPointerItemId) {
|
|
21087
21101
|
return [];
|
|
21088
21102
|
}
|
|
21089
|
-
return this.listAll().filter((
|
|
21090
|
-
if (!(
|
|
21103
|
+
return this.listAll().filter((item2) => {
|
|
21104
|
+
if (!(item2 instanceof Connector2) || !item2.isConnected()) {
|
|
21091
21105
|
return false;
|
|
21092
21106
|
}
|
|
21093
|
-
const { startItem, endItem } =
|
|
21107
|
+
const { startItem, endItem } = item2.getConnectedItems();
|
|
21094
21108
|
if (startPointerItemId && endPointerItemId) {
|
|
21095
21109
|
if (startPointerItemId && startItem && startItem.getId() === startPointerItemId && endPointerItemId && endItem && endItem.getId() === endPointerItemId) {
|
|
21096
21110
|
return true;
|
|
@@ -21108,9 +21122,9 @@ class Items {
|
|
|
21108
21122
|
}
|
|
21109
21123
|
render(context) {
|
|
21110
21124
|
const items = this.getItemsInView();
|
|
21111
|
-
items.forEach((
|
|
21112
|
-
if (
|
|
21113
|
-
|
|
21125
|
+
items.forEach((item2) => {
|
|
21126
|
+
if (item2.parent === "Board") {
|
|
21127
|
+
item2.render(context);
|
|
21114
21128
|
}
|
|
21115
21129
|
});
|
|
21116
21130
|
}
|
|
@@ -21123,17 +21137,17 @@ class Items {
|
|
|
21123
21137
|
return this.getHTML(documentFactory, items);
|
|
21124
21138
|
}
|
|
21125
21139
|
getHTML(documentFactory, items) {
|
|
21126
|
-
const lowestCoordinates = items.map((
|
|
21140
|
+
const lowestCoordinates = items.map((item2) => item2.getMbr()).reduce((acc, mbr) => ({
|
|
21127
21141
|
left: Math.min(acc.left, mbr.left),
|
|
21128
21142
|
top: Math.min(acc.top, mbr.top)
|
|
21129
21143
|
}), { left: 0, top: 0 });
|
|
21130
21144
|
const groups = [];
|
|
21131
21145
|
const rest = [];
|
|
21132
|
-
items.forEach((
|
|
21133
|
-
if ("index" in
|
|
21134
|
-
groups.push(
|
|
21146
|
+
items.forEach((item2) => {
|
|
21147
|
+
if ("index" in item2 && item2.index) {
|
|
21148
|
+
groups.push(item2);
|
|
21135
21149
|
} else {
|
|
21136
|
-
rest.push(
|
|
21150
|
+
rest.push(item2);
|
|
21137
21151
|
}
|
|
21138
21152
|
});
|
|
21139
21153
|
const childrenMap = new Map;
|
|
@@ -21143,34 +21157,34 @@ class Items {
|
|
|
21143
21157
|
translateElementBy(html, -lowestCoordinates.left, -lowestCoordinates.top);
|
|
21144
21158
|
return html;
|
|
21145
21159
|
});
|
|
21146
|
-
const restHTML = rest.map((
|
|
21147
|
-
if (
|
|
21148
|
-
const startX = parseFloat(
|
|
21149
|
-
const startY = parseFloat(
|
|
21150
|
-
const endX = parseFloat(
|
|
21151
|
-
const endY = parseFloat(
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
}
|
|
21157
|
-
return translateElementBy(
|
|
21158
|
-
});
|
|
21159
|
-
for (const
|
|
21160
|
-
const parentFrameId = childrenMap.get(
|
|
21160
|
+
const restHTML = rest.map((item2) => ("renderHTML" in item2) && item2.renderHTML(documentFactory)).filter((item2) => !!item2).map((item2) => {
|
|
21161
|
+
if (item2.tagName.toLowerCase() === "connector-item") {
|
|
21162
|
+
const startX = parseFloat(item2.getAttribute("data-start-point-x") || "0");
|
|
21163
|
+
const startY = parseFloat(item2.getAttribute("data-start-point-y") || "0");
|
|
21164
|
+
const endX = parseFloat(item2.getAttribute("data-end-point-x") || "0");
|
|
21165
|
+
const endY = parseFloat(item2.getAttribute("data-end-point-y") || "0");
|
|
21166
|
+
item2.setAttribute("data-start-point-x", (startX - lowestCoordinates.left).toString());
|
|
21167
|
+
item2.setAttribute("data-start-point-y", (startY - lowestCoordinates.top).toString());
|
|
21168
|
+
item2.setAttribute("data-end-point-x", (endX - lowestCoordinates.left).toString());
|
|
21169
|
+
item2.setAttribute("data-end-point-y", (endY - lowestCoordinates.top).toString());
|
|
21170
|
+
}
|
|
21171
|
+
return translateElementBy(item2, -lowestCoordinates.left, -lowestCoordinates.top);
|
|
21172
|
+
});
|
|
21173
|
+
for (const item2 of restHTML) {
|
|
21174
|
+
const parentFrameId = childrenMap.get(item2.id);
|
|
21161
21175
|
const group = GroupsHTML.find((el) => parentFrameId !== undefined && el.id === parentFrameId);
|
|
21162
21176
|
if (group) {
|
|
21163
|
-
positionRelatively(
|
|
21164
|
-
group.appendChild(
|
|
21177
|
+
positionRelatively(item2, group);
|
|
21178
|
+
group.appendChild(item2);
|
|
21165
21179
|
}
|
|
21166
21180
|
}
|
|
21167
21181
|
let result = "";
|
|
21168
21182
|
for (const group of GroupsHTML) {
|
|
21169
21183
|
result += group.outerHTML;
|
|
21170
21184
|
}
|
|
21171
|
-
for (const
|
|
21172
|
-
if (!childrenMap.get(
|
|
21173
|
-
result +=
|
|
21185
|
+
for (const item2 of restHTML) {
|
|
21186
|
+
if (!childrenMap.get(item2.id)) {
|
|
21187
|
+
result += item2.outerHTML;
|
|
21174
21188
|
}
|
|
21175
21189
|
}
|
|
21176
21190
|
return result;
|
|
@@ -21190,52 +21204,52 @@ class SimpleSpatialIndex {
|
|
|
21190
21204
|
this.itemsArray = [];
|
|
21191
21205
|
this.Mbr = new Mbr;
|
|
21192
21206
|
}
|
|
21193
|
-
insert(
|
|
21194
|
-
this.itemsArray.push(
|
|
21207
|
+
insert(item2) {
|
|
21208
|
+
this.itemsArray.push(item2);
|
|
21195
21209
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
21196
|
-
this.Mbr =
|
|
21210
|
+
this.Mbr = item2.getMbr().copy();
|
|
21197
21211
|
} else {
|
|
21198
|
-
this.Mbr.combine([
|
|
21212
|
+
this.Mbr.combine([item2.getMbr()]);
|
|
21199
21213
|
}
|
|
21200
|
-
|
|
21214
|
+
item2.subject.subscribe(this.change);
|
|
21201
21215
|
this.subject.publish(this.items);
|
|
21202
21216
|
}
|
|
21203
|
-
change = (
|
|
21217
|
+
change = (item2) => {
|
|
21204
21218
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
21205
|
-
this.Mbr =
|
|
21219
|
+
this.Mbr = item2.getMbr().copy();
|
|
21206
21220
|
} else {
|
|
21207
|
-
this.Mbr.combine([
|
|
21221
|
+
this.Mbr.combine([item2.getMbr()]);
|
|
21208
21222
|
}
|
|
21209
21223
|
this.subject.publish(this.items);
|
|
21210
21224
|
};
|
|
21211
|
-
remove(
|
|
21212
|
-
if ("index" in
|
|
21213
|
-
|
|
21225
|
+
remove(item2) {
|
|
21226
|
+
if ("index" in item2 && item2.index) {
|
|
21227
|
+
item2.removeChildItems(item2.index.list());
|
|
21214
21228
|
}
|
|
21215
|
-
if (
|
|
21216
|
-
const parentFrame = this.items.getById(
|
|
21217
|
-
parentFrame?.removeChildItems(
|
|
21229
|
+
if (item2.parent !== "Board") {
|
|
21230
|
+
const parentFrame = this.items.getById(item2.parent);
|
|
21231
|
+
parentFrame?.removeChildItems(item2);
|
|
21218
21232
|
}
|
|
21219
|
-
this.itemsArray.splice(this.itemsArray.indexOf(
|
|
21233
|
+
this.itemsArray.splice(this.itemsArray.indexOf(item2), 1);
|
|
21220
21234
|
this.Mbr = new Mbr;
|
|
21221
|
-
this.itemsArray.forEach((
|
|
21235
|
+
this.itemsArray.forEach((item3) => this.Mbr.combine([item3.getMbr()]));
|
|
21222
21236
|
this.subject.publish(this.items);
|
|
21223
21237
|
}
|
|
21224
21238
|
copy() {
|
|
21225
|
-
return this.itemsArray.map((
|
|
21226
|
-
...
|
|
21227
|
-
id:
|
|
21239
|
+
return this.itemsArray.map((item2) => ({
|
|
21240
|
+
...item2.serialize(true),
|
|
21241
|
+
id: item2.getId()
|
|
21228
21242
|
}));
|
|
21229
21243
|
}
|
|
21230
|
-
moveToZIndex(
|
|
21231
|
-
const index2 = this.itemsArray.indexOf(
|
|
21244
|
+
moveToZIndex(item2, zIndex) {
|
|
21245
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
21232
21246
|
this.itemsArray.splice(index2, 1);
|
|
21233
|
-
this.itemsArray.splice(zIndex, 0,
|
|
21234
|
-
this.change(
|
|
21247
|
+
this.itemsArray.splice(zIndex, 0, item2);
|
|
21248
|
+
this.change(item2);
|
|
21235
21249
|
this.subject.publish(this.items);
|
|
21236
21250
|
}
|
|
21237
21251
|
moveManyToZIndex(itemsRecord) {
|
|
21238
|
-
const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((
|
|
21252
|
+
const items = Object.keys(itemsRecord).map((id) => this.items.getById(id)).filter((item2) => item2 !== undefined);
|
|
21239
21253
|
const zIndex = Object.values(itemsRecord);
|
|
21240
21254
|
for (let i = 0;i < zIndex.length; i++) {
|
|
21241
21255
|
const index2 = zIndex[i];
|
|
@@ -21243,37 +21257,37 @@ class SimpleSpatialIndex {
|
|
|
21243
21257
|
}
|
|
21244
21258
|
this.itemsArray.forEach(this.change.bind(this));
|
|
21245
21259
|
}
|
|
21246
|
-
sendToBack(
|
|
21247
|
-
const index2 = this.itemsArray.indexOf(
|
|
21260
|
+
sendToBack(item2, shouldPublish = true) {
|
|
21261
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
21248
21262
|
this.itemsArray.splice(index2, 1);
|
|
21249
|
-
this.itemsArray.unshift(
|
|
21263
|
+
this.itemsArray.unshift(item2);
|
|
21250
21264
|
if (shouldPublish) {
|
|
21251
21265
|
this.subject.publish(this.items);
|
|
21252
21266
|
}
|
|
21253
21267
|
}
|
|
21254
21268
|
sendManyToBack(items) {
|
|
21255
21269
|
const newItems = [...items];
|
|
21256
|
-
this.itemsArray.forEach((
|
|
21257
|
-
if (!items.includes(
|
|
21258
|
-
newItems.push(
|
|
21270
|
+
this.itemsArray.forEach((item2) => {
|
|
21271
|
+
if (!items.includes(item2)) {
|
|
21272
|
+
newItems.push(item2);
|
|
21259
21273
|
}
|
|
21260
21274
|
});
|
|
21261
21275
|
this.itemsArray = newItems;
|
|
21262
21276
|
this.itemsArray.forEach(this.change.bind(this));
|
|
21263
21277
|
}
|
|
21264
|
-
bringToFront(
|
|
21265
|
-
const index2 = this.itemsArray.indexOf(
|
|
21278
|
+
bringToFront(item2, shouldPublish = true) {
|
|
21279
|
+
const index2 = this.itemsArray.indexOf(item2);
|
|
21266
21280
|
this.itemsArray.splice(index2, 1);
|
|
21267
|
-
this.itemsArray.push(
|
|
21281
|
+
this.itemsArray.push(item2);
|
|
21268
21282
|
if (shouldPublish) {
|
|
21269
21283
|
this.subject.publish(this.items);
|
|
21270
21284
|
}
|
|
21271
21285
|
}
|
|
21272
21286
|
bringManyToFront(items) {
|
|
21273
21287
|
const newItems = [];
|
|
21274
|
-
this.itemsArray.forEach((
|
|
21275
|
-
if (!items.includes(
|
|
21276
|
-
newItems.push(
|
|
21288
|
+
this.itemsArray.forEach((item2) => {
|
|
21289
|
+
if (!items.includes(item2)) {
|
|
21290
|
+
newItems.push(item2);
|
|
21277
21291
|
}
|
|
21278
21292
|
});
|
|
21279
21293
|
newItems.push(...items);
|
|
@@ -21299,9 +21313,9 @@ class SimpleSpatialIndex {
|
|
|
21299
21313
|
this.subject.publish(this.items);
|
|
21300
21314
|
}
|
|
21301
21315
|
getById(id) {
|
|
21302
|
-
const
|
|
21303
|
-
if (
|
|
21304
|
-
return
|
|
21316
|
+
const item2 = this.itemsArray.find((item3) => item3.getId() === id);
|
|
21317
|
+
if (item2) {
|
|
21318
|
+
return item2;
|
|
21305
21319
|
}
|
|
21306
21320
|
}
|
|
21307
21321
|
findById(id) {
|
|
@@ -21310,9 +21324,9 @@ class SimpleSpatialIndex {
|
|
|
21310
21324
|
getEnclosed(left, top, right, bottom) {
|
|
21311
21325
|
const mbr = new Mbr(left, top, right, bottom);
|
|
21312
21326
|
const items = [];
|
|
21313
|
-
this.itemsArray.forEach((
|
|
21314
|
-
if (
|
|
21315
|
-
items.push(
|
|
21327
|
+
this.itemsArray.forEach((item2) => {
|
|
21328
|
+
if (item2.isEnclosedBy(mbr)) {
|
|
21329
|
+
items.push(item2);
|
|
21316
21330
|
}
|
|
21317
21331
|
});
|
|
21318
21332
|
return items;
|
|
@@ -21320,18 +21334,18 @@ class SimpleSpatialIndex {
|
|
|
21320
21334
|
getEnclosedOrCrossed(left, top, right, bottom) {
|
|
21321
21335
|
const mbr = new Mbr(left, top, right, bottom);
|
|
21322
21336
|
const items = [];
|
|
21323
|
-
this.itemsArray.forEach((
|
|
21324
|
-
if (
|
|
21325
|
-
items.push(
|
|
21337
|
+
this.itemsArray.forEach((item2) => {
|
|
21338
|
+
if (item2.isEnclosedOrCrossedBy(mbr)) {
|
|
21339
|
+
items.push(item2);
|
|
21326
21340
|
}
|
|
21327
21341
|
});
|
|
21328
21342
|
return items;
|
|
21329
21343
|
}
|
|
21330
21344
|
getUnderPoint(point3, tolerace = 5) {
|
|
21331
21345
|
const items = [];
|
|
21332
|
-
this.itemsArray.forEach((
|
|
21333
|
-
if (
|
|
21334
|
-
items.push(
|
|
21346
|
+
this.itemsArray.forEach((item2) => {
|
|
21347
|
+
if (item2.isUnderPoint(point3, tolerace)) {
|
|
21348
|
+
items.push(item2);
|
|
21335
21349
|
}
|
|
21336
21350
|
});
|
|
21337
21351
|
return items;
|
|
@@ -21342,8 +21356,8 @@ class SimpleSpatialIndex {
|
|
|
21342
21356
|
list() {
|
|
21343
21357
|
return this.itemsArray.concat();
|
|
21344
21358
|
}
|
|
21345
|
-
getZIndex(
|
|
21346
|
-
return this.itemsArray.indexOf(
|
|
21359
|
+
getZIndex(item2) {
|
|
21360
|
+
return this.itemsArray.indexOf(item2);
|
|
21347
21361
|
}
|
|
21348
21362
|
getLastZIndex() {
|
|
21349
21363
|
return this.itemsArray.length - 1;
|
|
@@ -21357,8 +21371,8 @@ class SimpleSpatialIndex {
|
|
|
21357
21371
|
}
|
|
21358
21372
|
}
|
|
21359
21373
|
render(context) {
|
|
21360
|
-
this.itemsArray.forEach((
|
|
21361
|
-
|
|
21374
|
+
this.itemsArray.forEach((item2) => {
|
|
21375
|
+
item2.render(context);
|
|
21362
21376
|
});
|
|
21363
21377
|
}
|
|
21364
21378
|
}
|
|
@@ -21409,7 +21423,7 @@ class BaseItem extends Mbr {
|
|
|
21409
21423
|
if (!this.index) {
|
|
21410
21424
|
return null;
|
|
21411
21425
|
}
|
|
21412
|
-
return this.index.items.listAll().map((
|
|
21426
|
+
return this.index.items.listAll().map((item2) => item2.getId());
|
|
21413
21427
|
}
|
|
21414
21428
|
addChildItems(children) {
|
|
21415
21429
|
if (!this.index) {
|
|
@@ -21447,17 +21461,17 @@ class BaseItem extends Mbr {
|
|
|
21447
21461
|
this.addChildItems(itemsToAdd);
|
|
21448
21462
|
this.removeChildItems(itemsToRemove);
|
|
21449
21463
|
}
|
|
21450
|
-
handleNesting(
|
|
21451
|
-
const isItem = "itemType" in
|
|
21452
|
-
const itemMbr = isItem ?
|
|
21453
|
-
if (
|
|
21464
|
+
handleNesting(item2, options) {
|
|
21465
|
+
const isItem = "itemType" in item2;
|
|
21466
|
+
const itemMbr = isItem ? item2.getMbr() : item2;
|
|
21467
|
+
if (item2 instanceof BaseItem && !item2.canBeNested) {
|
|
21454
21468
|
return false;
|
|
21455
21469
|
}
|
|
21456
|
-
if (options?.cancelIfChild && isItem &&
|
|
21470
|
+
if (options?.cancelIfChild && isItem && item2.parent !== "Board") {
|
|
21457
21471
|
return false;
|
|
21458
21472
|
}
|
|
21459
21473
|
const mbr = this.getMbr().copy();
|
|
21460
|
-
if (
|
|
21474
|
+
if (item2.isEnclosedOrCrossedBy(mbr)) {
|
|
21461
21475
|
if (mbr.isInside(itemMbr.getCenter())) {
|
|
21462
21476
|
if (!options || !options.onlyForOut) {
|
|
21463
21477
|
return true;
|
|
@@ -23754,8 +23768,8 @@ function isChild(value) {
|
|
|
23754
23768
|
if (!Array.isArray(value2))
|
|
23755
23769
|
return true;
|
|
23756
23770
|
const list2 = value2;
|
|
23757
|
-
for (const
|
|
23758
|
-
if (typeof
|
|
23771
|
+
for (const item2 of list2) {
|
|
23772
|
+
if (typeof item2 !== "number" && typeof item2 !== "string") {
|
|
23759
23773
|
return true;
|
|
23760
23774
|
}
|
|
23761
23775
|
}
|
|
@@ -23794,8 +23808,8 @@ function addProperty(schema, properties, key, value) {
|
|
|
23794
23808
|
}
|
|
23795
23809
|
if (Array.isArray(result)) {
|
|
23796
23810
|
const finalResult = [];
|
|
23797
|
-
for (const
|
|
23798
|
-
finalResult.push(parsePrimitive(info, info.property,
|
|
23811
|
+
for (const item2 of result) {
|
|
23812
|
+
finalResult.push(parsePrimitive(info, info.property, item2));
|
|
23799
23813
|
}
|
|
23800
23814
|
result = finalResult;
|
|
23801
23815
|
}
|
|
@@ -34862,8 +34876,8 @@ function list5(node2, parent, state, info) {
|
|
|
34862
34876
|
if (checkRule(state) === bullet && firstListItem) {
|
|
34863
34877
|
let index2 = -1;
|
|
34864
34878
|
while (++index2 < node2.children.length) {
|
|
34865
|
-
const
|
|
34866
|
-
if (
|
|
34879
|
+
const item2 = node2.children[index2];
|
|
34880
|
+
if (item2 && item2.type === "listItem" && item2.children && item2.children[0] && item2.children[0].type === "thematicBreak") {
|
|
34867
34881
|
useDifferentMarker = true;
|
|
34868
34882
|
break;
|
|
34869
34883
|
}
|
|
@@ -35523,12 +35537,12 @@ async function convertMarkdownToSlate(text5) {
|
|
|
35523
35537
|
...nodes.filter((node2) => node2.type !== "list_item")
|
|
35524
35538
|
];
|
|
35525
35539
|
}
|
|
35526
|
-
return nodes.map((
|
|
35540
|
+
return nodes.map((item2) => {
|
|
35527
35541
|
setNodeStyles({
|
|
35528
|
-
node:
|
|
35529
|
-
isPaddingTopNeeded:
|
|
35542
|
+
node: item2,
|
|
35543
|
+
isPaddingTopNeeded: item2.type !== "code_block"
|
|
35530
35544
|
});
|
|
35531
|
-
return
|
|
35545
|
+
return item2;
|
|
35532
35546
|
});
|
|
35533
35547
|
}
|
|
35534
35548
|
function detectListType(text5) {
|
|
@@ -35941,17 +35955,17 @@ class FloatingPoint extends Point {
|
|
|
35941
35955
|
relativePoint;
|
|
35942
35956
|
pointType = "Floating";
|
|
35943
35957
|
edge;
|
|
35944
|
-
constructor(
|
|
35958
|
+
constructor(item2, relativePoint) {
|
|
35945
35959
|
super();
|
|
35946
|
-
this.item =
|
|
35960
|
+
this.item = item2;
|
|
35947
35961
|
this.relativePoint = relativePoint;
|
|
35948
35962
|
if (relativePoint.y <= 0) {
|
|
35949
35963
|
this.edge = "top";
|
|
35950
|
-
} else if (relativePoint.y >=
|
|
35964
|
+
} else if (relativePoint.y >= item2.getMbr().getHeight()) {
|
|
35951
35965
|
this.edge = "bottom";
|
|
35952
35966
|
} else if (relativePoint.x <= 0) {
|
|
35953
35967
|
this.edge = "left";
|
|
35954
|
-
} else if (relativePoint.x >=
|
|
35968
|
+
} else if (relativePoint.x >= item2.getMbr().getWidth()) {
|
|
35955
35969
|
this.edge = "right";
|
|
35956
35970
|
}
|
|
35957
35971
|
this.recalculatePoint();
|
|
@@ -35982,17 +35996,17 @@ class FixedPoint extends Point {
|
|
|
35982
35996
|
relativePoint;
|
|
35983
35997
|
pointType = "Fixed";
|
|
35984
35998
|
edge;
|
|
35985
|
-
constructor(
|
|
35999
|
+
constructor(item2, relativePoint) {
|
|
35986
36000
|
super();
|
|
35987
|
-
this.item =
|
|
36001
|
+
this.item = item2;
|
|
35988
36002
|
this.relativePoint = relativePoint;
|
|
35989
36003
|
if (relativePoint.y <= 0) {
|
|
35990
36004
|
this.edge = "top";
|
|
35991
|
-
} else if (relativePoint.y >=
|
|
36005
|
+
} else if (relativePoint.y >= item2.getMbr().getHeight()) {
|
|
35992
36006
|
this.edge = "bottom";
|
|
35993
36007
|
} else if (relativePoint.x <= 0) {
|
|
35994
36008
|
this.edge = "left";
|
|
35995
|
-
} else if (relativePoint.x >=
|
|
36009
|
+
} else if (relativePoint.x >= item2.getMbr().getWidth()) {
|
|
35996
36010
|
this.edge = "right";
|
|
35997
36011
|
}
|
|
35998
36012
|
this.recalculatePoint();
|
|
@@ -36023,16 +36037,16 @@ class FixedConnectorPoint extends Point {
|
|
|
36023
36037
|
tangent;
|
|
36024
36038
|
segmentIndex;
|
|
36025
36039
|
pointType = "FixedConnector";
|
|
36026
|
-
constructor(
|
|
36040
|
+
constructor(item2, tangent, segmentIndex) {
|
|
36027
36041
|
super();
|
|
36028
|
-
this.item =
|
|
36042
|
+
this.item = item2;
|
|
36029
36043
|
this.tangent = tangent;
|
|
36030
36044
|
this.segmentIndex = segmentIndex;
|
|
36031
36045
|
this.recalculatePoint();
|
|
36032
36046
|
}
|
|
36033
36047
|
recalculatePoint() {
|
|
36034
|
-
const
|
|
36035
|
-
const segments =
|
|
36048
|
+
const item2 = this.item;
|
|
36049
|
+
const segments = item2.getPaths().getSegments();
|
|
36036
36050
|
const segment = segments.length > this.segmentIndex ? segments[this.segmentIndex] : segments[segments.length - 1];
|
|
36037
36051
|
const point5 = segment.getPoint(this.tangent);
|
|
36038
36052
|
this.x = point5.x;
|
|
@@ -36057,38 +36071,38 @@ function getControlPoint(data, findItem2) {
|
|
|
36057
36071
|
if (data.pointType === "Board") {
|
|
36058
36072
|
return new BoardPoint(Math.round(data.x), Math.round(data.y));
|
|
36059
36073
|
} else {
|
|
36060
|
-
const
|
|
36061
|
-
if (!
|
|
36074
|
+
const item2 = findItem2(data.itemId);
|
|
36075
|
+
if (!item2) {
|
|
36062
36076
|
console.warn(`getControlPoint(): item not found for ${data.itemId}`);
|
|
36063
36077
|
return new BoardPoint(0, 0);
|
|
36064
36078
|
}
|
|
36065
36079
|
switch (data.pointType) {
|
|
36066
36080
|
case "FixedConnector":
|
|
36067
|
-
if (
|
|
36068
|
-
return new FixedConnectorPoint(
|
|
36081
|
+
if (item2 instanceof Connector2) {
|
|
36082
|
+
return new FixedConnectorPoint(item2, data.tangent, data.segment);
|
|
36069
36083
|
} else {
|
|
36070
36084
|
throw new Error(`getControlPoint(): item must be a connector`);
|
|
36071
36085
|
}
|
|
36072
36086
|
case "Floating":
|
|
36073
|
-
return new FloatingPoint(
|
|
36087
|
+
return new FloatingPoint(item2, new Point(data.relativeX, data.relativeY));
|
|
36074
36088
|
case "Fixed":
|
|
36075
|
-
return new FixedPoint(
|
|
36089
|
+
return new FixedPoint(item2, new Point(data.relativeX, data.relativeY));
|
|
36076
36090
|
}
|
|
36077
36091
|
}
|
|
36078
36092
|
}
|
|
36079
|
-
function toRelativePoint(point5,
|
|
36080
|
-
const matrix =
|
|
36093
|
+
function toRelativePoint(point5, item2) {
|
|
36094
|
+
const matrix = item2.transformation?.matrix || new Matrix2;
|
|
36081
36095
|
const inverse = matrix.getInverse();
|
|
36082
36096
|
point5 = point5.copy();
|
|
36083
36097
|
point5.transform(inverse);
|
|
36084
36098
|
return point5;
|
|
36085
36099
|
}
|
|
36086
|
-
function fromRelativePoint(relativePoint,
|
|
36087
|
-
const matrix =
|
|
36100
|
+
function fromRelativePoint(relativePoint, item2, edge) {
|
|
36101
|
+
const matrix = item2.transformation?.matrix.copy() || new Matrix2;
|
|
36088
36102
|
const point5 = relativePoint.copy();
|
|
36089
36103
|
point5.transform(matrix);
|
|
36090
|
-
if (
|
|
36091
|
-
const itemMbr =
|
|
36104
|
+
if (item2 instanceof RichText || item2 instanceof AINode) {
|
|
36105
|
+
const itemMbr = item2.getMbr();
|
|
36092
36106
|
const { x: centerX, y: centerY } = itemMbr.getCenter();
|
|
36093
36107
|
switch (edge) {
|
|
36094
36108
|
case "left":
|
|
@@ -36100,7 +36114,7 @@ function fromRelativePoint(relativePoint, item, edge) {
|
|
|
36100
36114
|
case "bottom":
|
|
36101
36115
|
return new Point(centerX, itemMbr.bottom);
|
|
36102
36116
|
default:
|
|
36103
|
-
return
|
|
36117
|
+
return item2.getMbr().getClosestEdgeCenterPoint(point5);
|
|
36104
36118
|
}
|
|
36105
36119
|
}
|
|
36106
36120
|
return point5;
|
|
@@ -37449,7 +37463,7 @@ class Connector2 extends BaseItem {
|
|
|
37449
37463
|
return this;
|
|
37450
37464
|
}
|
|
37451
37465
|
getConnectorById(items, connectorId) {
|
|
37452
|
-
return items.find((
|
|
37466
|
+
return items.find((item2) => item2 instanceof Connector2 && item2.getId() === connectorId);
|
|
37453
37467
|
}
|
|
37454
37468
|
updateTitle() {
|
|
37455
37469
|
const selection = this.board.selection;
|
|
@@ -40086,8 +40100,8 @@ async function exportBoardSnapshot({
|
|
|
40086
40100
|
context.matrix.applyToContext(context.ctx);
|
|
40087
40101
|
const { left, top, right, bottom } = selection;
|
|
40088
40102
|
const inView = board.items.index.getRectsEnclosedOrCrossed(left, top, right, bottom);
|
|
40089
|
-
for (const
|
|
40090
|
-
|
|
40103
|
+
for (const item2 of inView) {
|
|
40104
|
+
item2.render(context);
|
|
40091
40105
|
}
|
|
40092
40106
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
40093
40107
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -40285,7 +40299,7 @@ class Frame2 extends BaseItem {
|
|
|
40285
40299
|
return this.id;
|
|
40286
40300
|
}
|
|
40287
40301
|
getChildrenIds() {
|
|
40288
|
-
return this.index?.list().map((
|
|
40302
|
+
return this.index?.list().map((item2) => item2.getId()) || [];
|
|
40289
40303
|
}
|
|
40290
40304
|
updateMbr() {
|
|
40291
40305
|
const rect = this.path.getMbr().copy();
|
|
@@ -40520,11 +40534,11 @@ class Frame2 extends BaseItem {
|
|
|
40520
40534
|
}
|
|
40521
40535
|
});
|
|
40522
40536
|
const currMbr = this.getMbr();
|
|
40523
|
-
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((
|
|
40524
|
-
if (
|
|
40525
|
-
if (this.handleNesting(
|
|
40526
|
-
this.applyAddChildren([
|
|
40527
|
-
|
|
40537
|
+
this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).forEach((item2) => {
|
|
40538
|
+
if (item2.parent === "Board") {
|
|
40539
|
+
if (this.handleNesting(item2)) {
|
|
40540
|
+
this.applyAddChildren([item2.getId()]);
|
|
40541
|
+
item2.parent = this.getId();
|
|
40528
40542
|
}
|
|
40529
40543
|
}
|
|
40530
40544
|
});
|
|
@@ -42722,9 +42736,9 @@ class Group extends BaseItem {
|
|
|
42722
42736
|
if (data.children) {
|
|
42723
42737
|
data.children.forEach((childId) => {
|
|
42724
42738
|
this.applyAddChild(childId);
|
|
42725
|
-
const
|
|
42726
|
-
if (
|
|
42727
|
-
|
|
42739
|
+
const item2 = this.board.items.getById(childId);
|
|
42740
|
+
if (item2) {
|
|
42741
|
+
item2.parent = this.getId();
|
|
42728
42742
|
}
|
|
42729
42743
|
});
|
|
42730
42744
|
}
|
|
@@ -42754,11 +42768,11 @@ class Group extends BaseItem {
|
|
|
42754
42768
|
let right = Number.MIN_SAFE_INTEGER;
|
|
42755
42769
|
let bottom = Number.MIN_SAFE_INTEGER;
|
|
42756
42770
|
const mbrs = this.children.flatMap((childId) => {
|
|
42757
|
-
const
|
|
42758
|
-
if (!
|
|
42771
|
+
const item2 = this.board.items.getById(childId);
|
|
42772
|
+
if (!item2) {
|
|
42759
42773
|
return [];
|
|
42760
42774
|
}
|
|
42761
|
-
const mbr2 =
|
|
42775
|
+
const mbr2 = item2.getMbr();
|
|
42762
42776
|
if (!mbr2) {
|
|
42763
42777
|
return [];
|
|
42764
42778
|
}
|
|
@@ -42793,7 +42807,7 @@ class Group extends BaseItem {
|
|
|
42793
42807
|
return this.children;
|
|
42794
42808
|
}
|
|
42795
42809
|
getChildren() {
|
|
42796
|
-
return this.children.map((itemId) => this.board.items.getById(itemId)).filter((
|
|
42810
|
+
return this.children.map((itemId) => this.board.items.getById(itemId)).filter((item2) => item2 !== undefined);
|
|
42797
42811
|
}
|
|
42798
42812
|
updateMbr() {
|
|
42799
42813
|
const rect = this.getMbr();
|
|
@@ -42806,9 +42820,9 @@ class Group extends BaseItem {
|
|
|
42806
42820
|
setChildren(items) {
|
|
42807
42821
|
items.forEach((itemId) => {
|
|
42808
42822
|
this.addChild(itemId);
|
|
42809
|
-
const
|
|
42810
|
-
if (
|
|
42811
|
-
|
|
42823
|
+
const item2 = this.board.items.getById(itemId);
|
|
42824
|
+
if (item2) {
|
|
42825
|
+
item2.parent = this.getId();
|
|
42812
42826
|
}
|
|
42813
42827
|
});
|
|
42814
42828
|
this.updateMbr();
|
|
@@ -42816,9 +42830,9 @@ class Group extends BaseItem {
|
|
|
42816
42830
|
removeChildren() {
|
|
42817
42831
|
this.children.forEach((itemId) => {
|
|
42818
42832
|
this.removeChild(itemId);
|
|
42819
|
-
const
|
|
42820
|
-
if (
|
|
42821
|
-
|
|
42833
|
+
const item2 = this.board.items.getById(itemId);
|
|
42834
|
+
if (item2) {
|
|
42835
|
+
item2.parent = this.parent;
|
|
42822
42836
|
}
|
|
42823
42837
|
});
|
|
42824
42838
|
this.updateMbr();
|
|
@@ -43151,16 +43165,16 @@ class Anchor extends Mbr {
|
|
|
43151
43165
|
}
|
|
43152
43166
|
}
|
|
43153
43167
|
// src/Items/Connector/ConnectorSnap.ts
|
|
43154
|
-
function getFixedPoint(
|
|
43155
|
-
if (
|
|
43156
|
-
const nearestSegmentData =
|
|
43168
|
+
function getFixedPoint(item2, point5) {
|
|
43169
|
+
if (item2 instanceof Connector2) {
|
|
43170
|
+
const nearestSegmentData = item2.getPaths().getNearestEdgeAndPointTo(point5);
|
|
43157
43171
|
const segment = nearestSegmentData.segment;
|
|
43158
43172
|
const index2 = nearestSegmentData.index;
|
|
43159
43173
|
const tangent = segment.getParameter(point5);
|
|
43160
|
-
return new FixedConnectorPoint(
|
|
43174
|
+
return new FixedConnectorPoint(item2, tangent, index2);
|
|
43161
43175
|
} else {
|
|
43162
|
-
const relativePoint = toRelativePoint(point5,
|
|
43163
|
-
return new FixedPoint(
|
|
43176
|
+
const relativePoint = toRelativePoint(point5, item2);
|
|
43177
|
+
return new FixedPoint(item2, relativePoint);
|
|
43164
43178
|
}
|
|
43165
43179
|
}
|
|
43166
43180
|
|
|
@@ -43213,20 +43227,20 @@ class ConnectorSnap {
|
|
|
43213
43227
|
}
|
|
43214
43228
|
this.setSnap();
|
|
43215
43229
|
const pointer = this.board.pointer.point;
|
|
43216
|
-
const { anchor, item, point: point5 } = this.snap;
|
|
43217
|
-
if (!
|
|
43230
|
+
const { anchor, item: item2, point: point5 } = this.snap;
|
|
43231
|
+
if (!item2) {
|
|
43218
43232
|
const pointer2 = this.board.pointer.point;
|
|
43219
43233
|
this.controlPoint = new BoardPoint(pointer2.x, pointer2.y);
|
|
43220
43234
|
} else if (anchor) {
|
|
43221
|
-
this.controlPoint = getFixedPoint(
|
|
43235
|
+
this.controlPoint = getFixedPoint(item2, anchor.getCenter());
|
|
43222
43236
|
} else if (point5) {
|
|
43223
|
-
const nearest2 =
|
|
43224
|
-
this.controlPoint = getFixedPoint(
|
|
43237
|
+
const nearest2 = item2.getNearestEdgePointTo(pointer);
|
|
43238
|
+
this.controlPoint = getFixedPoint(item2, nearest2);
|
|
43225
43239
|
} else {
|
|
43226
43240
|
if (this.hover.isTimeoutElapsed) {
|
|
43227
|
-
this.controlPoint = getFixedPoint(
|
|
43241
|
+
this.controlPoint = getFixedPoint(item2, pointer);
|
|
43228
43242
|
} else {
|
|
43229
|
-
this.controlPoint = getFixedPoint(
|
|
43243
|
+
this.controlPoint = getFixedPoint(item2, pointer);
|
|
43230
43244
|
}
|
|
43231
43245
|
}
|
|
43232
43246
|
}
|
|
@@ -43287,23 +43301,23 @@ class ConnectorSnap {
|
|
|
43287
43301
|
}
|
|
43288
43302
|
return nearest;
|
|
43289
43303
|
}
|
|
43290
|
-
getClosestPointOnItem(
|
|
43291
|
-
const nearestEdgePoint =
|
|
43292
|
-
return getFixedPoint(
|
|
43304
|
+
getClosestPointOnItem(item2, position4) {
|
|
43305
|
+
const nearestEdgePoint = item2.getNearestEdgePointTo(position4);
|
|
43306
|
+
return getFixedPoint(item2, nearestEdgePoint);
|
|
43293
43307
|
}
|
|
43294
|
-
isNearBorder(
|
|
43295
|
-
if (!
|
|
43308
|
+
isNearBorder(item2) {
|
|
43309
|
+
if (!item2) {
|
|
43296
43310
|
return false;
|
|
43297
43311
|
}
|
|
43298
43312
|
const pointer = this.board.pointer.point;
|
|
43299
|
-
const point5 =
|
|
43313
|
+
const point5 = item2.getNearestEdgePointTo(pointer);
|
|
43300
43314
|
const distance = pointer.getDistance(point5);
|
|
43301
43315
|
return distance < this.distance.border / this.board.camera.getScale();
|
|
43302
43316
|
}
|
|
43303
43317
|
setSnap() {
|
|
43304
|
-
const
|
|
43305
|
-
const path2 =
|
|
43306
|
-
if (!
|
|
43318
|
+
const item2 = this.snap.item;
|
|
43319
|
+
const path2 = item2 && "getPath" in item2 ? item2?.getPath() : null;
|
|
43320
|
+
if (!item2 || !path2) {
|
|
43307
43321
|
this.snap.path = null;
|
|
43308
43322
|
this.snap.anchors = [];
|
|
43309
43323
|
this.snap.anchor = null;
|
|
@@ -43314,11 +43328,11 @@ class ConnectorSnap {
|
|
|
43314
43328
|
if (this.snap.item === this.hover.item && !this.hover.isTimeoutElapsed) {
|
|
43315
43329
|
path2.setBackgroundColor(this.color.snapBackgroundHighlight);
|
|
43316
43330
|
}
|
|
43317
|
-
this.setAnchors(
|
|
43331
|
+
this.setAnchors(item2);
|
|
43318
43332
|
}
|
|
43319
43333
|
}
|
|
43320
|
-
setAnchors(
|
|
43321
|
-
const points =
|
|
43334
|
+
setAnchors(item2) {
|
|
43335
|
+
const points = item2.getSnapAnchorPoints();
|
|
43322
43336
|
if (!points) {
|
|
43323
43337
|
return;
|
|
43324
43338
|
}
|
|
@@ -43352,10 +43366,10 @@ class ConnectorSnap {
|
|
|
43352
43366
|
}
|
|
43353
43367
|
setPoint() {
|
|
43354
43368
|
const pointer = this.board.pointer.point;
|
|
43355
|
-
const { item, anchor } = this.snap;
|
|
43356
|
-
if (
|
|
43369
|
+
const { item: item2, anchor } = this.snap;
|
|
43370
|
+
if (item2) {
|
|
43357
43371
|
if (!anchor) {
|
|
43358
|
-
const point5 =
|
|
43372
|
+
const point5 = item2.getNearestEdgePointTo(pointer);
|
|
43359
43373
|
if (point5.getDistance(pointer) < this.distance.border || !this.hover.isTimeoutElapsed) {
|
|
43360
43374
|
this.snap.point = new Anchor(point5.x, point5.y, 5, this.color.pointBorder, this.color.pointBackground, 1);
|
|
43361
43375
|
} else {
|
|
@@ -43728,12 +43742,12 @@ class NestingHighlighter extends Tool {
|
|
|
43728
43742
|
this.toHighlight.push({ groupItem, children: array });
|
|
43729
43743
|
}
|
|
43730
43744
|
}
|
|
43731
|
-
addSingleItem(
|
|
43732
|
-
this.toHighlight.push({ children: [
|
|
43745
|
+
addSingleItem(item2) {
|
|
43746
|
+
this.toHighlight.push({ children: [item2] });
|
|
43733
43747
|
}
|
|
43734
|
-
remove(
|
|
43748
|
+
remove(item2) {
|
|
43735
43749
|
this.toHighlight.forEach((group) => {
|
|
43736
|
-
group.children = group.children.filter((child) => child !==
|
|
43750
|
+
group.children = group.children.filter((child) => child !== item2);
|
|
43737
43751
|
});
|
|
43738
43752
|
this.toHighlight = this.toHighlight.filter((group) => group.children.length > 0);
|
|
43739
43753
|
}
|
|
@@ -43800,7 +43814,7 @@ class AddFrame extends BoardTool {
|
|
|
43800
43814
|
this.mbr.borderColor = "blue";
|
|
43801
43815
|
this.nestingHighlighter.clear();
|
|
43802
43816
|
const enclosedOrCrossed = this.board.items.getEnclosedOrCrossed(this.mbr.left, this.mbr.top, this.mbr.right, this.mbr.bottom);
|
|
43803
|
-
const inside = enclosedOrCrossed.filter((
|
|
43817
|
+
const inside = enclosedOrCrossed.filter((item2) => !(item2 instanceof Frame2) && item2.parent === "Board" && this.mbr.isInside(item2.getMbr().getCenter()));
|
|
43804
43818
|
this.nestingHighlighter.add(this.frame, inside);
|
|
43805
43819
|
this.initTransformation();
|
|
43806
43820
|
this.board.tools.publish();
|
|
@@ -43821,7 +43835,7 @@ class AddFrame extends BoardTool {
|
|
|
43821
43835
|
localStorage.setItem("lastFrameScale", JSON.stringify(this.frame.transformation.getScale()));
|
|
43822
43836
|
}
|
|
43823
43837
|
const currMbr = this.frame.getMbr();
|
|
43824
|
-
const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((
|
|
43838
|
+
const frameChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2));
|
|
43825
43839
|
this.applyAddChildren(frameChildren);
|
|
43826
43840
|
if (this.shape !== "Custom") {
|
|
43827
43841
|
this.applyCanChangeRatio(false);
|
|
@@ -43837,7 +43851,7 @@ class AddFrame extends BoardTool {
|
|
|
43837
43851
|
return true;
|
|
43838
43852
|
}
|
|
43839
43853
|
addNextTo() {
|
|
43840
|
-
const framesInView = this.board.items.getItemsInView().filter((
|
|
43854
|
+
const framesInView = this.board.items.getItemsInView().filter((item2) => item2 instanceof Frame2);
|
|
43841
43855
|
if (framesInView.length === 0) {
|
|
43842
43856
|
if (this.shape === "Custom") {
|
|
43843
43857
|
const { x, y } = this.frame.getLastFrameScale();
|
|
@@ -43875,7 +43889,7 @@ class AddFrame extends BoardTool {
|
|
|
43875
43889
|
this.board.camera.viewRectangle(this.frame.getMbr());
|
|
43876
43890
|
}
|
|
43877
43891
|
const frameMbr = this.frame.getMbr();
|
|
43878
|
-
this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((
|
|
43892
|
+
this.board.items.getEnclosedOrCrossed(frameMbr.left, frameMbr.top, frameMbr.right, frameMbr.bottom).filter((item2) => item2.parent === "Board").filter((item2) => this.frame.handleNesting(item2)).forEach((item2) => this.applyAddChildren([item2]));
|
|
43879
43893
|
const frame = this.board.add(this.frame);
|
|
43880
43894
|
frame.text.editor.moveCursorToEndOfTheText();
|
|
43881
43895
|
this.nestingHighlighter.clear();
|
|
@@ -44380,13 +44394,13 @@ class Eraser extends BoardTool {
|
|
|
44380
44394
|
}
|
|
44381
44395
|
removeUnderPointOrLine() {
|
|
44382
44396
|
const segments = this.drawing.getLines();
|
|
44383
|
-
const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((
|
|
44384
|
-
return
|
|
44385
|
-
return line.getDistance(this.board.pointer.point) <=
|
|
44397
|
+
const items = this.board.items.getUnderPointer(this.strokeWidth / 2).filter((item2) => {
|
|
44398
|
+
return item2.itemType === "Drawing" && item2.getLines().find((line) => {
|
|
44399
|
+
return line.getDistance(this.board.pointer.point) <= item2.strokeWidth / 2 + this.strokeWidth / 2;
|
|
44386
44400
|
});
|
|
44387
44401
|
});
|
|
44388
|
-
items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((
|
|
44389
|
-
return
|
|
44402
|
+
items.push(...this.board.items.getEnclosedOrCrossed(this.drawing.points[0].x, this.drawing.points[0].y, this.board.pointer.point.x, this.board.pointer.point.y).filter((item2) => {
|
|
44403
|
+
return item2.itemType === "Drawing" && item2.getLines().some((line) => {
|
|
44390
44404
|
return segments.some((segment) => segment.hasIntersectionPoint(line));
|
|
44391
44405
|
});
|
|
44392
44406
|
}));
|
|
@@ -44838,20 +44852,20 @@ function createCanvasDrawer(board) {
|
|
|
44838
44852
|
context.ctx.setTransform(board2.camera.getMatrix().scaleX, 0, 0, board2.camera.getMatrix().scaleY, 0, 0);
|
|
44839
44853
|
context.matrix.applyToContext(context.ctx);
|
|
44840
44854
|
const items = Object.keys(translation).map((id) => {
|
|
44841
|
-
const
|
|
44842
|
-
if (
|
|
44843
|
-
if (
|
|
44844
|
-
return
|
|
44855
|
+
const item2 = board2.items.getById(id);
|
|
44856
|
+
if (item2) {
|
|
44857
|
+
if (item2.itemType !== "Frame") {
|
|
44858
|
+
return item2;
|
|
44845
44859
|
}
|
|
44846
|
-
|
|
44847
|
-
return
|
|
44860
|
+
item2.render(context);
|
|
44861
|
+
return item2;
|
|
44848
44862
|
}
|
|
44849
44863
|
return;
|
|
44850
|
-
}).filter((
|
|
44851
|
-
items.forEach((
|
|
44852
|
-
if (
|
|
44853
|
-
|
|
44854
|
-
board2.selection.renderItemMbr(context,
|
|
44864
|
+
}).filter((item2) => !!item2);
|
|
44865
|
+
items.forEach((item2) => {
|
|
44866
|
+
if (item2.itemType !== "Frame") {
|
|
44867
|
+
item2.render(context);
|
|
44868
|
+
board2.selection.renderItemMbr(context, item2, board2.camera.getMatrix().scaleX);
|
|
44855
44869
|
}
|
|
44856
44870
|
});
|
|
44857
44871
|
return { canvas: container, items };
|
|
@@ -44912,10 +44926,10 @@ function createCanvasDrawer(board) {
|
|
|
44912
44926
|
if (lastTranslationKeys) {
|
|
44913
44927
|
board.selection.shouldPublish = false;
|
|
44914
44928
|
lastTranslationKeys.forEach((id) => {
|
|
44915
|
-
const
|
|
44916
|
-
if (
|
|
44917
|
-
|
|
44918
|
-
|
|
44929
|
+
const item2 = board.items.getById(id);
|
|
44930
|
+
if (item2) {
|
|
44931
|
+
item2.transformationRenderBlock = undefined;
|
|
44932
|
+
item2.subject.publish(item2);
|
|
44919
44933
|
}
|
|
44920
44934
|
});
|
|
44921
44935
|
lastTranslationKeys = undefined;
|
|
@@ -44947,9 +44961,9 @@ function createCanvasDrawer(board) {
|
|
|
44947
44961
|
lastCreatedCanvas = cnvs;
|
|
44948
44962
|
lastTranslationKeys = Object.keys(translation);
|
|
44949
44963
|
lastTranslationKeys.forEach((id) => {
|
|
44950
|
-
const
|
|
44951
|
-
if (
|
|
44952
|
-
|
|
44964
|
+
const item2 = board.items.getById(id);
|
|
44965
|
+
if (item2) {
|
|
44966
|
+
item2.transformationRenderBlock = true;
|
|
44953
44967
|
}
|
|
44954
44968
|
});
|
|
44955
44969
|
board.selection.transformationRenderBlock = true;
|
|
@@ -44959,14 +44973,14 @@ function createCanvasDrawer(board) {
|
|
|
44959
44973
|
}
|
|
44960
44974
|
function countSumMbr(translation) {
|
|
44961
44975
|
return Object.keys(translation).reduce((mbr, id) => {
|
|
44962
|
-
const
|
|
44963
|
-
if (
|
|
44976
|
+
const item2 = board.items.getById(id);
|
|
44977
|
+
if (item2) {
|
|
44964
44978
|
if (!mbr) {
|
|
44965
|
-
mbr =
|
|
44979
|
+
mbr = item2.getMbr();
|
|
44966
44980
|
} else {
|
|
44967
|
-
mbr.combine(
|
|
44968
|
-
if (
|
|
44969
|
-
mbr.combine(
|
|
44981
|
+
mbr.combine(item2.getMbr());
|
|
44982
|
+
if (item2.itemType === "Frame") {
|
|
44983
|
+
mbr.combine(item2.getRichText().getMbr());
|
|
44970
44984
|
}
|
|
44971
44985
|
}
|
|
44972
44986
|
}
|
|
@@ -44997,8 +45011,8 @@ function createCanvasDrawer(board) {
|
|
|
44997
45011
|
}
|
|
44998
45012
|
function highlightNesting() {
|
|
44999
45013
|
const container = getLastCreatedCanvas();
|
|
45000
|
-
const drawnItemsMap = drawnItems?.reduce((acc,
|
|
45001
|
-
acc.set(
|
|
45014
|
+
const drawnItemsMap = drawnItems?.reduce((acc, item2) => {
|
|
45015
|
+
acc.set(item2.getId(), { item: item2, mbr: item2.getMbr() });
|
|
45002
45016
|
return acc;
|
|
45003
45017
|
}, new Map);
|
|
45004
45018
|
if (!container || !drawnItems) {
|
|
@@ -45033,11 +45047,11 @@ function createCanvasDrawer(board) {
|
|
|
45033
45047
|
mbr.transform(currMatrix);
|
|
45034
45048
|
});
|
|
45035
45049
|
groups.forEach((group) => {
|
|
45036
|
-
drawnItemsMap?.forEach(({ mbr, item }, key) => {
|
|
45037
|
-
if ("canBeNested" in
|
|
45050
|
+
drawnItemsMap?.forEach(({ mbr, item: item2 }, key) => {
|
|
45051
|
+
if ("canBeNested" in item2 && !item2.canBeNested) {
|
|
45038
45052
|
return;
|
|
45039
45053
|
}
|
|
45040
|
-
if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) ||
|
|
45054
|
+
if (lastCreatedCanvas && (!drawnItemsMap.get(group.getId()) || item2.parent !== group.getId()) && group.handleNesting(mbr)) {
|
|
45041
45055
|
const div = createBorderDivForItem(mbr, lastCreatedCanvas);
|
|
45042
45056
|
removeHighlighted(key);
|
|
45043
45057
|
highlightedDivs.set(key, div);
|
|
@@ -45098,10 +45112,10 @@ function createCanvasDrawer(board) {
|
|
|
45098
45112
|
}
|
|
45099
45113
|
|
|
45100
45114
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
45101
|
-
function getControlPointData(
|
|
45102
|
-
const itemScale = isRichText ? { x: 1, y: 1 } :
|
|
45103
|
-
const width2 =
|
|
45104
|
-
let height3 =
|
|
45115
|
+
function getControlPointData(item2, index2, isRichText = false) {
|
|
45116
|
+
const itemScale = isRichText ? { x: 1, y: 1 } : item2.transformation.getScale();
|
|
45117
|
+
const width2 = item2.getPathMbr().getWidth();
|
|
45118
|
+
let height3 = item2.getPathMbr().getHeight();
|
|
45105
45119
|
const adjMapScaled = {
|
|
45106
45120
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
45107
45121
|
1: {
|
|
@@ -45116,7 +45130,7 @@ function getControlPointData(item, index2, isRichText = false) {
|
|
|
45116
45130
|
};
|
|
45117
45131
|
return {
|
|
45118
45132
|
pointType: "Fixed",
|
|
45119
|
-
itemId:
|
|
45133
|
+
itemId: item2.getId(),
|
|
45120
45134
|
relativeX: adjMapScaled[index2].x,
|
|
45121
45135
|
relativeY: adjMapScaled[index2].y
|
|
45122
45136
|
};
|
|
@@ -45251,10 +45265,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
45251
45265
|
let newHeight = height3;
|
|
45252
45266
|
let itemData;
|
|
45253
45267
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
45254
|
-
const
|
|
45255
|
-
newWidth =
|
|
45256
|
-
newHeight =
|
|
45257
|
-
itemData =
|
|
45268
|
+
const item2 = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
45269
|
+
newWidth = item2.getMbr().getWidth();
|
|
45270
|
+
newHeight = item2.getMbr().getHeight();
|
|
45271
|
+
itemData = item2.serialize();
|
|
45258
45272
|
const { minX, minY, maxY, maxX } = offsets;
|
|
45259
45273
|
offsetX = Math.min(offsetX, maxX);
|
|
45260
45274
|
offsetX = Math.max(offsetX, minX);
|
|
@@ -45287,7 +45301,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
45287
45301
|
}
|
|
45288
45302
|
const newMbr = new Mbr(newItemData.transformation?.translateX, newItemData.transformation?.translateY, (newItemData.transformation?.translateX || 0) + newWidth, (newItemData.transformation?.translateY || 0) + newHeight);
|
|
45289
45303
|
let step = 1;
|
|
45290
|
-
while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((
|
|
45304
|
+
while (board.index.getItemsEnclosedOrCrossed(newMbr.left, newMbr.top, newMbr.right, newMbr.bottom).filter((item2) => item2.itemType !== "Connector").length > 0) {
|
|
45291
45305
|
const xDirection = step % 2 === 0 ? -1 : 1;
|
|
45292
45306
|
const yDirection = newItemData.itemType === "AINode" ? -1 : xDirection;
|
|
45293
45307
|
newMbr.transform(new Matrix2(iterAdjustment[index2].x * xDirection * step, iterAdjustment[index2].y * yDirection * (newItemData.itemType === "AINode" ? 1 : step)));
|
|
@@ -45420,7 +45434,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
45420
45434
|
clear();
|
|
45421
45435
|
return;
|
|
45422
45436
|
}
|
|
45423
|
-
const { positions, item } = position4;
|
|
45437
|
+
const { positions, item: item2 } = position4;
|
|
45424
45438
|
const cameraMatrix = board.camera.getMatrix();
|
|
45425
45439
|
const cameraMbr = board.camera.getMbr();
|
|
45426
45440
|
const positionAdjustments = {
|
|
@@ -45448,7 +45462,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
45448
45462
|
};
|
|
45449
45463
|
const button = document.createElement("button");
|
|
45450
45464
|
button.classList.add("microboard-quickAddButton");
|
|
45451
|
-
if (
|
|
45465
|
+
if (item2.itemType === "AINode" && index2 === 2) {
|
|
45452
45466
|
button.classList.add("microboard-invisible");
|
|
45453
45467
|
}
|
|
45454
45468
|
button.classList.add(`microboard-${adjustment.rotate}`);
|
|
@@ -45464,7 +45478,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
45464
45478
|
clearTimeout(timeoutId);
|
|
45465
45479
|
}
|
|
45466
45480
|
if (button.isMouseDown) {
|
|
45467
|
-
board.tools.addConnector(true,
|
|
45481
|
+
board.tools.addConnector(true, item2, pos);
|
|
45468
45482
|
} else {
|
|
45469
45483
|
quickAddItems = undefined;
|
|
45470
45484
|
selection.subject.publish(selection);
|
|
@@ -45571,11 +45585,11 @@ class AlignmentHelper {
|
|
|
45571
45585
|
return baseThickness / (zoom / 100);
|
|
45572
45586
|
}
|
|
45573
45587
|
combineMBRs(items) {
|
|
45574
|
-
return items.reduce((acc,
|
|
45588
|
+
return items.reduce((acc, item2, i) => {
|
|
45575
45589
|
if (i === 0) {
|
|
45576
45590
|
return acc;
|
|
45577
45591
|
}
|
|
45578
|
-
const itemMbr =
|
|
45592
|
+
const itemMbr = item2.getPathMbr();
|
|
45579
45593
|
return acc.combine(itemMbr);
|
|
45580
45594
|
}, items[0].getMbr());
|
|
45581
45595
|
}
|
|
@@ -45589,7 +45603,7 @@ class AlignmentHelper {
|
|
|
45589
45603
|
const scale = this.board.camera.getScale();
|
|
45590
45604
|
const dynamicAlignThreshold = Math.min(this.alignThreshold / scale, 8);
|
|
45591
45605
|
const childrenIds = "index" in movingItem && movingItem.index ? movingItem.getChildrenIds() : [];
|
|
45592
|
-
const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (
|
|
45606
|
+
const nearbyItems = this.canvasDrawer.getLastCreatedCanvas() ? this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (item2) => !excludeItems.includes(item2), Math.ceil(cameraWidth)) : this.spatialIndex.getNearestTo(movingMBR.getCenter(), 20, (otherItem) => otherItem !== movingMBR && otherItem.itemType !== "Connector" && otherItem.itemType !== "Drawing" && otherItem.isInView(camera) && !childrenIds.includes(otherItem.getId()), Math.ceil(cameraWidth)).filter((item2) => Array.isArray(movingItem) ? !movingItem.includes(item2) : true);
|
|
45593
45607
|
const verticalAlignments = new Map;
|
|
45594
45608
|
const horizontalAlignments = new Map;
|
|
45595
45609
|
const addVerticalAlignment = (x, minY, maxY) => {
|
|
@@ -45610,11 +45624,11 @@ class AlignmentHelper {
|
|
|
45610
45624
|
horizontalAlignments.set(y, { minX, maxX });
|
|
45611
45625
|
}
|
|
45612
45626
|
};
|
|
45613
|
-
nearbyItems.forEach((
|
|
45614
|
-
if (
|
|
45627
|
+
nearbyItems.forEach((item2) => {
|
|
45628
|
+
if (item2 === movingItem || item2.itemType === "Comment") {
|
|
45615
45629
|
return;
|
|
45616
45630
|
}
|
|
45617
|
-
const itemMbr =
|
|
45631
|
+
const itemMbr = item2.itemType === "Shape" ? item2.getPath().getMbr() : item2.getMbr();
|
|
45618
45632
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
45619
45633
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
45620
45634
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -45881,20 +45895,20 @@ class AlignmentHelper {
|
|
|
45881
45895
|
}
|
|
45882
45896
|
return false;
|
|
45883
45897
|
}
|
|
45884
|
-
translateItems(
|
|
45898
|
+
translateItems(item2, x, y, timeStamp) {
|
|
45885
45899
|
if (this.canvasDrawer.getLastCreatedCanvas()) {
|
|
45886
45900
|
return;
|
|
45887
45901
|
}
|
|
45888
|
-
if (Array.isArray(
|
|
45902
|
+
if (Array.isArray(item2)) {
|
|
45889
45903
|
const translation = this.board.selection.getManyItemsTranslation(x, y);
|
|
45890
45904
|
this.board.selection.transformMany(translation, timeStamp);
|
|
45891
45905
|
return;
|
|
45892
45906
|
}
|
|
45893
|
-
if (
|
|
45907
|
+
if (item2.itemType === "Frame") {
|
|
45894
45908
|
const translation = this.board.selection.getManyItemsTranslation(x, y);
|
|
45895
45909
|
this.board.selection.transformMany(translation, timeStamp);
|
|
45896
45910
|
} else {
|
|
45897
|
-
const id =
|
|
45911
|
+
const id = item2.getId();
|
|
45898
45912
|
const transformMap = {};
|
|
45899
45913
|
transformMap[id] = {
|
|
45900
45914
|
class: "Transformation",
|
|
@@ -46022,12 +46036,12 @@ class Select extends Tool {
|
|
|
46022
46036
|
this.debounceUpd.setFalse();
|
|
46023
46037
|
this.snapLines = { verticalLines: [], horizontalLines: [] };
|
|
46024
46038
|
}
|
|
46025
|
-
handleSnapping(
|
|
46039
|
+
handleSnapping(item2) {
|
|
46026
46040
|
if (this.board.keyboard.isShift) {
|
|
46027
46041
|
return false;
|
|
46028
46042
|
}
|
|
46029
|
-
const increasedSnapThreshold = Array.isArray(
|
|
46030
|
-
this.isSnapped = this.alignmentHelper.snapToClosestLine(
|
|
46043
|
+
const increasedSnapThreshold = Array.isArray(item2) ? 40 : 35;
|
|
46044
|
+
this.isSnapped = this.alignmentHelper.snapToClosestLine(item2, this.snapLines, this.beginTimeStamp, this.board.pointer.point);
|
|
46031
46045
|
if (this.isSnapped) {
|
|
46032
46046
|
if (!this.snapCursorPos) {
|
|
46033
46047
|
this.snapCursorPos = new Point(this.board.pointer.point.x, this.board.pointer.point.y);
|
|
@@ -46037,10 +46051,10 @@ class Select extends Tool {
|
|
|
46037
46051
|
if ((cursorDiffX > increasedSnapThreshold || cursorDiffY > increasedSnapThreshold) && this.initialCursorPos) {
|
|
46038
46052
|
this.isSnapped = false;
|
|
46039
46053
|
this.snapCursorPos = null;
|
|
46040
|
-
const itemCenter = Array.isArray(
|
|
46054
|
+
const itemCenter = Array.isArray(item2) ? this.alignmentHelper.combineMBRs(item2).getCenter() : item2.getMbr().getCenter();
|
|
46041
46055
|
const translateX = this.board.pointer.point.x - this.initialCursorPos.x - itemCenter.x;
|
|
46042
46056
|
const translateY = this.board.pointer.point.y - this.initialCursorPos.y - itemCenter.y;
|
|
46043
|
-
this.alignmentHelper.translateItems(
|
|
46057
|
+
this.alignmentHelper.translateItems(item2, translateX, translateY, this.beginTimeStamp);
|
|
46044
46058
|
}
|
|
46045
46059
|
}
|
|
46046
46060
|
return false;
|
|
@@ -46090,10 +46104,10 @@ class Select extends Tool {
|
|
|
46090
46104
|
angleDiff = angleDiff < 0 ? angleDiff + 360 : angleDiff;
|
|
46091
46105
|
return Math.min(angleDiff, 360 - angleDiff);
|
|
46092
46106
|
}
|
|
46093
|
-
handleShiftGuidelines(
|
|
46094
|
-
if (
|
|
46107
|
+
handleShiftGuidelines(item2, mousePosition) {
|
|
46108
|
+
if (item2) {
|
|
46095
46109
|
if (!this.originalCenter) {
|
|
46096
|
-
this.originalCenter = Array.isArray(
|
|
46110
|
+
this.originalCenter = Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().copy() : item2.getMbr().getCenter().copy();
|
|
46097
46111
|
this.guidelines = this.alignmentHelper.generateGuidelines(this.originalCenter).lines;
|
|
46098
46112
|
}
|
|
46099
46113
|
this.mainLine = new Line(this.originalCenter, mousePosition);
|
|
@@ -46114,13 +46128,13 @@ class Select extends Tool {
|
|
|
46114
46128
|
const newEndX = this.originalCenter.x + snapDirectionX * mainLineLength;
|
|
46115
46129
|
const newEndY = this.originalCenter.y + snapDirectionY * mainLineLength;
|
|
46116
46130
|
const threshold = Infinity;
|
|
46117
|
-
const translateX = newEndX - (Array.isArray(
|
|
46118
|
-
const translateY = newEndY - (Array.isArray(
|
|
46119
|
-
if (Array.isArray(
|
|
46131
|
+
const translateX = newEndX - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().x : item2.getMbr().getCenter().x);
|
|
46132
|
+
const translateY = newEndY - (Array.isArray(item2) ? this.board.selection.getMbr()?.getCenter().y : item2.getMbr().getCenter().y);
|
|
46133
|
+
if (Array.isArray(item2)) {
|
|
46120
46134
|
const translation = this.board.selection.getManyItemsTranslation(translateX, translateY);
|
|
46121
46135
|
this.board.selection.transformMany(translation, this.beginTimeStamp);
|
|
46122
46136
|
} else {
|
|
46123
|
-
|
|
46137
|
+
item2.transformation.translateBy(translateX, translateY, this.beginTimeStamp);
|
|
46124
46138
|
}
|
|
46125
46139
|
}
|
|
46126
46140
|
}
|
|
@@ -46163,7 +46177,7 @@ class Select extends Tool {
|
|
|
46163
46177
|
return false;
|
|
46164
46178
|
}
|
|
46165
46179
|
this.isDownOnBoard = hover.length === 0;
|
|
46166
|
-
this.isDrawingRectangle = hover.filter((
|
|
46180
|
+
this.isDrawingRectangle = hover.filter((item2) => !(item2 instanceof Frame2)).length === 0 && hover.filter((item2) => item2 instanceof Frame2).filter((frame) => frame.isTextUnderPoint(pointer.point)).length === 0;
|
|
46167
46181
|
if (this.isDrawingRectangle) {
|
|
46168
46182
|
const { x, y } = pointer.point;
|
|
46169
46183
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
@@ -46183,7 +46197,7 @@ class Select extends Tool {
|
|
|
46183
46197
|
});
|
|
46184
46198
|
return false;
|
|
46185
46199
|
}
|
|
46186
|
-
const isHoverLocked = hover.every((
|
|
46200
|
+
const isHoverLocked = hover.every((item2) => item2.transformation.isLocked);
|
|
46187
46201
|
if (isHoverLocked) {
|
|
46188
46202
|
return false;
|
|
46189
46203
|
}
|
|
@@ -46317,7 +46331,7 @@ class Select extends Tool {
|
|
|
46317
46331
|
const translation = selection.getManyItemsTranslation(x, y);
|
|
46318
46332
|
const translationKeys = Object.keys(translation);
|
|
46319
46333
|
const commentsSet = new Set(this.board.items.getComments().map((comment2) => comment2.getId()));
|
|
46320
|
-
if (translationKeys.filter((
|
|
46334
|
+
if (translationKeys.filter((item2) => !commentsSet.has(item2)).length > 10) {
|
|
46321
46335
|
const selectedMbr = this.board.selection.getMbr()?.copy();
|
|
46322
46336
|
const sumMbr = this.canvasDrawer.countSumMbr(translation);
|
|
46323
46337
|
if (sumMbr) {
|
|
@@ -46344,7 +46358,7 @@ class Select extends Tool {
|
|
|
46344
46358
|
return false;
|
|
46345
46359
|
}
|
|
46346
46360
|
const draggingMbr = draggingItem.getMbr();
|
|
46347
|
-
const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((
|
|
46361
|
+
const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item2) => item2 instanceof Frame2);
|
|
46348
46362
|
frames.forEach((frame) => {
|
|
46349
46363
|
if (frame.handleNesting(draggingItem)) {
|
|
46350
46364
|
this.nestingHighlighter.add(frame, draggingItem);
|
|
@@ -46354,7 +46368,7 @@ class Select extends Tool {
|
|
|
46354
46368
|
});
|
|
46355
46369
|
}
|
|
46356
46370
|
const hover = items.getUnderPointer();
|
|
46357
|
-
this.isHoverUnselectedItem = hover.filter((
|
|
46371
|
+
this.isHoverUnselectedItem = hover.filter((item2) => item2.itemType === "Placeholder").length === 1;
|
|
46358
46372
|
if (this.isHoverUnselectedItem && !this.isDraggingUnselectedItem && selection.getContext() === "None") {
|
|
46359
46373
|
selection.setContext("HoverUnderPointer");
|
|
46360
46374
|
return false;
|
|
@@ -46398,15 +46412,15 @@ class Select extends Tool {
|
|
|
46398
46412
|
}
|
|
46399
46413
|
}
|
|
46400
46414
|
updateFramesNesting(selectionMbr, selection) {
|
|
46401
|
-
const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((
|
|
46402
|
-
const draggingFramesIds = selection.list().filter((
|
|
46403
|
-
selection.list().forEach((
|
|
46404
|
-
if (!(
|
|
46415
|
+
const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item2) => item2 instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
|
|
46416
|
+
const draggingFramesIds = selection.list().filter((item2) => item2 instanceof Frame2).map((frame) => frame.getId());
|
|
46417
|
+
selection.list().forEach((item2) => {
|
|
46418
|
+
if (!(item2 instanceof Frame2) && !draggingFramesIds.includes(item2.parent)) {
|
|
46405
46419
|
frames.forEach((frame) => {
|
|
46406
|
-
if (frame.handleNesting(
|
|
46407
|
-
this.nestingHighlighter.add(frame,
|
|
46420
|
+
if (frame.handleNesting(item2)) {
|
|
46421
|
+
this.nestingHighlighter.add(frame, item2);
|
|
46408
46422
|
} else {
|
|
46409
|
-
this.nestingHighlighter.remove(
|
|
46423
|
+
this.nestingHighlighter.remove(item2);
|
|
46410
46424
|
}
|
|
46411
46425
|
});
|
|
46412
46426
|
}
|
|
@@ -46498,7 +46512,7 @@ class Select extends Tool {
|
|
|
46498
46512
|
const childrenIds = underPointer.getChildrenIds();
|
|
46499
46513
|
console.log("UNDERPOINTER", underPointer);
|
|
46500
46514
|
console.log("CHILDREN", childrenIds);
|
|
46501
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((
|
|
46515
|
+
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item2) => childrenIds && childrenIds.includes(item2.getId()));
|
|
46502
46516
|
this.board.selection.add(itemsInFrame);
|
|
46503
46517
|
}
|
|
46504
46518
|
this.board.selection.setContext("EditUnderPointer");
|
|
@@ -46738,8 +46752,8 @@ class ShapeTool extends CustomTool {
|
|
|
46738
46752
|
resizeType = "leftBottom";
|
|
46739
46753
|
bounds = new Mbr;
|
|
46740
46754
|
isDown = false;
|
|
46741
|
-
constructor(board, name,
|
|
46742
|
-
super(board, name,
|
|
46755
|
+
constructor(board, name, item2, settings) {
|
|
46756
|
+
super(board, name, item2);
|
|
46743
46757
|
this.settings = settings;
|
|
46744
46758
|
this.setCursor();
|
|
46745
46759
|
}
|
|
@@ -46822,8 +46836,8 @@ class ShapeTool extends CustomTool {
|
|
|
46822
46836
|
|
|
46823
46837
|
class StickerTool extends CustomTool {
|
|
46824
46838
|
settings;
|
|
46825
|
-
constructor(board, name,
|
|
46826
|
-
super(board, name,
|
|
46839
|
+
constructor(board, name, item2, settings) {
|
|
46840
|
+
super(board, name, item2);
|
|
46827
46841
|
this.settings = settings;
|
|
46828
46842
|
this.setCursor();
|
|
46829
46843
|
}
|
|
@@ -47129,7 +47143,7 @@ class Tools extends ToolContext {
|
|
|
47129
47143
|
this.subject.publish(this);
|
|
47130
47144
|
}
|
|
47131
47145
|
sortFrames() {
|
|
47132
|
-
const frames = this.board.items.listAll().filter((
|
|
47146
|
+
const frames = this.board.items.listAll().filter((item2) => item2 instanceof Frame2);
|
|
47133
47147
|
const sortedFrames = frames.sort((fr1, fr2) => {
|
|
47134
47148
|
const mbr1 = fr1.getMbr();
|
|
47135
47149
|
const mbr2 = fr2.getMbr();
|
|
@@ -47355,24 +47369,24 @@ function validateGroupData(groupData) {
|
|
|
47355
47369
|
}
|
|
47356
47370
|
// src/Items/RegisterItem.ts
|
|
47357
47371
|
function registerItem({
|
|
47358
|
-
item,
|
|
47372
|
+
item: item2,
|
|
47359
47373
|
defaultData: defaultData2,
|
|
47360
47374
|
toolData
|
|
47361
47375
|
}) {
|
|
47362
47376
|
const { itemType } = defaultData2;
|
|
47363
|
-
itemFactories[itemType] = createItemFactory(
|
|
47377
|
+
itemFactories[itemType] = createItemFactory(item2, defaultData2);
|
|
47364
47378
|
itemValidators[itemType] = createItemValidator(defaultData2);
|
|
47365
47379
|
if (toolData) {
|
|
47366
47380
|
registeredTools[toolData.name] = toolData.tool;
|
|
47367
47381
|
}
|
|
47368
47382
|
itemCommandFactories[itemType] = createItemCommandFactory(itemType);
|
|
47369
47383
|
}
|
|
47370
|
-
function createItemFactory(
|
|
47384
|
+
function createItemFactory(item2, defaultData2) {
|
|
47371
47385
|
return function itemFactory(id, data, board) {
|
|
47372
47386
|
if (data.itemType !== defaultData2.itemType) {
|
|
47373
47387
|
throw new Error(`Invalid data for ${defaultData2.itemType}`);
|
|
47374
47388
|
}
|
|
47375
|
-
return new
|
|
47389
|
+
return new item2(board, id, defaultData2).setId(id).deserialize(data);
|
|
47376
47390
|
};
|
|
47377
47391
|
}
|
|
47378
47392
|
function createItemValidator(defaultData2) {
|
|
@@ -47387,7 +47401,7 @@ function createItemValidator(defaultData2) {
|
|
|
47387
47401
|
}
|
|
47388
47402
|
function createItemCommandFactory(itemType) {
|
|
47389
47403
|
return function itemCommandFactory(items, operation) {
|
|
47390
|
-
return new BaseCommand(items.filter((
|
|
47404
|
+
return new BaseCommand(items.filter((item2) => item2.itemType === itemType), operation);
|
|
47391
47405
|
};
|
|
47392
47406
|
}
|
|
47393
47407
|
// src/Items/Examples/Star/AddStar.ts
|
|
@@ -48412,8 +48426,8 @@ class Camera {
|
|
|
48412
48426
|
this.observableItem = null;
|
|
48413
48427
|
}
|
|
48414
48428
|
}
|
|
48415
|
-
subscribeToItem(
|
|
48416
|
-
this.observableItem =
|
|
48429
|
+
subscribeToItem(item2) {
|
|
48430
|
+
this.observableItem = item2;
|
|
48417
48431
|
this.observableItem.subject.subscribe(this.observeItem);
|
|
48418
48432
|
}
|
|
48419
48433
|
observeItem = () => {
|
|
@@ -48639,7 +48653,7 @@ class Camera {
|
|
|
48639
48653
|
}
|
|
48640
48654
|
addToView(mbr, inView) {
|
|
48641
48655
|
if (!mbr.isEnclosedBy(this.getMbr())) {
|
|
48642
|
-
this.viewRectangle(inView.reduce((acc,
|
|
48656
|
+
this.viewRectangle(inView.reduce((acc, item2) => acc.combine(item2.getMbr()), inView[0]?.getMbr() ?? new Mbr).combine(mbr));
|
|
48643
48657
|
}
|
|
48644
48658
|
}
|
|
48645
48659
|
viewRectangle(mbr, offsetInPercent = 10, duration = 500) {
|
|
@@ -50248,8 +50262,8 @@ class Presence {
|
|
|
50248
50262
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.28421 4.30174C3.55182 4.02741 3.95268 3.93015 4.31625 4.05135L20.3163 9.38468C20.7064 9.51472 20.9771 9.8703 20.9987 10.2809C21.0202 10.6916 20.7882 11.0736 20.4138 11.2437L20.36 11.2682L20.2042 11.3396C20.069 11.4015 19.8742 11.4912 19.636 11.6017C19.1595 11.8227 18.5109 12.1262 17.8216 12.4571C16.4106 13.1344 14.9278 13.8797 14.3325 14.2765C14.3325 14.2765 14.3258 14.2809 14.308 14.2965C14.2906 14.3118 14.2673 14.3339 14.2382 14.3646C14.1791 14.4267 14.1072 14.5123 14.0231 14.6243C13.8542 14.8496 13.6622 15.1471 13.4541 15.5039C13.0384 16.2164 12.5946 17.1024 12.1833 17.98C11.7735 18.8541 11.4038 19.7031 11.136 20.3348C11.0023 20.6502 10.8944 20.9105 10.8201 21.0915C10.783 21.182 10.7543 21.2525 10.735 21.3002L10.7132 21.3542L10.7066 21.3707C10.5524 21.7561 10.1759 22.0069 9.76082 21.9999C9.34577 21.9928 8.97824 21.7301 8.83725 21.3397L3.05947 5.33967C2.92931 4.97922 3.0166 4.57607 3.28421 4.30174Z" fill="${color2}"/>
|
|
50249
50263
|
</svg>`;
|
|
50250
50264
|
}
|
|
50251
|
-
renderItemMbr(context,
|
|
50252
|
-
const mbr =
|
|
50265
|
+
renderItemMbr(context, item2, color2, customScale) {
|
|
50266
|
+
const mbr = item2.getMbr();
|
|
50253
50267
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
50254
50268
|
mbr.borderColor = color2;
|
|
50255
50269
|
mbr.render(context);
|
|
@@ -50389,8 +50403,8 @@ class Presence {
|
|
|
50389
50403
|
selectionMbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
50390
50404
|
selectionMbr.borderColor = selection.color;
|
|
50391
50405
|
selectionMbr.render(context);
|
|
50392
|
-
for (const
|
|
50393
|
-
this.renderItemMbr(context,
|
|
50406
|
+
for (const item2 of selection.selection) {
|
|
50407
|
+
this.renderItemMbr(context, item2, selection.color);
|
|
50394
50408
|
}
|
|
50395
50409
|
}
|
|
50396
50410
|
}
|
|
@@ -50423,14 +50437,14 @@ class SelectionItems {
|
|
|
50423
50437
|
items = new Map;
|
|
50424
50438
|
add(value) {
|
|
50425
50439
|
if (Array.isArray(value)) {
|
|
50426
|
-
value.forEach((
|
|
50440
|
+
value.forEach((item2) => this.items.set(item2.getId(), item2));
|
|
50427
50441
|
} else {
|
|
50428
50442
|
this.items.set(value.getId(), value);
|
|
50429
50443
|
}
|
|
50430
50444
|
}
|
|
50431
50445
|
remove(value) {
|
|
50432
50446
|
if (Array.isArray(value)) {
|
|
50433
|
-
value.forEach((
|
|
50447
|
+
value.forEach((item2) => this.items.delete(item2.getId()));
|
|
50434
50448
|
} else {
|
|
50435
50449
|
this.items.delete(value.getId());
|
|
50436
50450
|
}
|
|
@@ -50460,8 +50474,8 @@ class SelectionItems {
|
|
|
50460
50474
|
if (this.isEmpty()) {
|
|
50461
50475
|
return false;
|
|
50462
50476
|
}
|
|
50463
|
-
for (const
|
|
50464
|
-
if (
|
|
50477
|
+
for (const item2 of this.items.values()) {
|
|
50478
|
+
if (item2.itemType !== "RichText") {
|
|
50465
50479
|
return false;
|
|
50466
50480
|
}
|
|
50467
50481
|
}
|
|
@@ -50471,14 +50485,14 @@ class SelectionItems {
|
|
|
50471
50485
|
if (this.isEmpty()) {
|
|
50472
50486
|
return false;
|
|
50473
50487
|
}
|
|
50474
|
-
return Array.from(this.items).every(([,
|
|
50488
|
+
return Array.from(this.items).every(([, item2]) => item2.itemType === itemType);
|
|
50475
50489
|
}
|
|
50476
50490
|
isItemTypes(itemTypes) {
|
|
50477
50491
|
if (this.isEmpty()) {
|
|
50478
50492
|
return false;
|
|
50479
50493
|
}
|
|
50480
|
-
for (const
|
|
50481
|
-
if (!itemTypes.includes(
|
|
50494
|
+
for (const item2 of this.items.values()) {
|
|
50495
|
+
if (!itemTypes.includes(item2.itemType)) {
|
|
50482
50496
|
return false;
|
|
50483
50497
|
}
|
|
50484
50498
|
}
|
|
@@ -50486,16 +50500,16 @@ class SelectionItems {
|
|
|
50486
50500
|
}
|
|
50487
50501
|
getItemTypes() {
|
|
50488
50502
|
const itemTypes = new Set;
|
|
50489
|
-
this.items.forEach((
|
|
50503
|
+
this.items.forEach((item2) => itemTypes.add(item2.itemType));
|
|
50490
50504
|
return Array.from(itemTypes);
|
|
50491
50505
|
}
|
|
50492
50506
|
getItemsByItemTypes(itemTypes) {
|
|
50493
|
-
return Array.from(this.items.values()).filter((
|
|
50507
|
+
return Array.from(this.items.values()).filter((item2) => itemTypes.includes(item2.itemType));
|
|
50494
50508
|
}
|
|
50495
50509
|
getIdsByItemTypes(itemTypes) {
|
|
50496
50510
|
const ids = [];
|
|
50497
|
-
this.items.forEach((
|
|
50498
|
-
if (itemTypes.includes(
|
|
50511
|
+
this.items.forEach((item2, id) => {
|
|
50512
|
+
if (itemTypes.includes(item2.itemType)) {
|
|
50499
50513
|
ids.push(id);
|
|
50500
50514
|
}
|
|
50501
50515
|
});
|
|
@@ -50505,7 +50519,7 @@ class SelectionItems {
|
|
|
50505
50519
|
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
50506
50520
|
}
|
|
50507
50521
|
listByIds(itemIdList) {
|
|
50508
|
-
return itemIdList.map((id) => this.items.get(id)).filter((
|
|
50522
|
+
return itemIdList.map((id) => this.items.get(id)).filter((item2) => item2 !== undefined);
|
|
50509
50523
|
}
|
|
50510
50524
|
ids() {
|
|
50511
50525
|
return Array.from(this.items.keys());
|
|
@@ -50516,7 +50530,7 @@ class SelectionItems {
|
|
|
50516
50530
|
return;
|
|
50517
50531
|
}
|
|
50518
50532
|
const mbr = items[0].getMbr();
|
|
50519
|
-
items.slice(1).forEach((
|
|
50533
|
+
items.slice(1).forEach((item2) => mbr.combine(item2.getMbr()));
|
|
50520
50534
|
return mbr;
|
|
50521
50535
|
}
|
|
50522
50536
|
}
|
|
@@ -50721,33 +50735,33 @@ function handleMultipleItemsResize({
|
|
|
50721
50735
|
const translation = {};
|
|
50722
50736
|
const items = itemsToResize ? itemsToResize : board.selection.items.list();
|
|
50723
50737
|
board.items.getComments().forEach((comment2) => {
|
|
50724
|
-
if (items.some((
|
|
50738
|
+
if (items.some((item2) => item2.getId() === comment2.getItemToFollow())) {
|
|
50725
50739
|
items.push(comment2);
|
|
50726
50740
|
}
|
|
50727
50741
|
});
|
|
50728
|
-
for (const
|
|
50729
|
-
let itemX =
|
|
50730
|
-
let itemY =
|
|
50731
|
-
if (
|
|
50732
|
-
itemX =
|
|
50733
|
-
itemY =
|
|
50742
|
+
for (const item2 of items) {
|
|
50743
|
+
let itemX = item2.getMbr().left;
|
|
50744
|
+
let itemY = item2.getMbr().top;
|
|
50745
|
+
if (item2.itemType === "Drawing") {
|
|
50746
|
+
itemX = item2.transformation.matrix.translateX;
|
|
50747
|
+
itemY = item2.transformation.matrix.translateY;
|
|
50734
50748
|
}
|
|
50735
50749
|
const deltaX = itemX - initMbr.left;
|
|
50736
50750
|
const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
|
|
50737
50751
|
const deltaY = itemY - initMbr.top;
|
|
50738
50752
|
const translateY = deltaY * matrix.scaleY - deltaY + matrix.translateY;
|
|
50739
|
-
if (
|
|
50740
|
-
translation[
|
|
50741
|
-
item,
|
|
50753
|
+
if (item2 instanceof RichText) {
|
|
50754
|
+
translation[item2.getId()] = getRichTextTranslation({
|
|
50755
|
+
item: item2,
|
|
50742
50756
|
isWidth,
|
|
50743
50757
|
isHeight,
|
|
50744
50758
|
matrix,
|
|
50745
50759
|
translateX,
|
|
50746
50760
|
translateY
|
|
50747
50761
|
});
|
|
50748
|
-
} else if (
|
|
50749
|
-
translation[
|
|
50750
|
-
item,
|
|
50762
|
+
} else if (item2 instanceof AINode) {
|
|
50763
|
+
translation[item2.getId()] = getAINodeTranslation({
|
|
50764
|
+
item: item2,
|
|
50751
50765
|
isWidth,
|
|
50752
50766
|
isHeight,
|
|
50753
50767
|
matrix,
|
|
@@ -50755,8 +50769,8 @@ function handleMultipleItemsResize({
|
|
|
50755
50769
|
translateY
|
|
50756
50770
|
});
|
|
50757
50771
|
} else {
|
|
50758
|
-
translation[
|
|
50759
|
-
item,
|
|
50772
|
+
translation[item2.getId()] = getItemTranslation({
|
|
50773
|
+
item: item2,
|
|
50760
50774
|
isWidth,
|
|
50761
50775
|
isHeight,
|
|
50762
50776
|
matrix,
|
|
@@ -50769,7 +50783,7 @@ function handleMultipleItemsResize({
|
|
|
50769
50783
|
return translation;
|
|
50770
50784
|
}
|
|
50771
50785
|
function getRichTextTranslation({
|
|
50772
|
-
item,
|
|
50786
|
+
item: item2,
|
|
50773
50787
|
isWidth,
|
|
50774
50788
|
isHeight,
|
|
50775
50789
|
matrix,
|
|
@@ -50777,11 +50791,11 @@ function getRichTextTranslation({
|
|
|
50777
50791
|
translateY
|
|
50778
50792
|
}) {
|
|
50779
50793
|
if (isWidth) {
|
|
50780
|
-
|
|
50794
|
+
item2.editor.setMaxWidth(item2.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
|
|
50781
50795
|
return {
|
|
50782
50796
|
class: "Transformation",
|
|
50783
50797
|
method: "scaleByTranslateBy",
|
|
50784
|
-
item: [
|
|
50798
|
+
item: [item2.getId()],
|
|
50785
50799
|
translate: { x: matrix.translateX, y: 0 },
|
|
50786
50800
|
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
50787
50801
|
};
|
|
@@ -50789,7 +50803,7 @@ function getRichTextTranslation({
|
|
|
50789
50803
|
return {
|
|
50790
50804
|
class: "Transformation",
|
|
50791
50805
|
method: "scaleByTranslateBy",
|
|
50792
|
-
item: [
|
|
50806
|
+
item: [item2.getId()],
|
|
50793
50807
|
translate: { x: translateX, y: translateY },
|
|
50794
50808
|
scale: { x: 1, y: 1 }
|
|
50795
50809
|
};
|
|
@@ -50797,14 +50811,14 @@ function getRichTextTranslation({
|
|
|
50797
50811
|
return {
|
|
50798
50812
|
class: "Transformation",
|
|
50799
50813
|
method: "scaleByTranslateBy",
|
|
50800
|
-
item: [
|
|
50814
|
+
item: [item2.getId()],
|
|
50801
50815
|
translate: { x: translateX, y: translateY },
|
|
50802
50816
|
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
50803
50817
|
};
|
|
50804
50818
|
}
|
|
50805
50819
|
}
|
|
50806
50820
|
function getAINodeTranslation({
|
|
50807
|
-
item,
|
|
50821
|
+
item: item2,
|
|
50808
50822
|
isWidth,
|
|
50809
50823
|
isHeight,
|
|
50810
50824
|
matrix,
|
|
@@ -50812,11 +50826,11 @@ function getAINodeTranslation({
|
|
|
50812
50826
|
translateY
|
|
50813
50827
|
}) {
|
|
50814
50828
|
if (isWidth) {
|
|
50815
|
-
|
|
50829
|
+
item2.text.editor.setMaxWidth(item2.text.getWidth() / item2.transformation.getScale().x * matrix.scaleX);
|
|
50816
50830
|
return {
|
|
50817
50831
|
class: "Transformation",
|
|
50818
50832
|
method: "scaleByTranslateBy",
|
|
50819
|
-
item: [
|
|
50833
|
+
item: [item2.getId()],
|
|
50820
50834
|
translate: { x: matrix.translateX, y: 0 },
|
|
50821
50835
|
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
50822
50836
|
};
|
|
@@ -50824,7 +50838,7 @@ function getAINodeTranslation({
|
|
|
50824
50838
|
return {
|
|
50825
50839
|
class: "Transformation",
|
|
50826
50840
|
method: "scaleByTranslateBy",
|
|
50827
|
-
item: [
|
|
50841
|
+
item: [item2.getId()],
|
|
50828
50842
|
translate: { x: translateX, y: translateY },
|
|
50829
50843
|
scale: { x: 1, y: 1 }
|
|
50830
50844
|
};
|
|
@@ -50832,14 +50846,14 @@ function getAINodeTranslation({
|
|
|
50832
50846
|
return {
|
|
50833
50847
|
class: "Transformation",
|
|
50834
50848
|
method: "scaleByTranslateBy",
|
|
50835
|
-
item: [
|
|
50849
|
+
item: [item2.getId()],
|
|
50836
50850
|
translate: { x: translateX, y: translateY },
|
|
50837
50851
|
scale: { x: matrix.scaleX, y: matrix.scaleX }
|
|
50838
50852
|
};
|
|
50839
50853
|
}
|
|
50840
50854
|
}
|
|
50841
50855
|
function getItemTranslation({
|
|
50842
|
-
item,
|
|
50856
|
+
item: item2,
|
|
50843
50857
|
isWidth,
|
|
50844
50858
|
isHeight,
|
|
50845
50859
|
matrix,
|
|
@@ -50847,22 +50861,22 @@ function getItemTranslation({
|
|
|
50847
50861
|
translateY,
|
|
50848
50862
|
isShiftPressed
|
|
50849
50863
|
}) {
|
|
50850
|
-
if (
|
|
50864
|
+
if (item2 instanceof Sticker && (isWidth || isHeight)) {
|
|
50851
50865
|
return {
|
|
50852
50866
|
class: "Transformation",
|
|
50853
50867
|
method: "scaleByTranslateBy",
|
|
50854
|
-
item: [
|
|
50868
|
+
item: [item2.getId()],
|
|
50855
50869
|
translate: { x: translateX, y: translateY },
|
|
50856
50870
|
scale: { x: 1, y: 1 }
|
|
50857
50871
|
};
|
|
50858
50872
|
} else {
|
|
50859
|
-
if (
|
|
50860
|
-
|
|
50873
|
+
if (item2 instanceof Frame2 && item2.getCanChangeRatio() && isShiftPressed && item2.getFrameType() !== "Custom") {
|
|
50874
|
+
item2.setFrameType("Custom");
|
|
50861
50875
|
}
|
|
50862
50876
|
return {
|
|
50863
50877
|
class: "Transformation",
|
|
50864
50878
|
method: "scaleByTranslateBy",
|
|
50865
|
-
item: [
|
|
50879
|
+
item: [item2.getId()],
|
|
50866
50880
|
translate: { x: translateX, y: translateY },
|
|
50867
50881
|
scale: { x: matrix.scaleX, y: matrix.scaleY }
|
|
50868
50882
|
};
|
|
@@ -51135,11 +51149,11 @@ function transformItems({
|
|
|
51135
51149
|
setSnapCursorPos
|
|
51136
51150
|
}) {
|
|
51137
51151
|
const items = selection.items.list();
|
|
51138
|
-
const includesProportionalItem = items.some((
|
|
51152
|
+
const includesProportionalItem = items.some((item2) => item2.itemType === "Sticker" || item2.itemType === "RichText" || item2.itemType === "AINode" || item2.itemType === "Video" || item2.itemType === "Audio");
|
|
51139
51153
|
if (includesProportionalItem && (isWidth || isHeight)) {
|
|
51140
51154
|
return null;
|
|
51141
51155
|
}
|
|
51142
|
-
const isIncludesFixedFrame = items.some((
|
|
51156
|
+
const isIncludesFixedFrame = items.some((item2) => item2 instanceof Frame2 && !item2.getCanChangeRatio());
|
|
51143
51157
|
const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
|
|
51144
51158
|
const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
|
|
51145
51159
|
if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
|
|
@@ -51217,23 +51231,23 @@ function updateFrameChildren({
|
|
|
51217
51231
|
nestingHighlighter
|
|
51218
51232
|
}) {
|
|
51219
51233
|
const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
|
|
51220
|
-
board.selection.items.list().forEach((
|
|
51221
|
-
if ("getChildrenIds" in
|
|
51222
|
-
const currMbr =
|
|
51234
|
+
board.selection.items.list().forEach((item2) => {
|
|
51235
|
+
if ("getChildrenIds" in item2 && item2.getChildrenIds()) {
|
|
51236
|
+
const currMbr = item2.getMbr();
|
|
51223
51237
|
const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
|
|
51224
51238
|
itemsToCheck.forEach((currItem) => {
|
|
51225
|
-
if (
|
|
51226
|
-
nestingHighlighter.add(
|
|
51239
|
+
if (item2.handleNesting(currItem) && (currItem.parent === "Board" || currItem.parent === item2.getId())) {
|
|
51240
|
+
nestingHighlighter.add(item2, currItem);
|
|
51227
51241
|
} else {
|
|
51228
51242
|
nestingHighlighter.remove(currItem);
|
|
51229
51243
|
}
|
|
51230
51244
|
});
|
|
51231
51245
|
} else {
|
|
51232
51246
|
groups.forEach((group) => {
|
|
51233
|
-
if (group.handleNesting(
|
|
51234
|
-
nestingHighlighter.add(group,
|
|
51247
|
+
if (group.handleNesting(item2)) {
|
|
51248
|
+
nestingHighlighter.add(group, item2);
|
|
51235
51249
|
} else {
|
|
51236
|
-
nestingHighlighter.remove(
|
|
51250
|
+
nestingHighlighter.remove(item2);
|
|
51237
51251
|
}
|
|
51238
51252
|
});
|
|
51239
51253
|
}
|
|
@@ -51301,9 +51315,9 @@ class Transformer extends Tool {
|
|
|
51301
51315
|
const pointer = this.board.pointer;
|
|
51302
51316
|
const camera = this.board.camera;
|
|
51303
51317
|
const items = this.selection.items;
|
|
51304
|
-
const
|
|
51318
|
+
const item2 = items.getSingle();
|
|
51305
51319
|
let resizeType;
|
|
51306
|
-
if (
|
|
51320
|
+
if (item2 && (item2.itemType === "RichText" || item2.itemType === "Sticker")) {
|
|
51307
51321
|
resizeType = getTextResizeType(pointer.point, camera.getScale(), mbr);
|
|
51308
51322
|
} else {
|
|
51309
51323
|
resizeType = getResizeType(pointer.point, camera.getScale(), mbr);
|
|
@@ -51557,8 +51571,8 @@ class SelectionTransformer extends Tool {
|
|
|
51557
51571
|
return;
|
|
51558
51572
|
}
|
|
51559
51573
|
if (this.selection.items.isSingle()) {
|
|
51560
|
-
const
|
|
51561
|
-
if (
|
|
51574
|
+
const item2 = this.selection.items.getSingle();
|
|
51575
|
+
if (item2?.itemType === "Connector") {
|
|
51562
51576
|
this.tool = this.connectorTransformerTool;
|
|
51563
51577
|
return;
|
|
51564
51578
|
} else {
|
|
@@ -51641,16 +51655,16 @@ class BoardSelection {
|
|
|
51641
51655
|
this.quickAddButtons = getQuickAddButtons(this, board);
|
|
51642
51656
|
}
|
|
51643
51657
|
serialize() {
|
|
51644
|
-
const selectedItems = this.items.list().map((
|
|
51658
|
+
const selectedItems = this.items.list().map((item2) => item2.getId());
|
|
51645
51659
|
return JSON.stringify(selectedItems);
|
|
51646
51660
|
}
|
|
51647
51661
|
deserialize(serializedData) {
|
|
51648
51662
|
const selectedItems = JSON.parse(serializedData);
|
|
51649
51663
|
this.removeAll();
|
|
51650
51664
|
selectedItems.forEach((itemId) => {
|
|
51651
|
-
const
|
|
51652
|
-
if (
|
|
51653
|
-
this.items.add(
|
|
51665
|
+
const item2 = this.board.items.getById(itemId);
|
|
51666
|
+
if (item2) {
|
|
51667
|
+
this.items.add(item2);
|
|
51654
51668
|
}
|
|
51655
51669
|
});
|
|
51656
51670
|
}
|
|
@@ -51728,19 +51742,19 @@ class BoardSelection {
|
|
|
51728
51742
|
this.updateQueue.clear();
|
|
51729
51743
|
safeRequestAnimationFrame(this.updateScheduledObservers);
|
|
51730
51744
|
};
|
|
51731
|
-
itemObserver = (
|
|
51745
|
+
itemObserver = (item2) => {
|
|
51732
51746
|
if (!this.shouldPublish) {
|
|
51733
51747
|
return;
|
|
51734
51748
|
}
|
|
51735
51749
|
this.subject.publish(this);
|
|
51736
|
-
this.itemSubject.publish(
|
|
51750
|
+
this.itemSubject.publish(item2);
|
|
51737
51751
|
};
|
|
51738
51752
|
decoratedItemObserver = this.decorateObserverToScheduleUpdate(this.itemObserver);
|
|
51739
51753
|
add(value) {
|
|
51740
51754
|
this.items.add(value);
|
|
51741
51755
|
if (Array.isArray(value)) {
|
|
51742
|
-
for (const
|
|
51743
|
-
|
|
51756
|
+
for (const item2 of value) {
|
|
51757
|
+
item2.subject.subscribe(this.itemObserver);
|
|
51744
51758
|
}
|
|
51745
51759
|
} else {
|
|
51746
51760
|
value.subject.subscribe(this.itemObserver);
|
|
@@ -51749,15 +51763,15 @@ class BoardSelection {
|
|
|
51749
51763
|
this.itemsSubject.publish([]);
|
|
51750
51764
|
}
|
|
51751
51765
|
addAll() {
|
|
51752
|
-
const items = this.board.items.listAll().filter((
|
|
51766
|
+
const items = this.board.items.listAll().filter((item2) => !item2.transformation.isLocked);
|
|
51753
51767
|
this.add(items);
|
|
51754
51768
|
this.setContext("SelectByRect");
|
|
51755
51769
|
}
|
|
51756
51770
|
remove(value) {
|
|
51757
51771
|
this.items.remove(value);
|
|
51758
51772
|
if (Array.isArray(value)) {
|
|
51759
|
-
for (const
|
|
51760
|
-
|
|
51773
|
+
for (const item2 of value) {
|
|
51774
|
+
item2.subject.unsubscribe(this.itemObserver);
|
|
51761
51775
|
}
|
|
51762
51776
|
} else {
|
|
51763
51777
|
value.subject.unsubscribe(this.itemObserver);
|
|
@@ -51851,11 +51865,11 @@ class BoardSelection {
|
|
|
51851
51865
|
if (!this.items.isSingle()) {
|
|
51852
51866
|
return;
|
|
51853
51867
|
}
|
|
51854
|
-
const
|
|
51855
|
-
if (!
|
|
51868
|
+
const item2 = this.items.getSingle();
|
|
51869
|
+
if (!item2) {
|
|
51856
51870
|
return;
|
|
51857
51871
|
}
|
|
51858
|
-
const text5 =
|
|
51872
|
+
const text5 = item2.getRichText();
|
|
51859
51873
|
if (!text5) {
|
|
51860
51874
|
return;
|
|
51861
51875
|
}
|
|
@@ -51866,7 +51880,7 @@ class BoardSelection {
|
|
|
51866
51880
|
if (shouldReplace || moveCursorToEnd) {
|
|
51867
51881
|
text5.editor.moveCursorToEndOfTheText();
|
|
51868
51882
|
}
|
|
51869
|
-
this.setTextToEdit(
|
|
51883
|
+
this.setTextToEdit(item2);
|
|
51870
51884
|
this.setContext("EditTextUnderPointer");
|
|
51871
51885
|
if (shouldSelect) {
|
|
51872
51886
|
text5.editor.selectWholeText();
|
|
@@ -51876,13 +51890,13 @@ class BoardSelection {
|
|
|
51876
51890
|
editUnderPointer() {
|
|
51877
51891
|
this.removeAll();
|
|
51878
51892
|
const stack = this.board.items.getUnderPointer();
|
|
51879
|
-
const
|
|
51880
|
-
if (
|
|
51881
|
-
this.add(
|
|
51893
|
+
const item2 = stack.pop();
|
|
51894
|
+
if (item2) {
|
|
51895
|
+
this.add(item2);
|
|
51882
51896
|
this.setTextToEdit(undefined);
|
|
51883
|
-
const text5 =
|
|
51897
|
+
const text5 = item2.getRichText();
|
|
51884
51898
|
if (text5) {
|
|
51885
|
-
this.setTextToEdit(
|
|
51899
|
+
this.setTextToEdit(item2);
|
|
51886
51900
|
text5.editor.selectWholeText();
|
|
51887
51901
|
this.board.items.subject.publish(this.board.items);
|
|
51888
51902
|
}
|
|
@@ -51891,26 +51905,26 @@ class BoardSelection {
|
|
|
51891
51905
|
this.setContext("None");
|
|
51892
51906
|
}
|
|
51893
51907
|
}
|
|
51894
|
-
setTextToEdit(
|
|
51908
|
+
setTextToEdit(item2) {
|
|
51895
51909
|
if (this.textToEdit) {
|
|
51896
51910
|
this.textToEdit.updateElement();
|
|
51897
51911
|
this.textToEdit.enableRender();
|
|
51898
51912
|
}
|
|
51899
|
-
if (!(
|
|
51913
|
+
if (!(item2 && item2.getRichText())) {
|
|
51900
51914
|
this.textToEdit = undefined;
|
|
51901
51915
|
return;
|
|
51902
51916
|
}
|
|
51903
|
-
const text5 =
|
|
51917
|
+
const text5 = item2.getRichText();
|
|
51904
51918
|
if (!text5) {
|
|
51905
51919
|
return;
|
|
51906
51920
|
}
|
|
51907
51921
|
if (text5.isEmpty()) {
|
|
51908
|
-
const textColor = tempStorage.getFontColor(
|
|
51909
|
-
const textSize = tempStorage.getFontSize(
|
|
51910
|
-
const highlightColor = tempStorage.getFontHighlight(
|
|
51911
|
-
const styles = tempStorage.getFontStyles(
|
|
51912
|
-
const horizontalAlignment = tempStorage.getHorizontalAlignment(
|
|
51913
|
-
const verticalAlignment = tempStorage.getVerticalAlignment(
|
|
51922
|
+
const textColor = tempStorage.getFontColor(item2.itemType);
|
|
51923
|
+
const textSize = tempStorage.getFontSize(item2.itemType);
|
|
51924
|
+
const highlightColor = tempStorage.getFontHighlight(item2.itemType);
|
|
51925
|
+
const styles = tempStorage.getFontStyles(item2.itemType);
|
|
51926
|
+
const horizontalAlignment = tempStorage.getHorizontalAlignment(item2.itemType);
|
|
51927
|
+
const verticalAlignment = tempStorage.getVerticalAlignment(item2.itemType);
|
|
51914
51928
|
if (textColor) {
|
|
51915
51929
|
text5.setSelectionFontColor(textColor, "None");
|
|
51916
51930
|
}
|
|
@@ -51918,7 +51932,7 @@ class BoardSelection {
|
|
|
51918
51932
|
this.emit({
|
|
51919
51933
|
class: "RichText",
|
|
51920
51934
|
method: "setFontSize",
|
|
51921
|
-
item: [
|
|
51935
|
+
item: [item2.getId()],
|
|
51922
51936
|
fontSize: textSize,
|
|
51923
51937
|
context: this.getContext()
|
|
51924
51938
|
});
|
|
@@ -51930,10 +51944,10 @@ class BoardSelection {
|
|
|
51930
51944
|
const stylesArr = styles;
|
|
51931
51945
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
51932
51946
|
}
|
|
51933
|
-
if (horizontalAlignment && !(
|
|
51947
|
+
if (horizontalAlignment && !(item2 instanceof Sticker)) {
|
|
51934
51948
|
text5.setSelectionHorisontalAlignment(horizontalAlignment);
|
|
51935
51949
|
}
|
|
51936
|
-
if (verticalAlignment && !(
|
|
51950
|
+
if (verticalAlignment && !(item2 instanceof Sticker)) {
|
|
51937
51951
|
this.setVerticalAlignment(verticalAlignment);
|
|
51938
51952
|
}
|
|
51939
51953
|
}
|
|
@@ -51966,8 +51980,8 @@ class BoardSelection {
|
|
|
51966
51980
|
}
|
|
51967
51981
|
selectEnclosedOrCrossedBy(rect) {
|
|
51968
51982
|
this.removeAll();
|
|
51969
|
-
const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((
|
|
51970
|
-
const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((
|
|
51983
|
+
const enclosedFrames = this.board.items.getEnclosed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => !item2.transformation.isLocked);
|
|
51984
|
+
const list6 = this.board.items.getEnclosedOrCrossed(rect.left, rect.top, rect.right, rect.bottom).filter((item2) => (!(item2 instanceof Frame2) || enclosedFrames.includes(item2)) && !item2.transformation.isLocked);
|
|
51971
51985
|
if (list6.length !== 0) {
|
|
51972
51986
|
this.add(list6);
|
|
51973
51987
|
this.setContext("SelectByRect");
|
|
@@ -51981,14 +51995,14 @@ class BoardSelection {
|
|
|
51981
51995
|
canChangeText() {
|
|
51982
51996
|
return Boolean(this.items.isSingle() && this.items.getSingle()?.getRichText());
|
|
51983
51997
|
}
|
|
51984
|
-
handleItemCopy(
|
|
51985
|
-
const serializedData =
|
|
51986
|
-
const zIndex = this.board.items.index.getZIndex(
|
|
51987
|
-
if (
|
|
51998
|
+
handleItemCopy(item2, copiedItemsMap) {
|
|
51999
|
+
const serializedData = item2.serialize(true);
|
|
52000
|
+
const zIndex = this.board.items.index.getZIndex(item2);
|
|
52001
|
+
if (item2.itemType === "Comment") {
|
|
51988
52002
|
return;
|
|
51989
52003
|
}
|
|
51990
|
-
if (
|
|
51991
|
-
const connector =
|
|
52004
|
+
if (item2.itemType === "Connector" && serializedData.itemType === "Connector") {
|
|
52005
|
+
const connector = item2;
|
|
51992
52006
|
const startPoint = connector.getStartPoint();
|
|
51993
52007
|
const endPoint = connector.getEndPoint();
|
|
51994
52008
|
const startItemId = startPoint.pointType !== "Board" ? startPoint.item.getId() : null;
|
|
@@ -52004,19 +52018,19 @@ class BoardSelection {
|
|
|
52004
52018
|
serializedData.endPoint = new BoardPoint(endPoint.x, endPoint.y).serialize();
|
|
52005
52019
|
}
|
|
52006
52020
|
}
|
|
52007
|
-
const textItem =
|
|
52021
|
+
const textItem = item2.getRichText()?.getTextString();
|
|
52008
52022
|
const copyText = conf.i18n.t("frame.copy");
|
|
52009
52023
|
const isCopyTextExist = textItem?.includes(copyText);
|
|
52010
|
-
const isChangeCopiedFrameText =
|
|
52024
|
+
const isChangeCopiedFrameText = item2.itemType === "Frame" && serializedData.itemType === "Frame" && textItem !== "" && !isCopyTextExist;
|
|
52011
52025
|
if (isChangeCopiedFrameText) {
|
|
52012
52026
|
const copiedFrameText = copyText + (textItem || serializedData.text?.placeholderText);
|
|
52013
|
-
|
|
52014
|
-
|
|
52015
|
-
serializedData.text =
|
|
52016
|
-
|
|
52017
|
-
|
|
52027
|
+
item2.getRichText()?.editor.clearText();
|
|
52028
|
+
item2.getRichText()?.editor.addText(copiedFrameText);
|
|
52029
|
+
serializedData.text = item2.getRichText()?.serialize();
|
|
52030
|
+
item2.getRichText()?.editor.clearText();
|
|
52031
|
+
item2.getRichText()?.editor.addText(textItem || "");
|
|
52018
52032
|
}
|
|
52019
|
-
copiedItemsMap[
|
|
52033
|
+
copiedItemsMap[item2.getId()] = { ...serializedData, zIndex };
|
|
52020
52034
|
}
|
|
52021
52035
|
copy(skipImageBlobCopy) {
|
|
52022
52036
|
const copiedItemsMap = {};
|
|
@@ -52025,12 +52039,12 @@ class BoardSelection {
|
|
|
52025
52039
|
this.handleItemCopy(single, copiedItemsMap);
|
|
52026
52040
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
52027
52041
|
}
|
|
52028
|
-
this.list().forEach((
|
|
52029
|
-
this.handleItemCopy(
|
|
52042
|
+
this.list().forEach((item2) => {
|
|
52043
|
+
this.handleItemCopy(item2, copiedItemsMap);
|
|
52030
52044
|
});
|
|
52031
|
-
this.list().flatMap((
|
|
52032
|
-
if (
|
|
52033
|
-
return
|
|
52045
|
+
this.list().flatMap((item2) => {
|
|
52046
|
+
if (item2 instanceof Frame2) {
|
|
52047
|
+
return item2.getChildrenIds();
|
|
52034
52048
|
}
|
|
52035
52049
|
return [];
|
|
52036
52050
|
}).forEach((id) => {
|
|
@@ -52058,11 +52072,11 @@ class BoardSelection {
|
|
|
52058
52072
|
let maxRichText = null;
|
|
52059
52073
|
let minRichText = null;
|
|
52060
52074
|
const itemType = items[0].itemType;
|
|
52061
|
-
for (const
|
|
52062
|
-
if (
|
|
52075
|
+
for (const item2 of items) {
|
|
52076
|
+
if (item2.itemType !== itemType) {
|
|
52063
52077
|
return null;
|
|
52064
52078
|
}
|
|
52065
|
-
const richText =
|
|
52079
|
+
const richText = item2.getRichText();
|
|
52066
52080
|
if (richText) {
|
|
52067
52081
|
if (!maxRichText || richText.getFontSize() > maxRichText.getFontSize()) {
|
|
52068
52082
|
maxRichText = richText;
|
|
@@ -52168,22 +52182,22 @@ class BoardSelection {
|
|
|
52168
52182
|
}
|
|
52169
52183
|
nestSelectedItems(unselectedItem, checkFrames = true) {
|
|
52170
52184
|
const selected = this.board.selection.items.list();
|
|
52171
|
-
if (unselectedItem && !selected.find((
|
|
52185
|
+
if (unselectedItem && !selected.find((item2) => item2.getId() === unselectedItem.getId())) {
|
|
52172
52186
|
selected.push(unselectedItem);
|
|
52173
52187
|
}
|
|
52174
|
-
const selectedMbr = selected.reduce((acc,
|
|
52188
|
+
const selectedMbr = selected.reduce((acc, item2) => {
|
|
52175
52189
|
if (!acc) {
|
|
52176
|
-
return
|
|
52190
|
+
return item2.getMbr();
|
|
52177
52191
|
}
|
|
52178
|
-
return acc.combine(
|
|
52192
|
+
return acc.combine(item2.getMbr());
|
|
52179
52193
|
}, undefined);
|
|
52180
52194
|
if (selectedMbr) {
|
|
52181
|
-
const selectedMap = Object.fromEntries(selected.map((
|
|
52195
|
+
const selectedMap = Object.fromEntries(selected.map((item2) => [item2.getId(), { item: item2, nested: false }]));
|
|
52182
52196
|
const enclosedGroups = this.board.items.getGroupItemsEnclosedOrCrossed(selectedMbr?.left, selectedMbr?.top, selectedMbr?.right, selectedMbr?.bottom);
|
|
52183
52197
|
enclosedGroups.forEach((group) => {
|
|
52184
|
-
selected.forEach((
|
|
52185
|
-
if (group.handleNesting(
|
|
52186
|
-
selectedMap[
|
|
52198
|
+
selected.forEach((item2) => {
|
|
52199
|
+
if (group.handleNesting(item2)) {
|
|
52200
|
+
selectedMap[item2.getId()].nested = group;
|
|
52187
52201
|
}
|
|
52188
52202
|
});
|
|
52189
52203
|
});
|
|
@@ -52207,11 +52221,11 @@ class BoardSelection {
|
|
|
52207
52221
|
if (childrenIds && checkFrames) {
|
|
52208
52222
|
const currGroup = val.item;
|
|
52209
52223
|
const currMbr = currGroup.getMbr();
|
|
52210
|
-
const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((
|
|
52211
|
-
const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((
|
|
52224
|
+
const children = childrenIds.map((childId) => this.board.items.getById(childId)).filter((item2) => !!item2);
|
|
52225
|
+
const underGroup = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item2) => item2.parent === "Board" || item2.parent === currGroup.getId());
|
|
52212
52226
|
const uniqueItems = new Set;
|
|
52213
|
-
const toCheck = [...children, ...underGroup].filter((
|
|
52214
|
-
const id =
|
|
52227
|
+
const toCheck = [...children, ...underGroup].filter((item2) => {
|
|
52228
|
+
const id = item2.getId();
|
|
52215
52229
|
if (uniqueItems.has(id)) {
|
|
52216
52230
|
return false;
|
|
52217
52231
|
}
|
|
@@ -52252,8 +52266,8 @@ class BoardSelection {
|
|
|
52252
52266
|
addItemToTranslation(childId);
|
|
52253
52267
|
}
|
|
52254
52268
|
}
|
|
52255
|
-
const createTranslationWithComments = (
|
|
52256
|
-
const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() ===
|
|
52269
|
+
const createTranslationWithComments = (item2) => {
|
|
52270
|
+
const followedComments = this.board.items.getComments().filter((comment2) => comment2.getItemToFollow() === item2.getId());
|
|
52257
52271
|
for (const comment2 of followedComments) {
|
|
52258
52272
|
translation[comment2.getId()] = {
|
|
52259
52273
|
class: "Transformation",
|
|
@@ -52314,21 +52328,21 @@ class BoardSelection {
|
|
|
52314
52328
|
newData: { borderColor }
|
|
52315
52329
|
};
|
|
52316
52330
|
const operations2 = {};
|
|
52317
|
-
this.items.list().forEach((
|
|
52318
|
-
if (!operations2[
|
|
52331
|
+
this.items.list().forEach((item2) => {
|
|
52332
|
+
if (!operations2[item2.itemType]) {
|
|
52319
52333
|
const operationCopy = { ...operation };
|
|
52320
|
-
if (
|
|
52334
|
+
if (item2.itemType === "Connector") {
|
|
52321
52335
|
operationCopy.method = "setLineColor";
|
|
52322
52336
|
operationCopy.lineColor = borderColor;
|
|
52323
|
-
} else if (
|
|
52337
|
+
} else if (item2.itemType === "Drawing") {
|
|
52324
52338
|
operationCopy.method = "setStrokeColor";
|
|
52325
52339
|
operationCopy.color = borderColor;
|
|
52326
52340
|
} else {
|
|
52327
52341
|
operationCopy.borderColor = borderColor;
|
|
52328
52342
|
}
|
|
52329
|
-
operations2[
|
|
52343
|
+
operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
|
|
52330
52344
|
} else {
|
|
52331
|
-
operations2[
|
|
52345
|
+
operations2[item2.itemType].item.push(item2.getId());
|
|
52332
52346
|
}
|
|
52333
52347
|
});
|
|
52334
52348
|
Object.values(operations2).forEach((op) => {
|
|
@@ -52343,13 +52357,13 @@ class BoardSelection {
|
|
|
52343
52357
|
newData: { borderWidth: width2 }
|
|
52344
52358
|
};
|
|
52345
52359
|
const operations2 = {};
|
|
52346
|
-
this.items.list().forEach((
|
|
52347
|
-
if (!operations2[
|
|
52360
|
+
this.items.list().forEach((item2) => {
|
|
52361
|
+
if (!operations2[item2.itemType]) {
|
|
52348
52362
|
const operationCopy = { ...operation };
|
|
52349
|
-
if (
|
|
52363
|
+
if (item2.itemType === "Connector") {
|
|
52350
52364
|
operationCopy.method = "setLineWidth";
|
|
52351
52365
|
operationCopy.lineWidth = width2;
|
|
52352
|
-
} else if (
|
|
52366
|
+
} else if (item2.itemType === "Drawing") {
|
|
52353
52367
|
operationCopy.method = "setStrokeWidth";
|
|
52354
52368
|
operationCopy.width = width2;
|
|
52355
52369
|
operationCopy.prevWidth = this.getStrokeWidth();
|
|
@@ -52357,9 +52371,9 @@ class BoardSelection {
|
|
|
52357
52371
|
operationCopy.borderWidth = width2;
|
|
52358
52372
|
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
52359
52373
|
}
|
|
52360
|
-
operations2[
|
|
52374
|
+
operations2[item2.itemType] = { ...operationCopy, class: item2.itemType, item: [item2.getId()] };
|
|
52361
52375
|
} else {
|
|
52362
|
-
operations2[
|
|
52376
|
+
operations2[item2.itemType].item.push(item2.getId());
|
|
52363
52377
|
}
|
|
52364
52378
|
});
|
|
52365
52379
|
Object.values(operations2).forEach((op) => {
|
|
@@ -52375,11 +52389,11 @@ class BoardSelection {
|
|
|
52375
52389
|
newData: { backgroundColor }
|
|
52376
52390
|
};
|
|
52377
52391
|
const operations2 = {};
|
|
52378
|
-
this.items.list().forEach((
|
|
52379
|
-
if (!operations2[
|
|
52380
|
-
operations2[
|
|
52392
|
+
this.items.list().forEach((item2) => {
|
|
52393
|
+
if (!operations2[item2.itemType]) {
|
|
52394
|
+
operations2[item2.itemType] = { ...operation, class: item2.itemType, item: [item2.getId()] };
|
|
52381
52395
|
} else {
|
|
52382
|
-
operations2[
|
|
52396
|
+
operations2[item2.itemType].item.push(item2.getId());
|
|
52383
52397
|
}
|
|
52384
52398
|
});
|
|
52385
52399
|
Object.values(operations2).forEach((op) => {
|
|
@@ -52403,9 +52417,9 @@ class BoardSelection {
|
|
|
52403
52417
|
}
|
|
52404
52418
|
setFrameType(frameType) {
|
|
52405
52419
|
const items = this.items.list();
|
|
52406
|
-
items.forEach((
|
|
52407
|
-
if (
|
|
52408
|
-
|
|
52420
|
+
items.forEach((item2) => {
|
|
52421
|
+
if (item2 instanceof Frame2) {
|
|
52422
|
+
item2.setFrameType(frameType);
|
|
52409
52423
|
}
|
|
52410
52424
|
});
|
|
52411
52425
|
}
|
|
@@ -52424,21 +52438,21 @@ class BoardSelection {
|
|
|
52424
52438
|
setFontSize(size) {
|
|
52425
52439
|
const fontSize = size === "auto" ? size : toFiniteNumber(size);
|
|
52426
52440
|
const itemsOps = [];
|
|
52427
|
-
for (const
|
|
52428
|
-
const text5 =
|
|
52441
|
+
for (const item2 of this.items.list()) {
|
|
52442
|
+
const text5 = item2.getRichText();
|
|
52429
52443
|
if (!text5) {
|
|
52430
52444
|
continue;
|
|
52431
52445
|
}
|
|
52432
52446
|
const ops = text5.setSelectionFontSize(fontSize, this.context);
|
|
52433
52447
|
itemsOps.push({
|
|
52434
|
-
item:
|
|
52448
|
+
item: item2.getId(),
|
|
52435
52449
|
selection: text5.editor.getSelection(),
|
|
52436
52450
|
ops
|
|
52437
52451
|
});
|
|
52438
|
-
if (
|
|
52439
|
-
tempStorage.remove(`fontSize_${
|
|
52440
|
-
} else if (
|
|
52441
|
-
tempStorage.setFontSize(
|
|
52452
|
+
if (item2.itemType === "Sticker" && fontSize === "auto") {
|
|
52453
|
+
tempStorage.remove(`fontSize_${item2.itemType}`);
|
|
52454
|
+
} else if (item2.itemType !== "AINode") {
|
|
52455
|
+
tempStorage.setFontSize(item2.itemType, fontSize);
|
|
52442
52456
|
}
|
|
52443
52457
|
}
|
|
52444
52458
|
const emptyOps = itemsOps.filter((op) => !op.ops.length);
|
|
@@ -52461,8 +52475,8 @@ class BoardSelection {
|
|
|
52461
52475
|
setFontStyle(fontStyle) {
|
|
52462
52476
|
const isMultiple = !this.items.isSingle();
|
|
52463
52477
|
const itemsOps = [];
|
|
52464
|
-
for (const
|
|
52465
|
-
const text5 =
|
|
52478
|
+
for (const item2 of this.items.list()) {
|
|
52479
|
+
const text5 = item2.getRichText();
|
|
52466
52480
|
if (!text5) {
|
|
52467
52481
|
continue;
|
|
52468
52482
|
}
|
|
@@ -52471,12 +52485,12 @@ class BoardSelection {
|
|
|
52471
52485
|
}
|
|
52472
52486
|
const ops = text5.setSelectionFontStyle(fontStyle, this.context);
|
|
52473
52487
|
itemsOps.push({
|
|
52474
|
-
item:
|
|
52488
|
+
item: item2.getId(),
|
|
52475
52489
|
selection: text5.editor.getSelection(),
|
|
52476
52490
|
ops
|
|
52477
52491
|
});
|
|
52478
|
-
if (
|
|
52479
|
-
tempStorage.setFontStyles(
|
|
52492
|
+
if (item2.itemType !== "AINode") {
|
|
52493
|
+
tempStorage.setFontStyles(item2.itemType, text5.getFontStyles());
|
|
52480
52494
|
}
|
|
52481
52495
|
}
|
|
52482
52496
|
this.emitApplied({
|
|
@@ -52488,8 +52502,8 @@ class BoardSelection {
|
|
|
52488
52502
|
setFontColor(fontColor) {
|
|
52489
52503
|
const isMultiple = !this.items.isSingle();
|
|
52490
52504
|
const itemsOps = [];
|
|
52491
|
-
for (const
|
|
52492
|
-
const text5 =
|
|
52505
|
+
for (const item2 of this.items.list()) {
|
|
52506
|
+
const text5 = item2.getRichText();
|
|
52493
52507
|
if (!text5) {
|
|
52494
52508
|
continue;
|
|
52495
52509
|
}
|
|
@@ -52498,11 +52512,11 @@ class BoardSelection {
|
|
|
52498
52512
|
}
|
|
52499
52513
|
const ops = text5.setSelectionFontColor(fontColor, this.context);
|
|
52500
52514
|
itemsOps.push({
|
|
52501
|
-
item:
|
|
52515
|
+
item: item2.getId(),
|
|
52502
52516
|
selection: text5.editor.getSelection(),
|
|
52503
52517
|
ops
|
|
52504
52518
|
});
|
|
52505
|
-
tempStorage.setFontColor(
|
|
52519
|
+
tempStorage.setFontColor(item2.itemType, fontColor);
|
|
52506
52520
|
}
|
|
52507
52521
|
this.emitApplied({
|
|
52508
52522
|
class: "RichText",
|
|
@@ -52531,8 +52545,8 @@ class BoardSelection {
|
|
|
52531
52545
|
setFontHighlight(fontHighlight) {
|
|
52532
52546
|
const isMultiple = !this.items.isSingle();
|
|
52533
52547
|
const itemsOps = [];
|
|
52534
|
-
for (const
|
|
52535
|
-
const text5 =
|
|
52548
|
+
for (const item2 of this.items.list()) {
|
|
52549
|
+
const text5 = item2.getRichText();
|
|
52536
52550
|
if (!text5) {
|
|
52537
52551
|
continue;
|
|
52538
52552
|
}
|
|
@@ -52541,12 +52555,12 @@ class BoardSelection {
|
|
|
52541
52555
|
}
|
|
52542
52556
|
const ops = text5.setSelectionFontHighlight(fontHighlight, this.context);
|
|
52543
52557
|
itemsOps.push({
|
|
52544
|
-
item:
|
|
52558
|
+
item: item2.getId(),
|
|
52545
52559
|
selection: text5.editor.getSelection(),
|
|
52546
52560
|
ops
|
|
52547
52561
|
});
|
|
52548
|
-
if (
|
|
52549
|
-
tempStorage.setFontHighlight(
|
|
52562
|
+
if (item2.itemType !== "AINode") {
|
|
52563
|
+
tempStorage.setFontHighlight(item2.itemType, fontHighlight);
|
|
52550
52564
|
}
|
|
52551
52565
|
}
|
|
52552
52566
|
this.emitApplied({
|
|
@@ -52558,8 +52572,8 @@ class BoardSelection {
|
|
|
52558
52572
|
setHorisontalAlignment(horisontalAlignment) {
|
|
52559
52573
|
const isMultiple = !this.items.isSingle();
|
|
52560
52574
|
const itemsOps = [];
|
|
52561
|
-
for (const
|
|
52562
|
-
const text5 =
|
|
52575
|
+
for (const item2 of this.items.list()) {
|
|
52576
|
+
const text5 = item2.getRichText();
|
|
52563
52577
|
if (!text5) {
|
|
52564
52578
|
continue;
|
|
52565
52579
|
}
|
|
@@ -52568,11 +52582,11 @@ class BoardSelection {
|
|
|
52568
52582
|
}
|
|
52569
52583
|
const ops = text5.setSelectionHorisontalAlignment(horisontalAlignment, this.context);
|
|
52570
52584
|
itemsOps.push({
|
|
52571
|
-
item:
|
|
52585
|
+
item: item2.getId(),
|
|
52572
52586
|
selection: text5.editor.getSelection(),
|
|
52573
52587
|
ops
|
|
52574
52588
|
});
|
|
52575
|
-
tempStorage.setHorizontalAlignment(
|
|
52589
|
+
tempStorage.setHorizontalAlignment(item2.itemType, horisontalAlignment);
|
|
52576
52590
|
}
|
|
52577
52591
|
this.emitApplied({
|
|
52578
52592
|
class: "RichText",
|
|
@@ -52588,23 +52602,23 @@ class BoardSelection {
|
|
|
52588
52602
|
verticalAlignment
|
|
52589
52603
|
});
|
|
52590
52604
|
if (this.items.isSingle()) {
|
|
52591
|
-
const
|
|
52592
|
-
if (!
|
|
52605
|
+
const item2 = this.items.getSingle();
|
|
52606
|
+
if (!item2) {
|
|
52593
52607
|
return;
|
|
52594
52608
|
}
|
|
52595
|
-
const text5 =
|
|
52609
|
+
const text5 = item2.getRichText();
|
|
52596
52610
|
if (!text5) {
|
|
52597
52611
|
return;
|
|
52598
52612
|
}
|
|
52599
|
-
tempStorage.setVerticalAlignment(
|
|
52600
|
-
if (
|
|
52601
|
-
|
|
52613
|
+
tempStorage.setVerticalAlignment(item2.itemType, verticalAlignment);
|
|
52614
|
+
if (item2 instanceof RichText) {
|
|
52615
|
+
item2.setEditorFocus(this.context);
|
|
52602
52616
|
}
|
|
52603
52617
|
text5.setEditorFocus(this.context);
|
|
52604
52618
|
}
|
|
52605
52619
|
}
|
|
52606
52620
|
removeFromBoard() {
|
|
52607
|
-
const isLocked = this.items.list().some((
|
|
52621
|
+
const isLocked = this.items.list().some((item2) => item2.transformation.isLocked);
|
|
52608
52622
|
if (isLocked) {
|
|
52609
52623
|
return;
|
|
52610
52624
|
}
|
|
@@ -52627,7 +52641,7 @@ class BoardSelection {
|
|
|
52627
52641
|
}
|
|
52628
52642
|
getIsLockedSelection() {
|
|
52629
52643
|
const items = this.list();
|
|
52630
|
-
return items.some((
|
|
52644
|
+
return items.some((item2) => item2.transformation.isLocked);
|
|
52631
52645
|
}
|
|
52632
52646
|
isLocked() {
|
|
52633
52647
|
return false;
|
|
@@ -52654,9 +52668,9 @@ class BoardSelection {
|
|
|
52654
52668
|
}
|
|
52655
52669
|
async duplicate() {
|
|
52656
52670
|
const mediaIds = [];
|
|
52657
|
-
this.items.list().forEach((
|
|
52658
|
-
if ("getStorageId" in
|
|
52659
|
-
const storageId =
|
|
52671
|
+
this.items.list().forEach((item2) => {
|
|
52672
|
+
if ("getStorageId" in item2) {
|
|
52673
|
+
const storageId = item2.getStorageId();
|
|
52660
52674
|
if (storageId) {
|
|
52661
52675
|
mediaIds.push(storageId);
|
|
52662
52676
|
}
|
|
@@ -52666,7 +52680,7 @@ class BoardSelection {
|
|
|
52666
52680
|
if (!canDuplicate) {
|
|
52667
52681
|
return;
|
|
52668
52682
|
}
|
|
52669
|
-
const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_,
|
|
52683
|
+
const filteredItemMap = Object.fromEntries(Object.entries(this.copy(true)).filter(([_, item2]) => item2.itemType !== "Group"));
|
|
52670
52684
|
this.board.duplicate(filteredItemMap);
|
|
52671
52685
|
this.setContext("EditUnderPointer");
|
|
52672
52686
|
}
|
|
@@ -52700,10 +52714,10 @@ class BoardSelection {
|
|
|
52700
52714
|
lastAssistantMessageId
|
|
52701
52715
|
};
|
|
52702
52716
|
}
|
|
52703
|
-
renderItemMbr(context,
|
|
52704
|
-
const mbr =
|
|
52717
|
+
renderItemMbr(context, item2, customScale) {
|
|
52718
|
+
const mbr = item2.getMbr();
|
|
52705
52719
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
52706
|
-
const selectionColor =
|
|
52720
|
+
const selectionColor = item2.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
52707
52721
|
mbr.borderColor = selectionColor;
|
|
52708
52722
|
mbr.render(context);
|
|
52709
52723
|
}
|
|
@@ -52719,8 +52733,8 @@ class BoardSelection {
|
|
|
52719
52733
|
}
|
|
52720
52734
|
if (!this.transformationRenderBlock) {
|
|
52721
52735
|
if (this.shouldRenderItemsMbr) {
|
|
52722
|
-
for (const
|
|
52723
|
-
this.renderItemMbr(context,
|
|
52736
|
+
for (const item2 of this.items.list()) {
|
|
52737
|
+
this.renderItemMbr(context, item2);
|
|
52724
52738
|
}
|
|
52725
52739
|
}
|
|
52726
52740
|
this.tool.render(context);
|
|
@@ -52732,7 +52746,7 @@ class BoardSelection {
|
|
|
52732
52746
|
if (single && single instanceof AINode) {
|
|
52733
52747
|
const contextItemsIds = single.getContextItems();
|
|
52734
52748
|
if (contextItemsIds.length) {
|
|
52735
|
-
const newContextItems = this.board.items.listAll().filter((
|
|
52749
|
+
const newContextItems = this.board.items.listAll().filter((item2) => contextItemsIds.includes(item2.getId()));
|
|
52736
52750
|
contextItems.push(...newContextItems);
|
|
52737
52751
|
}
|
|
52738
52752
|
}
|
|
@@ -52750,15 +52764,15 @@ class BoardSelection {
|
|
|
52750
52764
|
}
|
|
52751
52765
|
}
|
|
52752
52766
|
}
|
|
52753
|
-
contextItems.forEach((
|
|
52754
|
-
if (
|
|
52755
|
-
const path2 =
|
|
52767
|
+
contextItems.forEach((item2) => {
|
|
52768
|
+
if (item2 instanceof AINode) {
|
|
52769
|
+
const path2 = item2.getPath();
|
|
52756
52770
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
52757
52771
|
path2.setBorderWidth(2);
|
|
52758
52772
|
path2.setBackgroundColor("none");
|
|
52759
52773
|
path2.render(context);
|
|
52760
52774
|
} else {
|
|
52761
|
-
const itemRect =
|
|
52775
|
+
const itemRect = item2.getMbr();
|
|
52762
52776
|
itemRect.borderColor = CONTEXT_NODE_HIGHLIGHT_COLOR;
|
|
52763
52777
|
itemRect.strokeWidth = 2;
|
|
52764
52778
|
itemRect.render(context);
|
|
@@ -53259,16 +53273,16 @@ class Board {
|
|
|
53259
53273
|
applyBoardOperation(op) {
|
|
53260
53274
|
switch (op.method) {
|
|
53261
53275
|
case "moveToZIndex": {
|
|
53262
|
-
const
|
|
53263
|
-
if (!
|
|
53276
|
+
const item2 = this.index.getById(op.item);
|
|
53277
|
+
if (!item2) {
|
|
53264
53278
|
return;
|
|
53265
53279
|
}
|
|
53266
|
-
return this.index.moveToZIndex(
|
|
53280
|
+
return this.index.moveToZIndex(item2, op.zIndex);
|
|
53267
53281
|
}
|
|
53268
53282
|
case "moveManyToZIndex": {
|
|
53269
53283
|
for (const id in op.item) {
|
|
53270
|
-
const
|
|
53271
|
-
if (!
|
|
53284
|
+
const item2 = this.items.getById(id);
|
|
53285
|
+
if (!item2) {
|
|
53272
53286
|
delete op.item.id;
|
|
53273
53287
|
}
|
|
53274
53288
|
}
|
|
@@ -53290,11 +53304,11 @@ class Board {
|
|
|
53290
53304
|
}
|
|
53291
53305
|
return this.index.moveSecondAfterFirst(first, second);
|
|
53292
53306
|
case "bringToFront": {
|
|
53293
|
-
const items = op.item.map((
|
|
53307
|
+
const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
|
|
53294
53308
|
return this.index.bringManyToFront(items);
|
|
53295
53309
|
}
|
|
53296
53310
|
case "sendToBack": {
|
|
53297
|
-
const items = op.item.map((
|
|
53311
|
+
const items = op.item.map((item2) => this.items.getById(item2)).filter((item2) => item2 !== undefined);
|
|
53298
53312
|
return this.index.sendManyToBack(items);
|
|
53299
53313
|
}
|
|
53300
53314
|
case "add":
|
|
@@ -53318,82 +53332,82 @@ class Board {
|
|
|
53318
53332
|
applyAddItems(op) {
|
|
53319
53333
|
if (Array.isArray(op.item)) {
|
|
53320
53334
|
const data = op.data;
|
|
53321
|
-
const items = op.item.map((
|
|
53322
|
-
const created = this.createItem(
|
|
53335
|
+
const items = op.item.map((item3) => {
|
|
53336
|
+
const created = this.createItem(item3, data[item3]);
|
|
53323
53337
|
this.index.insert(created);
|
|
53324
53338
|
return created;
|
|
53325
53339
|
});
|
|
53326
|
-
items.forEach((
|
|
53327
|
-
if (
|
|
53328
|
-
const connectorData = data[
|
|
53329
|
-
|
|
53330
|
-
|
|
53340
|
+
items.forEach((item3) => {
|
|
53341
|
+
if (item3 instanceof Connector2 && data[item3.getId()]) {
|
|
53342
|
+
const connectorData = data[item3.getId()];
|
|
53343
|
+
item3.applyStartPoint(connectorData.startPoint);
|
|
53344
|
+
item3.applyEndPoint(connectorData.endPoint);
|
|
53331
53345
|
}
|
|
53332
53346
|
});
|
|
53333
53347
|
return;
|
|
53334
53348
|
}
|
|
53335
|
-
const
|
|
53336
|
-
return this.index.insert(
|
|
53349
|
+
const item2 = this.createItem(op.item, op.data);
|
|
53350
|
+
return this.index.insert(item2);
|
|
53337
53351
|
}
|
|
53338
53352
|
applyAddLockedGroupOperation(op) {
|
|
53339
|
-
const
|
|
53340
|
-
const groupChildrenIds =
|
|
53341
|
-
this.index.insert(
|
|
53353
|
+
const item2 = this.createItem(op.item, op.data);
|
|
53354
|
+
const groupChildrenIds = item2.getChildrenIds();
|
|
53355
|
+
this.index.insert(item2);
|
|
53342
53356
|
const lastChildrenId = this.index.getById(groupChildrenIds[groupChildrenIds.length - 1]);
|
|
53343
53357
|
if (lastChildrenId) {
|
|
53344
53358
|
const zIndex = this.index.getZIndex(lastChildrenId) + 1;
|
|
53345
|
-
this.index.moveToZIndex(
|
|
53359
|
+
this.index.moveToZIndex(item2, zIndex);
|
|
53346
53360
|
}
|
|
53347
|
-
|
|
53348
|
-
|
|
53361
|
+
item2.getChildren().forEach((item3) => {
|
|
53362
|
+
item3.transformation.isLocked = true;
|
|
53349
53363
|
});
|
|
53350
|
-
|
|
53364
|
+
item2.transformation.isLocked = true;
|
|
53351
53365
|
}
|
|
53352
53366
|
applyRemoveOperation(op) {
|
|
53353
53367
|
const removedItems = [];
|
|
53354
|
-
this.findItemAndApply(op.item, (
|
|
53355
|
-
this.index.remove(
|
|
53356
|
-
this.selection.remove(
|
|
53357
|
-
if (
|
|
53358
|
-
|
|
53368
|
+
this.findItemAndApply(op.item, (item2) => {
|
|
53369
|
+
this.index.remove(item2);
|
|
53370
|
+
this.selection.remove(item2);
|
|
53371
|
+
if (item2 instanceof Connector2) {
|
|
53372
|
+
item2.clearObservedItems();
|
|
53359
53373
|
}
|
|
53360
|
-
removedItems.push(
|
|
53374
|
+
removedItems.push(item2);
|
|
53361
53375
|
});
|
|
53362
53376
|
}
|
|
53363
53377
|
applyRemoveLockedGroupOperation(op) {
|
|
53364
|
-
const
|
|
53365
|
-
if (!
|
|
53378
|
+
const item2 = this.index.getById(op.item[0]);
|
|
53379
|
+
if (!item2 || !(item2 instanceof Group)) {
|
|
53366
53380
|
return;
|
|
53367
53381
|
}
|
|
53368
|
-
|
|
53369
|
-
|
|
53370
|
-
|
|
53382
|
+
item2.getChildren().forEach((item3) => {
|
|
53383
|
+
item3.transformation.isLocked = false;
|
|
53384
|
+
item3.parent = "Board";
|
|
53371
53385
|
});
|
|
53372
|
-
|
|
53386
|
+
item2.transformation.isLocked = false;
|
|
53373
53387
|
const removedItems = [];
|
|
53374
|
-
this.findItemAndApply(op.item, (
|
|
53375
|
-
this.index.remove(
|
|
53376
|
-
this.selection.remove(
|
|
53377
|
-
removedItems.push(
|
|
53388
|
+
this.findItemAndApply(op.item, (item3) => {
|
|
53389
|
+
this.index.remove(item3);
|
|
53390
|
+
this.selection.remove(item3);
|
|
53391
|
+
removedItems.push(item3);
|
|
53378
53392
|
});
|
|
53379
53393
|
}
|
|
53380
53394
|
applyItemOperation(op) {
|
|
53381
53395
|
if ("item" in op) {
|
|
53382
|
-
this.findItemAndApply(op.item, (
|
|
53383
|
-
|
|
53396
|
+
this.findItemAndApply(op.item, (item2) => {
|
|
53397
|
+
item2.apply(op);
|
|
53384
53398
|
});
|
|
53385
53399
|
}
|
|
53386
53400
|
}
|
|
53387
|
-
findItemAndApply(
|
|
53388
|
-
if (Array.isArray(
|
|
53389
|
-
for (const itemId of
|
|
53401
|
+
findItemAndApply(item2, apply) {
|
|
53402
|
+
if (Array.isArray(item2)) {
|
|
53403
|
+
for (const itemId of item2) {
|
|
53390
53404
|
const found = this.items.findById(itemId);
|
|
53391
53405
|
if (found) {
|
|
53392
53406
|
apply(found);
|
|
53393
53407
|
}
|
|
53394
53408
|
}
|
|
53395
53409
|
} else {
|
|
53396
|
-
const found = this.items.findById(
|
|
53410
|
+
const found = this.items.findById(item2);
|
|
53397
53411
|
if (found) {
|
|
53398
53412
|
apply(found);
|
|
53399
53413
|
}
|
|
@@ -53402,9 +53416,9 @@ class Board {
|
|
|
53402
53416
|
handleNesting(items) {
|
|
53403
53417
|
const arrayed = Array.isArray(items) ? items : [items];
|
|
53404
53418
|
const groupsMap = new Map;
|
|
53405
|
-
arrayed.forEach((
|
|
53406
|
-
const itemCenter =
|
|
53407
|
-
const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(
|
|
53419
|
+
arrayed.forEach((item2) => {
|
|
53420
|
+
const itemCenter = item2.getMbr().getCenter();
|
|
53421
|
+
const groupItem = this.items.getGroupItemsInView().filter((groupItem2) => groupItem2.handleNesting(item2)).reduce((acc, groupItem2) => {
|
|
53408
53422
|
if (!acc || groupItem2.getDistanceToPoint(itemCenter) > acc.getDistanceToPoint(itemCenter)) {
|
|
53409
53423
|
acc = groupItem2;
|
|
53410
53424
|
}
|
|
@@ -53414,7 +53428,7 @@ class Board {
|
|
|
53414
53428
|
if (!groupsMap.has(groupItem)) {
|
|
53415
53429
|
groupsMap.set(groupItem, []);
|
|
53416
53430
|
}
|
|
53417
|
-
groupsMap.get(groupItem)?.push(
|
|
53431
|
+
groupsMap.get(groupItem)?.push(item2);
|
|
53418
53432
|
}
|
|
53419
53433
|
});
|
|
53420
53434
|
groupsMap.forEach((items2, group) => {
|
|
@@ -53435,13 +53449,13 @@ class Board {
|
|
|
53435
53449
|
}
|
|
53436
53450
|
return parser(el);
|
|
53437
53451
|
}
|
|
53438
|
-
add(
|
|
53452
|
+
add(item2, timeStamp) {
|
|
53439
53453
|
const id = this.getNewItemId();
|
|
53440
53454
|
this.emit({
|
|
53441
53455
|
class: "Board",
|
|
53442
53456
|
method: "add",
|
|
53443
53457
|
item: id,
|
|
53444
|
-
data:
|
|
53458
|
+
data: item2.serialize(),
|
|
53445
53459
|
timeStamp
|
|
53446
53460
|
});
|
|
53447
53461
|
const newItem = this.items.getById(id);
|
|
@@ -53451,13 +53465,13 @@ class Board {
|
|
|
53451
53465
|
this.handleNesting(newItem);
|
|
53452
53466
|
return newItem;
|
|
53453
53467
|
}
|
|
53454
|
-
addLockedGroup(
|
|
53468
|
+
addLockedGroup(item2) {
|
|
53455
53469
|
const id = this.getNewItemId();
|
|
53456
53470
|
this.emit({
|
|
53457
53471
|
class: "Board",
|
|
53458
53472
|
method: "addLockedGroup",
|
|
53459
53473
|
item: id,
|
|
53460
|
-
data:
|
|
53474
|
+
data: item2.serialize()
|
|
53461
53475
|
});
|
|
53462
53476
|
const newItem = this.items.getById(id);
|
|
53463
53477
|
if (!newItem) {
|
|
@@ -53466,32 +53480,32 @@ class Board {
|
|
|
53466
53480
|
this.handleNesting(newItem);
|
|
53467
53481
|
return newItem;
|
|
53468
53482
|
}
|
|
53469
|
-
remove(
|
|
53483
|
+
remove(item2, withConnectors = true) {
|
|
53470
53484
|
let connectors = [];
|
|
53471
53485
|
if (withConnectors) {
|
|
53472
|
-
connectors = this.items.getLinkedConnectorsById(
|
|
53486
|
+
connectors = this.items.getLinkedConnectorsById(item2.getId()).map((connector) => connector.getId());
|
|
53473
53487
|
}
|
|
53474
|
-
if ("onRemove" in
|
|
53475
|
-
|
|
53488
|
+
if ("onRemove" in item2) {
|
|
53489
|
+
item2.onRemove();
|
|
53476
53490
|
}
|
|
53477
53491
|
this.emit({
|
|
53478
53492
|
class: "Board",
|
|
53479
53493
|
method: "remove",
|
|
53480
|
-
item: [
|
|
53494
|
+
item: [item2.getId(), ...connectors]
|
|
53481
53495
|
});
|
|
53482
53496
|
}
|
|
53483
|
-
removeLockedGroup(
|
|
53497
|
+
removeLockedGroup(item2) {
|
|
53484
53498
|
this.emit({
|
|
53485
53499
|
class: "Board",
|
|
53486
53500
|
method: "removeLockedGroup",
|
|
53487
|
-
item: [
|
|
53501
|
+
item: [item2.getId()]
|
|
53488
53502
|
});
|
|
53489
53503
|
}
|
|
53490
53504
|
getByZIndex(index2) {
|
|
53491
53505
|
return this.index.getByZIndex(index2);
|
|
53492
53506
|
}
|
|
53493
|
-
getZIndex(
|
|
53494
|
-
return this.index.getZIndex(
|
|
53507
|
+
getZIndex(item2) {
|
|
53508
|
+
return this.index.getZIndex(item2);
|
|
53495
53509
|
}
|
|
53496
53510
|
getLastZIndex() {
|
|
53497
53511
|
return this.index.getLastZIndex();
|
|
@@ -53503,11 +53517,11 @@ class Board {
|
|
|
53503
53517
|
item: items
|
|
53504
53518
|
});
|
|
53505
53519
|
}
|
|
53506
|
-
moveToZIndex(
|
|
53520
|
+
moveToZIndex(item2, zIndex) {
|
|
53507
53521
|
this.emit({
|
|
53508
53522
|
class: "Board",
|
|
53509
53523
|
method: "moveToZIndex",
|
|
53510
|
-
item:
|
|
53524
|
+
item: item2.getId(),
|
|
53511
53525
|
zIndex
|
|
53512
53526
|
});
|
|
53513
53527
|
}
|
|
@@ -53535,8 +53549,8 @@ class Board {
|
|
|
53535
53549
|
this.emit({
|
|
53536
53550
|
class: "Board",
|
|
53537
53551
|
method: "bringToFront",
|
|
53538
|
-
item: items.map((
|
|
53539
|
-
prevZIndex: Object.fromEntries(boardItems.map((
|
|
53552
|
+
item: items.map((item2) => item2.getId()),
|
|
53553
|
+
prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
|
|
53540
53554
|
});
|
|
53541
53555
|
}
|
|
53542
53556
|
sendToBack(items) {
|
|
@@ -53547,8 +53561,8 @@ class Board {
|
|
|
53547
53561
|
this.emit({
|
|
53548
53562
|
class: "Board",
|
|
53549
53563
|
method: "sendToBack",
|
|
53550
|
-
item: items.map((
|
|
53551
|
-
prevZIndex: Object.fromEntries(boardItems.map((
|
|
53564
|
+
item: items.map((item2) => item2.getId()),
|
|
53565
|
+
prevZIndex: Object.fromEntries(boardItems.map((item2) => [item2.getId(), boardItems.indexOf(item2)]))
|
|
53552
53566
|
});
|
|
53553
53567
|
}
|
|
53554
53568
|
copy() {
|
|
@@ -53625,7 +53639,7 @@ class Board {
|
|
|
53625
53639
|
return added;
|
|
53626
53640
|
});
|
|
53627
53641
|
addedFrame.addChildItems(addedChildren);
|
|
53628
|
-
parsedData.data.children = addedChildren.map((
|
|
53642
|
+
parsedData.data.children = addedChildren.map((item2) => item2.getId());
|
|
53629
53643
|
idsMap[parsedData.data.id] = addedFrame.getId();
|
|
53630
53644
|
} else {
|
|
53631
53645
|
const added = this.add(this.createItem(this.getNewItemId(), parsedData));
|
|
@@ -53666,15 +53680,15 @@ class Board {
|
|
|
53666
53680
|
const createdConnectors = {};
|
|
53667
53681
|
const createdFrames = {};
|
|
53668
53682
|
const addItem = (itemData) => {
|
|
53669
|
-
const
|
|
53670
|
-
if (
|
|
53671
|
-
createdConnectors[itemData.id] = { item, itemData };
|
|
53683
|
+
const item2 = this.createItem(itemData.id, itemData);
|
|
53684
|
+
if (item2 instanceof Connector2) {
|
|
53685
|
+
createdConnectors[itemData.id] = { item: item2, itemData };
|
|
53672
53686
|
}
|
|
53673
|
-
if (
|
|
53674
|
-
createdFrames[
|
|
53687
|
+
if (item2 instanceof Frame2) {
|
|
53688
|
+
createdFrames[item2.getId()] = { item: item2, itemData };
|
|
53675
53689
|
}
|
|
53676
|
-
this.index.insert(
|
|
53677
|
-
return
|
|
53690
|
+
this.index.insert(item2);
|
|
53691
|
+
return item2;
|
|
53678
53692
|
};
|
|
53679
53693
|
for (const itemData of items) {
|
|
53680
53694
|
if ("childrenMap" in itemData) {
|
|
@@ -53685,13 +53699,13 @@ class Board {
|
|
|
53685
53699
|
}
|
|
53686
53700
|
}
|
|
53687
53701
|
for (const key in createdConnectors) {
|
|
53688
|
-
const { item, itemData } = createdConnectors[key];
|
|
53689
|
-
|
|
53690
|
-
|
|
53702
|
+
const { item: item2, itemData } = createdConnectors[key];
|
|
53703
|
+
item2.applyStartPoint(itemData.startPoint);
|
|
53704
|
+
item2.applyEndPoint(itemData.endPoint);
|
|
53691
53705
|
}
|
|
53692
53706
|
for (const key in createdFrames) {
|
|
53693
|
-
const { item, itemData } = createdFrames[key];
|
|
53694
|
-
|
|
53707
|
+
const { item: item2, itemData } = createdFrames[key];
|
|
53708
|
+
item2.applyAddChildren(itemData.children);
|
|
53695
53709
|
}
|
|
53696
53710
|
}
|
|
53697
53711
|
deserialize(snapshot) {
|
|
@@ -53701,33 +53715,33 @@ class Board {
|
|
|
53701
53715
|
const createdFrames = {};
|
|
53702
53716
|
if (Array.isArray(items)) {
|
|
53703
53717
|
for (const itemData of items) {
|
|
53704
|
-
const
|
|
53705
|
-
if (
|
|
53706
|
-
createdConnectors[itemData.id] = { item, itemData };
|
|
53718
|
+
const item2 = this.createItem(itemData.id, itemData);
|
|
53719
|
+
if (item2 instanceof Connector2) {
|
|
53720
|
+
createdConnectors[itemData.id] = { item: item2, itemData };
|
|
53707
53721
|
}
|
|
53708
|
-
if (
|
|
53709
|
-
createdFrames[
|
|
53722
|
+
if (item2 instanceof Frame2) {
|
|
53723
|
+
createdFrames[item2.getId()] = { item: item2, itemData };
|
|
53710
53724
|
}
|
|
53711
|
-
this.index.insert(
|
|
53725
|
+
this.index.insert(item2);
|
|
53712
53726
|
}
|
|
53713
53727
|
} else {
|
|
53714
53728
|
for (const key in items) {
|
|
53715
53729
|
const itemData = items[key];
|
|
53716
|
-
const
|
|
53717
|
-
if (
|
|
53718
|
-
createdConnectors[key] = { item, itemData };
|
|
53730
|
+
const item2 = this.createItem(key, itemData);
|
|
53731
|
+
if (item2 instanceof Connector2) {
|
|
53732
|
+
createdConnectors[key] = { item: item2, itemData };
|
|
53719
53733
|
}
|
|
53720
|
-
this.index.insert(
|
|
53734
|
+
this.index.insert(item2);
|
|
53721
53735
|
}
|
|
53722
53736
|
}
|
|
53723
53737
|
for (const key in createdConnectors) {
|
|
53724
|
-
const { item, itemData } = createdConnectors[key];
|
|
53725
|
-
|
|
53726
|
-
|
|
53738
|
+
const { item: item2, itemData } = createdConnectors[key];
|
|
53739
|
+
item2.applyStartPoint(itemData.startPoint);
|
|
53740
|
+
item2.applyEndPoint(itemData.endPoint);
|
|
53727
53741
|
}
|
|
53728
53742
|
for (const key in createdFrames) {
|
|
53729
|
-
const { item, itemData } = createdFrames[key];
|
|
53730
|
-
|
|
53743
|
+
const { item: item2, itemData } = createdFrames[key];
|
|
53744
|
+
item2.applyAddChildren(itemData.children);
|
|
53731
53745
|
}
|
|
53732
53746
|
this.events?.log.deserialize(events);
|
|
53733
53747
|
}
|
|
@@ -53965,7 +53979,7 @@ class Board {
|
|
|
53965
53979
|
itemsMap: newMap,
|
|
53966
53980
|
select: select2
|
|
53967
53981
|
});
|
|
53968
|
-
const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((
|
|
53982
|
+
const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
|
|
53969
53983
|
this.handleNesting(items);
|
|
53970
53984
|
this.selection.removeAll();
|
|
53971
53985
|
this.selection.add(items);
|
|
@@ -53973,8 +53987,8 @@ class Board {
|
|
|
53973
53987
|
return;
|
|
53974
53988
|
}
|
|
53975
53989
|
removeVoidComments() {
|
|
53976
|
-
const voidComments = this.items.listAll().filter((
|
|
53977
|
-
return
|
|
53990
|
+
const voidComments = this.items.listAll().filter((item2) => {
|
|
53991
|
+
return item2 instanceof Comment && !item2.getThread().length;
|
|
53978
53992
|
});
|
|
53979
53993
|
if (voidComments) {
|
|
53980
53994
|
for (const comment2 of voidComments) {
|
|
@@ -54048,7 +54062,7 @@ class Board {
|
|
|
54048
54062
|
}
|
|
54049
54063
|
const mbr = this.selection.getMbr();
|
|
54050
54064
|
const selectedItems = this.selection.items.list();
|
|
54051
|
-
const isSelectedItemsMinWidth = selectedItems.some((
|
|
54065
|
+
const isSelectedItemsMinWidth = selectedItems.some((item2) => item2.getMbr().getWidth() === 0);
|
|
54052
54066
|
const right = mbr ? mbr.right : 0;
|
|
54053
54067
|
const top = mbr ? mbr.top : 0;
|
|
54054
54068
|
const width2 = mbr ? mbr.getWidth() / 10 : 10;
|
|
@@ -54090,7 +54104,7 @@ class Board {
|
|
|
54090
54104
|
method: "duplicate",
|
|
54091
54105
|
itemsMap: newMap
|
|
54092
54106
|
});
|
|
54093
|
-
const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((
|
|
54107
|
+
const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item2) => typeof item2 !== "undefined");
|
|
54094
54108
|
this.handleNesting(items);
|
|
54095
54109
|
this.selection.removeAll();
|
|
54096
54110
|
this.selection.add(items);
|
|
@@ -54111,9 +54125,9 @@ class Board {
|
|
|
54111
54125
|
if (data.itemType === "Frame") {
|
|
54112
54126
|
data.text.placeholderText = `Frame ${this.getMaxFrameSerial() + 1}`;
|
|
54113
54127
|
}
|
|
54114
|
-
const
|
|
54115
|
-
this.index.insert(
|
|
54116
|
-
items.push(
|
|
54128
|
+
const item2 = this.createItem(itemId, data);
|
|
54129
|
+
this.index.insert(item2);
|
|
54130
|
+
items.push(item2);
|
|
54117
54131
|
};
|
|
54118
54132
|
sortedItemsMap.map(([id, data]) => {
|
|
54119
54133
|
if (data.itemType === "Connector") {
|
|
@@ -54128,8 +54142,8 @@ class Board {
|
|
|
54128
54142
|
return;
|
|
54129
54143
|
});
|
|
54130
54144
|
}
|
|
54131
|
-
isOnBoard(
|
|
54132
|
-
return this.items.findById(
|
|
54145
|
+
isOnBoard(item2) {
|
|
54146
|
+
return this.items.findById(item2.getId()) !== undefined;
|
|
54133
54147
|
}
|
|
54134
54148
|
getMaxFrameSerial() {
|
|
54135
54149
|
const existingNames = this.items.listGroupItems().map((frame) => frame.getRichText()?.getTextString().length === 0 ? frame.getRichText()?.placeholderText || "" : frame.getRichText()?.getTextString() || "");
|
|
@@ -54175,7 +54189,7 @@ function areItemsTheSame(opA, opB) {
|
|
|
54175
54189
|
const itemsB = Object.keys(opB.items);
|
|
54176
54190
|
const setA = new Set(itemsA);
|
|
54177
54191
|
const setB = new Set(itemsB);
|
|
54178
|
-
const areArraysEqual = setA.size === setB.size && [...setA].every((
|
|
54192
|
+
const areArraysEqual = setA.size === setB.size && [...setA].every((item2) => setB.has(item2));
|
|
54179
54193
|
return areArraysEqual;
|
|
54180
54194
|
}
|
|
54181
54195
|
if (!(Array.isArray(opA.item) && Array.isArray(opB.item))) {
|
|
@@ -55834,9 +55848,9 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
|
|
|
55834
55848
|
list6.applyUnconfirmed(filter);
|
|
55835
55849
|
const hasAnyOverlap = (arr1, arr2) => {
|
|
55836
55850
|
const lookup9 = new Set(arr1);
|
|
55837
|
-
return arr2.some((
|
|
55851
|
+
return arr2.some((item2) => lookup9.has(item2));
|
|
55838
55852
|
};
|
|
55839
|
-
const currSelection = board.selection.list().map((
|
|
55853
|
+
const currSelection = board.selection.list().map((item2) => item2.getId());
|
|
55840
55854
|
if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
|
|
55841
55855
|
board.selection.applyMemoizedCaretOrRange();
|
|
55842
55856
|
}
|
|
@@ -56158,27 +56172,27 @@ function handleAiChatMassage(message, board) {
|
|
|
56158
56172
|
}
|
|
56159
56173
|
}
|
|
56160
56174
|
function handleChatChunk(chunk, board) {
|
|
56161
|
-
const
|
|
56175
|
+
const item2 = board.items.getById(chunk.itemId);
|
|
56162
56176
|
switch (chunk.type) {
|
|
56163
56177
|
case "chunk":
|
|
56164
|
-
if (!
|
|
56178
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
56165
56179
|
return;
|
|
56166
56180
|
}
|
|
56167
|
-
|
|
56181
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
|
|
56168
56182
|
break;
|
|
56169
56183
|
case "done":
|
|
56170
|
-
if (!
|
|
56184
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
56171
56185
|
board.aiGeneratingOnItem = undefined;
|
|
56172
56186
|
return;
|
|
56173
56187
|
}
|
|
56174
|
-
|
|
56188
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
56175
56189
|
break;
|
|
56176
56190
|
case "end":
|
|
56177
|
-
if (!
|
|
56191
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
56178
56192
|
board.aiGeneratingOnItem = undefined;
|
|
56179
56193
|
return;
|
|
56180
56194
|
}
|
|
56181
|
-
|
|
56195
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
56182
56196
|
break;
|
|
56183
56197
|
case "error":
|
|
56184
56198
|
default:
|
|
@@ -56195,7 +56209,7 @@ function handleChatChunk(chunk, board) {
|
|
|
56195
56209
|
if (board.aiGeneratingOnItem && generatingItem) {
|
|
56196
56210
|
board.selection.removeAll();
|
|
56197
56211
|
board.selection.add(generatingItem);
|
|
56198
|
-
const rt =
|
|
56212
|
+
const rt = item2?.getRichText();
|
|
56199
56213
|
if (generatingItem.itemType === "AINode" && rt) {
|
|
56200
56214
|
const editor = rt.editor;
|
|
56201
56215
|
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
@@ -56328,14 +56342,14 @@ function handleImageGenerate(response, board) {
|
|
|
56328
56342
|
console.error("Image generation error:", response.message);
|
|
56329
56343
|
if (response.isExternalApiError) {
|
|
56330
56344
|
if (board.aiGeneratingOnItem) {
|
|
56331
|
-
const
|
|
56332
|
-
if (
|
|
56345
|
+
const item2 = board.items.getById(board.aiGeneratingOnItem);
|
|
56346
|
+
if (item2) {
|
|
56333
56347
|
board.selection.removeAll();
|
|
56334
|
-
board.selection.add(
|
|
56335
|
-
const editor =
|
|
56348
|
+
board.selection.add(item2);
|
|
56349
|
+
const editor = item2.getRichText()?.editor;
|
|
56336
56350
|
editor?.clearText();
|
|
56337
56351
|
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
56338
|
-
board.camera.zoomToFit(
|
|
56352
|
+
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
56339
56353
|
}
|
|
56340
56354
|
}
|
|
56341
56355
|
} else {
|