microboard-temp 0.13.30 → 0.13.32
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 +55 -46
- package/dist/cjs/index.js +55 -46
- package/dist/cjs/node.js +55 -46
- package/dist/esm/browser.js +55 -46
- package/dist/esm/index.js +55 -46
- package/dist/esm/node.js +55 -46
- package/dist/types/Items/BaseItem/BaseItem.d.ts +1 -0
- package/dist/types/Items/RichText/RichTextOperations.d.ts +1 -1
- package/dist/types/Selection/Selection.d.ts +1 -0
- package/dist/types/SessionStorage.d.ts +2 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -7455,11 +7455,11 @@ class SessionStorage {
|
|
|
7455
7455
|
getFontHighlight(itemType) {
|
|
7456
7456
|
return this.get(`fontHighlightColor_${itemType}`);
|
|
7457
7457
|
}
|
|
7458
|
-
|
|
7459
|
-
this.set(`
|
|
7458
|
+
setHorisontalAlignment(itemType, horisontalAlignment) {
|
|
7459
|
+
this.set(`fontHorisontalAlignment_${itemType}`, horisontalAlignment);
|
|
7460
7460
|
}
|
|
7461
|
-
|
|
7462
|
-
return this.get(`
|
|
7461
|
+
getHorisontalAlignment(itemType) {
|
|
7462
|
+
return this.get(`fontHorisontalAlignment_${itemType}`);
|
|
7463
7463
|
}
|
|
7464
7464
|
setVerticalAlignment(itemType, verticalAlignment) {
|
|
7465
7465
|
this.set(`fontVerticalAlignment_${itemType}`, verticalAlignment);
|
|
@@ -17389,7 +17389,7 @@ class EditorContainer {
|
|
|
17389
17389
|
break;
|
|
17390
17390
|
case "setSelectionFontHighlight":
|
|
17391
17391
|
case "setSelectionFontStyle":
|
|
17392
|
-
case "
|
|
17392
|
+
case "setSelectionHorisontalAlignment":
|
|
17393
17393
|
this.applySelectionOp(op);
|
|
17394
17394
|
break;
|
|
17395
17395
|
case "setFontStyle":
|
|
@@ -21451,10 +21451,6 @@ class Items {
|
|
|
21451
21451
|
const unmodifiedSize = size;
|
|
21452
21452
|
size = 16;
|
|
21453
21453
|
const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
|
|
21454
|
-
const groups = tolerated.filter((item) => item.itemType === "Group");
|
|
21455
|
-
if (groups.length > 0) {
|
|
21456
|
-
return groups;
|
|
21457
|
-
}
|
|
21458
21454
|
let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
|
|
21459
21455
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
21460
21456
|
if (enclosed.length === 0) {
|
|
@@ -21994,6 +21990,20 @@ class BaseItem extends Mbr {
|
|
|
21994
21990
|
parentMatrix.apply(c);
|
|
21995
21991
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21996
21992
|
}
|
|
21993
|
+
hasAncestor(itemId) {
|
|
21994
|
+
let parentId = this.parent;
|
|
21995
|
+
while (parentId && parentId !== "Board") {
|
|
21996
|
+
if (parentId === itemId) {
|
|
21997
|
+
return true;
|
|
21998
|
+
}
|
|
21999
|
+
const parent = this.board.items.getById(parentId);
|
|
22000
|
+
if (!parent || parent.parent === parentId) {
|
|
22001
|
+
break;
|
|
22002
|
+
}
|
|
22003
|
+
parentId = parent.parent;
|
|
22004
|
+
}
|
|
22005
|
+
return false;
|
|
22006
|
+
}
|
|
21997
22007
|
applyAddChildren(childIds) {
|
|
21998
22008
|
if (!this.index) {
|
|
21999
22009
|
return;
|
|
@@ -22001,7 +22011,7 @@ class BaseItem extends Mbr {
|
|
|
22001
22011
|
const containerNestingMatrix = this.getNestingMatrix();
|
|
22002
22012
|
childIds.forEach((childId) => {
|
|
22003
22013
|
const foundItem = this.board.items.getById(childId);
|
|
22004
|
-
if (this.parent !== childId && this.getId() !== childId) {
|
|
22014
|
+
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
22005
22015
|
if (!this.index?.getById(childId) && foundItem) {
|
|
22006
22016
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
22007
22017
|
this.board.items.index.remove(foundItem);
|
|
@@ -22466,7 +22476,7 @@ class RichText extends BaseItem {
|
|
|
22466
22476
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22467
22477
|
}
|
|
22468
22478
|
if (this.isContainerSet) {
|
|
22469
|
-
return this.
|
|
22479
|
+
return this.getTransformedContainer().getWidth();
|
|
22470
22480
|
} else {
|
|
22471
22481
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22472
22482
|
}
|
|
@@ -22496,12 +22506,14 @@ class RichText extends BaseItem {
|
|
|
22496
22506
|
top = container.top;
|
|
22497
22507
|
}
|
|
22498
22508
|
const point3 = new Point(left, top);
|
|
22499
|
-
this.
|
|
22509
|
+
if (!this.isInShape || this.autoSize) {
|
|
22510
|
+
this.getParentWorldMatrix().apply(point3);
|
|
22511
|
+
}
|
|
22500
22512
|
return {
|
|
22501
22513
|
point: point3,
|
|
22502
22514
|
width,
|
|
22503
22515
|
height,
|
|
22504
|
-
maxWidth: maxWidth ? maxWidth
|
|
22516
|
+
maxWidth: maxWidth ? maxWidth : undefined,
|
|
22505
22517
|
maxHeight,
|
|
22506
22518
|
textScale: this.isInShape && !this.autoSize ? 1 : this.getScale()
|
|
22507
22519
|
};
|
|
@@ -40189,6 +40201,7 @@ class Shape extends BaseItem {
|
|
|
40189
40201
|
this.text.deserialize(data.text);
|
|
40190
40202
|
}
|
|
40191
40203
|
this.transformPath();
|
|
40204
|
+
this.text.updateElement();
|
|
40192
40205
|
this.subject.publish(this);
|
|
40193
40206
|
return this;
|
|
40194
40207
|
}
|
|
@@ -40481,16 +40494,10 @@ class Shape extends BaseItem {
|
|
|
40481
40494
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40482
40495
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40483
40496
|
textElement.id = `${this.getId()}_text`;
|
|
40484
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40485
40497
|
textElement.style.overflow = "auto";
|
|
40486
40498
|
positionRelatively(textElement, div);
|
|
40487
40499
|
resetElementScale(textElement);
|
|
40488
40500
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40489
|
-
const [dx, dy] = [
|
|
40490
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40491
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40492
|
-
];
|
|
40493
|
-
translateElementBy(textElement, dx, dy);
|
|
40494
40501
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40495
40502
|
if (this.getLinkTo()) {
|
|
40496
40503
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -43692,6 +43699,7 @@ class Group extends BaseItem {
|
|
|
43692
43699
|
constructor(board, events, children = [], id = "") {
|
|
43693
43700
|
super(board, id, undefined, true);
|
|
43694
43701
|
this.events = events;
|
|
43702
|
+
this.canBeNested = true;
|
|
43695
43703
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
43696
43704
|
this.transformation = new Transformation(this.id, this.events);
|
|
43697
43705
|
this.transformation.subject.subscribe(() => {
|
|
@@ -47120,7 +47128,8 @@ class Select extends Tool {
|
|
|
47120
47128
|
this.beginTimeStamp = Date.now();
|
|
47121
47129
|
const selectionMbr = selection.getMbr();
|
|
47122
47130
|
const selectionItems = selection.list();
|
|
47123
|
-
|
|
47131
|
+
const selectableHover = hover.map((item) => this.board.selection.getSelectableItem(item));
|
|
47132
|
+
this.isDownOnSelection = selectionMbr !== undefined && selectionMbr.isUnderPoint(pointer.point) && selectableHover.every((hovered) => hovered && selectionItems.some((selected) => selected.getId() === hovered.getId()));
|
|
47124
47133
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
47125
47134
|
if (this.isDraggingSelection) {
|
|
47126
47135
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -47446,7 +47455,7 @@ class Select extends Tool {
|
|
|
47446
47455
|
const hovered = this.board.items.getUnderPointer();
|
|
47447
47456
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
47448
47457
|
if (isCtrl || isShift) {
|
|
47449
|
-
const underPointer = hovered[0];
|
|
47458
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
47450
47459
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
47451
47460
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
47452
47461
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -47462,14 +47471,6 @@ class Select extends Tool {
|
|
|
47462
47471
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
47463
47472
|
if (isNotInSelection) {
|
|
47464
47473
|
this.board.selection.add(underPointer);
|
|
47465
|
-
if ("index" in underPointer && underPointer.index) {
|
|
47466
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
47467
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
47468
|
-
console.log("UNDERPOINTER", underPointer);
|
|
47469
|
-
console.log("CHILDREN", childrenIds);
|
|
47470
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
47471
|
-
this.board.selection.add(itemsInFrame);
|
|
47472
|
-
}
|
|
47473
47474
|
this.board.selection.setContext("EditUnderPointer");
|
|
47474
47475
|
} else {
|
|
47475
47476
|
this.board.selection.remove(underPointer);
|
|
@@ -47486,10 +47487,6 @@ class Select extends Tool {
|
|
|
47486
47487
|
} else {
|
|
47487
47488
|
this.board.selection.editUnderPointer();
|
|
47488
47489
|
}
|
|
47489
|
-
if (topItem2 instanceof Group) {
|
|
47490
|
-
const groupChildren = topItem2.getChildren();
|
|
47491
|
-
this.board.selection.add(groupChildren);
|
|
47492
|
-
}
|
|
47493
47490
|
this.board.tools.publish();
|
|
47494
47491
|
this.clear();
|
|
47495
47492
|
return false;
|
|
@@ -53525,10 +53522,23 @@ class BoardSelection {
|
|
|
53525
53522
|
getMbr() {
|
|
53526
53523
|
return this.items.getMbr();
|
|
53527
53524
|
}
|
|
53525
|
+
getSelectableItem(item) {
|
|
53526
|
+
if (!item) {
|
|
53527
|
+
return null;
|
|
53528
|
+
}
|
|
53529
|
+
if (!(item instanceof BaseItem) || item.parent === "Board") {
|
|
53530
|
+
return item;
|
|
53531
|
+
}
|
|
53532
|
+
const parent = this.board.items.getById(item.parent);
|
|
53533
|
+
if (parent instanceof Group) {
|
|
53534
|
+
return parent;
|
|
53535
|
+
}
|
|
53536
|
+
return item;
|
|
53537
|
+
}
|
|
53528
53538
|
selectUnderPointer() {
|
|
53529
53539
|
this.removeAll();
|
|
53530
53540
|
const stack = this.board.items.getUnderPointer();
|
|
53531
|
-
const top = stack.pop();
|
|
53541
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53532
53542
|
if (top) {
|
|
53533
53543
|
this.add(top);
|
|
53534
53544
|
this.setTextToEdit(undefined);
|
|
@@ -53582,7 +53592,7 @@ class BoardSelection {
|
|
|
53582
53592
|
editUnderPointer() {
|
|
53583
53593
|
this.removeAll();
|
|
53584
53594
|
const stack = this.board.items.getUnderPointer();
|
|
53585
|
-
const item = stack.pop();
|
|
53595
|
+
const item = this.getSelectableItem(stack.pop());
|
|
53586
53596
|
if (item) {
|
|
53587
53597
|
this.add(item);
|
|
53588
53598
|
this.setTextToEdit(undefined);
|
|
@@ -53616,7 +53626,7 @@ class BoardSelection {
|
|
|
53616
53626
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
53617
53627
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
53618
53628
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
53619
|
-
const
|
|
53629
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
53620
53630
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
53621
53631
|
if (textColor) {
|
|
53622
53632
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -53637,8 +53647,8 @@ class BoardSelection {
|
|
|
53637
53647
|
const stylesArr = styles;
|
|
53638
53648
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
53639
53649
|
}
|
|
53640
|
-
if (
|
|
53641
|
-
text5.setSelectionHorisontalAlignment(
|
|
53650
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
53651
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
53642
53652
|
}
|
|
53643
53653
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
53644
53654
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -53651,7 +53661,7 @@ class BoardSelection {
|
|
|
53651
53661
|
editTextUnderPointer() {
|
|
53652
53662
|
this.removeAll();
|
|
53653
53663
|
const stack = this.board.items.getUnderPointer();
|
|
53654
|
-
const top = stack.pop();
|
|
53664
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53655
53665
|
if (top) {
|
|
53656
53666
|
this.add(top);
|
|
53657
53667
|
this.setContext("EditTextUnderPointer");
|
|
@@ -54261,7 +54271,7 @@ class BoardSelection {
|
|
|
54261
54271
|
selection: text5.editor.getSelection(),
|
|
54262
54272
|
ops
|
|
54263
54273
|
});
|
|
54264
|
-
tempStorage.
|
|
54274
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
54265
54275
|
}
|
|
54266
54276
|
this.emitApplied({
|
|
54267
54277
|
class: "RichText",
|
|
@@ -55198,9 +55208,10 @@ class Board {
|
|
|
55198
55208
|
if (!item || !(item instanceof Group)) {
|
|
55199
55209
|
return;
|
|
55200
55210
|
}
|
|
55201
|
-
item.getChildren()
|
|
55202
|
-
|
|
55203
|
-
|
|
55211
|
+
const children = [...item.getChildren()];
|
|
55212
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
55213
|
+
children.forEach((child) => {
|
|
55214
|
+
child.transformation.isLocked = false;
|
|
55204
55215
|
});
|
|
55205
55216
|
item.transformation.isLocked = false;
|
|
55206
55217
|
const removedItems = [];
|
|
@@ -55215,9 +55226,7 @@ class Board {
|
|
|
55215
55226
|
if (!item || !(item instanceof Group)) {
|
|
55216
55227
|
return;
|
|
55217
55228
|
}
|
|
55218
|
-
item.
|
|
55219
|
-
item2.parent = "Board";
|
|
55220
|
-
});
|
|
55229
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
55221
55230
|
const removedItems = [];
|
|
55222
55231
|
this.findItemAndApply(op.item, (item2) => {
|
|
55223
55232
|
this.index.remove(item2);
|
package/dist/cjs/index.js
CHANGED
|
@@ -7455,11 +7455,11 @@ class SessionStorage {
|
|
|
7455
7455
|
getFontHighlight(itemType) {
|
|
7456
7456
|
return this.get(`fontHighlightColor_${itemType}`);
|
|
7457
7457
|
}
|
|
7458
|
-
|
|
7459
|
-
this.set(`
|
|
7458
|
+
setHorisontalAlignment(itemType, horisontalAlignment) {
|
|
7459
|
+
this.set(`fontHorisontalAlignment_${itemType}`, horisontalAlignment);
|
|
7460
7460
|
}
|
|
7461
|
-
|
|
7462
|
-
return this.get(`
|
|
7461
|
+
getHorisontalAlignment(itemType) {
|
|
7462
|
+
return this.get(`fontHorisontalAlignment_${itemType}`);
|
|
7463
7463
|
}
|
|
7464
7464
|
setVerticalAlignment(itemType, verticalAlignment) {
|
|
7465
7465
|
this.set(`fontVerticalAlignment_${itemType}`, verticalAlignment);
|
|
@@ -17389,7 +17389,7 @@ class EditorContainer {
|
|
|
17389
17389
|
break;
|
|
17390
17390
|
case "setSelectionFontHighlight":
|
|
17391
17391
|
case "setSelectionFontStyle":
|
|
17392
|
-
case "
|
|
17392
|
+
case "setSelectionHorisontalAlignment":
|
|
17393
17393
|
this.applySelectionOp(op);
|
|
17394
17394
|
break;
|
|
17395
17395
|
case "setFontStyle":
|
|
@@ -21451,10 +21451,6 @@ class Items {
|
|
|
21451
21451
|
const unmodifiedSize = size;
|
|
21452
21452
|
size = 16;
|
|
21453
21453
|
const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
|
|
21454
|
-
const groups = tolerated.filter((item) => item.itemType === "Group");
|
|
21455
|
-
if (groups.length > 0) {
|
|
21456
|
-
return groups;
|
|
21457
|
-
}
|
|
21458
21454
|
let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
|
|
21459
21455
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
21460
21456
|
if (enclosed.length === 0) {
|
|
@@ -21994,6 +21990,20 @@ class BaseItem extends Mbr {
|
|
|
21994
21990
|
parentMatrix.apply(c);
|
|
21995
21991
|
return new Mbr(Math.min(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.min(corners[0].y, corners[1].y, corners[2].y, corners[3].y), Math.max(corners[0].x, corners[1].x, corners[2].x, corners[3].x), Math.max(corners[0].y, corners[1].y, corners[2].y, corners[3].y));
|
|
21996
21992
|
}
|
|
21993
|
+
hasAncestor(itemId) {
|
|
21994
|
+
let parentId = this.parent;
|
|
21995
|
+
while (parentId && parentId !== "Board") {
|
|
21996
|
+
if (parentId === itemId) {
|
|
21997
|
+
return true;
|
|
21998
|
+
}
|
|
21999
|
+
const parent = this.board.items.getById(parentId);
|
|
22000
|
+
if (!parent || parent.parent === parentId) {
|
|
22001
|
+
break;
|
|
22002
|
+
}
|
|
22003
|
+
parentId = parent.parent;
|
|
22004
|
+
}
|
|
22005
|
+
return false;
|
|
22006
|
+
}
|
|
21997
22007
|
applyAddChildren(childIds) {
|
|
21998
22008
|
if (!this.index) {
|
|
21999
22009
|
return;
|
|
@@ -22001,7 +22011,7 @@ class BaseItem extends Mbr {
|
|
|
22001
22011
|
const containerNestingMatrix = this.getNestingMatrix();
|
|
22002
22012
|
childIds.forEach((childId) => {
|
|
22003
22013
|
const foundItem = this.board.items.getById(childId);
|
|
22004
|
-
if (this.parent !== childId && this.getId() !== childId) {
|
|
22014
|
+
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
22005
22015
|
if (!this.index?.getById(childId) && foundItem) {
|
|
22006
22016
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
22007
22017
|
this.board.items.index.remove(foundItem);
|
|
@@ -22466,7 +22476,7 @@ class RichText extends BaseItem {
|
|
|
22466
22476
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22467
22477
|
}
|
|
22468
22478
|
if (this.isContainerSet) {
|
|
22469
|
-
return this.
|
|
22479
|
+
return this.getTransformedContainer().getWidth();
|
|
22470
22480
|
} else {
|
|
22471
22481
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22472
22482
|
}
|
|
@@ -22496,12 +22506,14 @@ class RichText extends BaseItem {
|
|
|
22496
22506
|
top = container.top;
|
|
22497
22507
|
}
|
|
22498
22508
|
const point3 = new Point(left, top);
|
|
22499
|
-
this.
|
|
22509
|
+
if (!this.isInShape || this.autoSize) {
|
|
22510
|
+
this.getParentWorldMatrix().apply(point3);
|
|
22511
|
+
}
|
|
22500
22512
|
return {
|
|
22501
22513
|
point: point3,
|
|
22502
22514
|
width,
|
|
22503
22515
|
height,
|
|
22504
|
-
maxWidth: maxWidth ? maxWidth
|
|
22516
|
+
maxWidth: maxWidth ? maxWidth : undefined,
|
|
22505
22517
|
maxHeight,
|
|
22506
22518
|
textScale: this.isInShape && !this.autoSize ? 1 : this.getScale()
|
|
22507
22519
|
};
|
|
@@ -40189,6 +40201,7 @@ class Shape extends BaseItem {
|
|
|
40189
40201
|
this.text.deserialize(data.text);
|
|
40190
40202
|
}
|
|
40191
40203
|
this.transformPath();
|
|
40204
|
+
this.text.updateElement();
|
|
40192
40205
|
this.subject.publish(this);
|
|
40193
40206
|
return this;
|
|
40194
40207
|
}
|
|
@@ -40481,16 +40494,10 @@ class Shape extends BaseItem {
|
|
|
40481
40494
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40482
40495
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40483
40496
|
textElement.id = `${this.getId()}_text`;
|
|
40484
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40485
40497
|
textElement.style.overflow = "auto";
|
|
40486
40498
|
positionRelatively(textElement, div);
|
|
40487
40499
|
resetElementScale(textElement);
|
|
40488
40500
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40489
|
-
const [dx, dy] = [
|
|
40490
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40491
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40492
|
-
];
|
|
40493
|
-
translateElementBy(textElement, dx, dy);
|
|
40494
40501
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40495
40502
|
if (this.getLinkTo()) {
|
|
40496
40503
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -43692,6 +43699,7 @@ class Group extends BaseItem {
|
|
|
43692
43699
|
constructor(board, events, children = [], id = "") {
|
|
43693
43700
|
super(board, id, undefined, true);
|
|
43694
43701
|
this.events = events;
|
|
43702
|
+
this.canBeNested = true;
|
|
43695
43703
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
43696
43704
|
this.transformation = new Transformation(this.id, this.events);
|
|
43697
43705
|
this.transformation.subject.subscribe(() => {
|
|
@@ -47120,7 +47128,8 @@ class Select extends Tool {
|
|
|
47120
47128
|
this.beginTimeStamp = Date.now();
|
|
47121
47129
|
const selectionMbr = selection.getMbr();
|
|
47122
47130
|
const selectionItems = selection.list();
|
|
47123
|
-
|
|
47131
|
+
const selectableHover = hover.map((item) => this.board.selection.getSelectableItem(item));
|
|
47132
|
+
this.isDownOnSelection = selectionMbr !== undefined && selectionMbr.isUnderPoint(pointer.point) && selectableHover.every((hovered) => hovered && selectionItems.some((selected) => selected.getId() === hovered.getId()));
|
|
47124
47133
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
47125
47134
|
if (this.isDraggingSelection) {
|
|
47126
47135
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -47446,7 +47455,7 @@ class Select extends Tool {
|
|
|
47446
47455
|
const hovered = this.board.items.getUnderPointer();
|
|
47447
47456
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
47448
47457
|
if (isCtrl || isShift) {
|
|
47449
|
-
const underPointer = hovered[0];
|
|
47458
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
47450
47459
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
47451
47460
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
47452
47461
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -47462,14 +47471,6 @@ class Select extends Tool {
|
|
|
47462
47471
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
47463
47472
|
if (isNotInSelection) {
|
|
47464
47473
|
this.board.selection.add(underPointer);
|
|
47465
|
-
if ("index" in underPointer && underPointer.index) {
|
|
47466
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
47467
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
47468
|
-
console.log("UNDERPOINTER", underPointer);
|
|
47469
|
-
console.log("CHILDREN", childrenIds);
|
|
47470
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
47471
|
-
this.board.selection.add(itemsInFrame);
|
|
47472
|
-
}
|
|
47473
47474
|
this.board.selection.setContext("EditUnderPointer");
|
|
47474
47475
|
} else {
|
|
47475
47476
|
this.board.selection.remove(underPointer);
|
|
@@ -47486,10 +47487,6 @@ class Select extends Tool {
|
|
|
47486
47487
|
} else {
|
|
47487
47488
|
this.board.selection.editUnderPointer();
|
|
47488
47489
|
}
|
|
47489
|
-
if (topItem2 instanceof Group) {
|
|
47490
|
-
const groupChildren = topItem2.getChildren();
|
|
47491
|
-
this.board.selection.add(groupChildren);
|
|
47492
|
-
}
|
|
47493
47490
|
this.board.tools.publish();
|
|
47494
47491
|
this.clear();
|
|
47495
47492
|
return false;
|
|
@@ -53525,10 +53522,23 @@ class BoardSelection {
|
|
|
53525
53522
|
getMbr() {
|
|
53526
53523
|
return this.items.getMbr();
|
|
53527
53524
|
}
|
|
53525
|
+
getSelectableItem(item) {
|
|
53526
|
+
if (!item) {
|
|
53527
|
+
return null;
|
|
53528
|
+
}
|
|
53529
|
+
if (!(item instanceof BaseItem) || item.parent === "Board") {
|
|
53530
|
+
return item;
|
|
53531
|
+
}
|
|
53532
|
+
const parent = this.board.items.getById(item.parent);
|
|
53533
|
+
if (parent instanceof Group) {
|
|
53534
|
+
return parent;
|
|
53535
|
+
}
|
|
53536
|
+
return item;
|
|
53537
|
+
}
|
|
53528
53538
|
selectUnderPointer() {
|
|
53529
53539
|
this.removeAll();
|
|
53530
53540
|
const stack = this.board.items.getUnderPointer();
|
|
53531
|
-
const top = stack.pop();
|
|
53541
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53532
53542
|
if (top) {
|
|
53533
53543
|
this.add(top);
|
|
53534
53544
|
this.setTextToEdit(undefined);
|
|
@@ -53582,7 +53592,7 @@ class BoardSelection {
|
|
|
53582
53592
|
editUnderPointer() {
|
|
53583
53593
|
this.removeAll();
|
|
53584
53594
|
const stack = this.board.items.getUnderPointer();
|
|
53585
|
-
const item = stack.pop();
|
|
53595
|
+
const item = this.getSelectableItem(stack.pop());
|
|
53586
53596
|
if (item) {
|
|
53587
53597
|
this.add(item);
|
|
53588
53598
|
this.setTextToEdit(undefined);
|
|
@@ -53616,7 +53626,7 @@ class BoardSelection {
|
|
|
53616
53626
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
53617
53627
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
53618
53628
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
53619
|
-
const
|
|
53629
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
53620
53630
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
53621
53631
|
if (textColor) {
|
|
53622
53632
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -53637,8 +53647,8 @@ class BoardSelection {
|
|
|
53637
53647
|
const stylesArr = styles;
|
|
53638
53648
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
53639
53649
|
}
|
|
53640
|
-
if (
|
|
53641
|
-
text5.setSelectionHorisontalAlignment(
|
|
53650
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
53651
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
53642
53652
|
}
|
|
53643
53653
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
53644
53654
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -53651,7 +53661,7 @@ class BoardSelection {
|
|
|
53651
53661
|
editTextUnderPointer() {
|
|
53652
53662
|
this.removeAll();
|
|
53653
53663
|
const stack = this.board.items.getUnderPointer();
|
|
53654
|
-
const top = stack.pop();
|
|
53664
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53655
53665
|
if (top) {
|
|
53656
53666
|
this.add(top);
|
|
53657
53667
|
this.setContext("EditTextUnderPointer");
|
|
@@ -54261,7 +54271,7 @@ class BoardSelection {
|
|
|
54261
54271
|
selection: text5.editor.getSelection(),
|
|
54262
54272
|
ops
|
|
54263
54273
|
});
|
|
54264
|
-
tempStorage.
|
|
54274
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
54265
54275
|
}
|
|
54266
54276
|
this.emitApplied({
|
|
54267
54277
|
class: "RichText",
|
|
@@ -55198,9 +55208,10 @@ class Board {
|
|
|
55198
55208
|
if (!item || !(item instanceof Group)) {
|
|
55199
55209
|
return;
|
|
55200
55210
|
}
|
|
55201
|
-
item.getChildren()
|
|
55202
|
-
|
|
55203
|
-
|
|
55211
|
+
const children = [...item.getChildren()];
|
|
55212
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
55213
|
+
children.forEach((child) => {
|
|
55214
|
+
child.transformation.isLocked = false;
|
|
55204
55215
|
});
|
|
55205
55216
|
item.transformation.isLocked = false;
|
|
55206
55217
|
const removedItems = [];
|
|
@@ -55215,9 +55226,7 @@ class Board {
|
|
|
55215
55226
|
if (!item || !(item instanceof Group)) {
|
|
55216
55227
|
return;
|
|
55217
55228
|
}
|
|
55218
|
-
item.
|
|
55219
|
-
item2.parent = "Board";
|
|
55220
|
-
});
|
|
55229
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
55221
55230
|
const removedItems = [];
|
|
55222
55231
|
this.findItemAndApply(op.item, (item2) => {
|
|
55223
55232
|
this.index.remove(item2);
|