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/node.js
CHANGED
|
@@ -8492,11 +8492,11 @@ class SessionStorage {
|
|
|
8492
8492
|
getFontHighlight(itemType) {
|
|
8493
8493
|
return this.get(`fontHighlightColor_${itemType}`);
|
|
8494
8494
|
}
|
|
8495
|
-
|
|
8496
|
-
this.set(`
|
|
8495
|
+
setHorisontalAlignment(itemType, horisontalAlignment) {
|
|
8496
|
+
this.set(`fontHorisontalAlignment_${itemType}`, horisontalAlignment);
|
|
8497
8497
|
}
|
|
8498
|
-
|
|
8499
|
-
return this.get(`
|
|
8498
|
+
getHorisontalAlignment(itemType) {
|
|
8499
|
+
return this.get(`fontHorisontalAlignment_${itemType}`);
|
|
8500
8500
|
}
|
|
8501
8501
|
setVerticalAlignment(itemType, verticalAlignment) {
|
|
8502
8502
|
this.set(`fontVerticalAlignment_${itemType}`, verticalAlignment);
|
|
@@ -19929,7 +19929,7 @@ class EditorContainer {
|
|
|
19929
19929
|
break;
|
|
19930
19930
|
case "setSelectionFontHighlight":
|
|
19931
19931
|
case "setSelectionFontStyle":
|
|
19932
|
-
case "
|
|
19932
|
+
case "setSelectionHorisontalAlignment":
|
|
19933
19933
|
this.applySelectionOp(op);
|
|
19934
19934
|
break;
|
|
19935
19935
|
case "setFontStyle":
|
|
@@ -23923,10 +23923,6 @@ class Items {
|
|
|
23923
23923
|
const unmodifiedSize = size;
|
|
23924
23924
|
size = 16;
|
|
23925
23925
|
const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
|
|
23926
|
-
const groups = tolerated.filter((item) => item.itemType === "Group");
|
|
23927
|
-
if (groups.length > 0) {
|
|
23928
|
-
return groups;
|
|
23929
|
-
}
|
|
23930
23926
|
let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
|
|
23931
23927
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
23932
23928
|
if (enclosed.length === 0) {
|
|
@@ -24466,6 +24462,20 @@ class BaseItem extends Mbr {
|
|
|
24466
24462
|
parentMatrix.apply(c);
|
|
24467
24463
|
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));
|
|
24468
24464
|
}
|
|
24465
|
+
hasAncestor(itemId) {
|
|
24466
|
+
let parentId = this.parent;
|
|
24467
|
+
while (parentId && parentId !== "Board") {
|
|
24468
|
+
if (parentId === itemId) {
|
|
24469
|
+
return true;
|
|
24470
|
+
}
|
|
24471
|
+
const parent = this.board.items.getById(parentId);
|
|
24472
|
+
if (!parent || parent.parent === parentId) {
|
|
24473
|
+
break;
|
|
24474
|
+
}
|
|
24475
|
+
parentId = parent.parent;
|
|
24476
|
+
}
|
|
24477
|
+
return false;
|
|
24478
|
+
}
|
|
24469
24479
|
applyAddChildren(childIds) {
|
|
24470
24480
|
if (!this.index) {
|
|
24471
24481
|
return;
|
|
@@ -24473,7 +24483,7 @@ class BaseItem extends Mbr {
|
|
|
24473
24483
|
const containerNestingMatrix = this.getNestingMatrix();
|
|
24474
24484
|
childIds.forEach((childId) => {
|
|
24475
24485
|
const foundItem = this.board.items.getById(childId);
|
|
24476
|
-
if (this.parent !== childId && this.getId() !== childId) {
|
|
24486
|
+
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
24477
24487
|
if (!this.index?.getById(childId) && foundItem) {
|
|
24478
24488
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
24479
24489
|
this.board.items.index.remove(foundItem);
|
|
@@ -24938,7 +24948,7 @@ class RichText extends BaseItem {
|
|
|
24938
24948
|
return this.editor.maxWidth || this.container.getWidth();
|
|
24939
24949
|
}
|
|
24940
24950
|
if (this.isContainerSet) {
|
|
24941
|
-
return this.
|
|
24951
|
+
return this.getTransformedContainer().getWidth();
|
|
24942
24952
|
} else {
|
|
24943
24953
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
24944
24954
|
}
|
|
@@ -24968,12 +24978,14 @@ class RichText extends BaseItem {
|
|
|
24968
24978
|
top = container.top;
|
|
24969
24979
|
}
|
|
24970
24980
|
const point3 = new Point(left, top);
|
|
24971
|
-
this.
|
|
24981
|
+
if (!this.isInShape || this.autoSize) {
|
|
24982
|
+
this.getParentWorldMatrix().apply(point3);
|
|
24983
|
+
}
|
|
24972
24984
|
return {
|
|
24973
24985
|
point: point3,
|
|
24974
24986
|
width,
|
|
24975
24987
|
height,
|
|
24976
|
-
maxWidth: maxWidth ? maxWidth
|
|
24988
|
+
maxWidth: maxWidth ? maxWidth : undefined,
|
|
24977
24989
|
maxHeight,
|
|
24978
24990
|
textScale: this.isInShape && !this.autoSize ? 1 : this.getScale()
|
|
24979
24991
|
};
|
|
@@ -42662,6 +42674,7 @@ class Shape extends BaseItem {
|
|
|
42662
42674
|
this.text.deserialize(data.text);
|
|
42663
42675
|
}
|
|
42664
42676
|
this.transformPath();
|
|
42677
|
+
this.text.updateElement();
|
|
42665
42678
|
this.subject.publish(this);
|
|
42666
42679
|
return this;
|
|
42667
42680
|
}
|
|
@@ -42954,16 +42967,10 @@ class Shape extends BaseItem {
|
|
|
42954
42967
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
42955
42968
|
const textElement = this.text.renderHTML(documentFactory);
|
|
42956
42969
|
textElement.id = `${this.getId()}_text`;
|
|
42957
|
-
textElement.style.maxWidth = `${width}px`;
|
|
42958
42970
|
textElement.style.overflow = "auto";
|
|
42959
42971
|
positionRelatively(textElement, div);
|
|
42960
42972
|
resetElementScale(textElement);
|
|
42961
42973
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
42962
|
-
const [dx, dy] = [
|
|
42963
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
42964
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
42965
|
-
];
|
|
42966
|
-
translateElementBy(textElement, dx, dy);
|
|
42967
42974
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
42968
42975
|
if (this.getLinkTo()) {
|
|
42969
42976
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -46165,6 +46172,7 @@ class Group extends BaseItem {
|
|
|
46165
46172
|
constructor(board, events, children = [], id = "") {
|
|
46166
46173
|
super(board, id, undefined, true);
|
|
46167
46174
|
this.events = events;
|
|
46175
|
+
this.canBeNested = true;
|
|
46168
46176
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
46169
46177
|
this.transformation = new Transformation(this.id, this.events);
|
|
46170
46178
|
this.transformation.subject.subscribe(() => {
|
|
@@ -49593,7 +49601,8 @@ class Select extends Tool {
|
|
|
49593
49601
|
this.beginTimeStamp = Date.now();
|
|
49594
49602
|
const selectionMbr = selection.getMbr();
|
|
49595
49603
|
const selectionItems = selection.list();
|
|
49596
|
-
|
|
49604
|
+
const selectableHover = hover.map((item) => this.board.selection.getSelectableItem(item));
|
|
49605
|
+
this.isDownOnSelection = selectionMbr !== undefined && selectionMbr.isUnderPoint(pointer.point) && selectableHover.every((hovered) => hovered && selectionItems.some((selected) => selected.getId() === hovered.getId()));
|
|
49597
49606
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
49598
49607
|
if (this.isDraggingSelection) {
|
|
49599
49608
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -49919,7 +49928,7 @@ class Select extends Tool {
|
|
|
49919
49928
|
const hovered = this.board.items.getUnderPointer();
|
|
49920
49929
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
49921
49930
|
if (isCtrl || isShift) {
|
|
49922
|
-
const underPointer = hovered[0];
|
|
49931
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
49923
49932
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
49924
49933
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
49925
49934
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -49935,14 +49944,6 @@ class Select extends Tool {
|
|
|
49935
49944
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
49936
49945
|
if (isNotInSelection) {
|
|
49937
49946
|
this.board.selection.add(underPointer);
|
|
49938
|
-
if ("index" in underPointer && underPointer.index) {
|
|
49939
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
49940
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
49941
|
-
console.log("UNDERPOINTER", underPointer);
|
|
49942
|
-
console.log("CHILDREN", childrenIds);
|
|
49943
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
49944
|
-
this.board.selection.add(itemsInFrame);
|
|
49945
|
-
}
|
|
49946
49947
|
this.board.selection.setContext("EditUnderPointer");
|
|
49947
49948
|
} else {
|
|
49948
49949
|
this.board.selection.remove(underPointer);
|
|
@@ -49959,10 +49960,6 @@ class Select extends Tool {
|
|
|
49959
49960
|
} else {
|
|
49960
49961
|
this.board.selection.editUnderPointer();
|
|
49961
49962
|
}
|
|
49962
|
-
if (topItem2 instanceof Group) {
|
|
49963
|
-
const groupChildren = topItem2.getChildren();
|
|
49964
|
-
this.board.selection.add(groupChildren);
|
|
49965
|
-
}
|
|
49966
49963
|
this.board.tools.publish();
|
|
49967
49964
|
this.clear();
|
|
49968
49965
|
return false;
|
|
@@ -55998,10 +55995,23 @@ class BoardSelection {
|
|
|
55998
55995
|
getMbr() {
|
|
55999
55996
|
return this.items.getMbr();
|
|
56000
55997
|
}
|
|
55998
|
+
getSelectableItem(item) {
|
|
55999
|
+
if (!item) {
|
|
56000
|
+
return null;
|
|
56001
|
+
}
|
|
56002
|
+
if (!(item instanceof BaseItem) || item.parent === "Board") {
|
|
56003
|
+
return item;
|
|
56004
|
+
}
|
|
56005
|
+
const parent = this.board.items.getById(item.parent);
|
|
56006
|
+
if (parent instanceof Group) {
|
|
56007
|
+
return parent;
|
|
56008
|
+
}
|
|
56009
|
+
return item;
|
|
56010
|
+
}
|
|
56001
56011
|
selectUnderPointer() {
|
|
56002
56012
|
this.removeAll();
|
|
56003
56013
|
const stack = this.board.items.getUnderPointer();
|
|
56004
|
-
const top = stack.pop();
|
|
56014
|
+
const top = this.getSelectableItem(stack.pop());
|
|
56005
56015
|
if (top) {
|
|
56006
56016
|
this.add(top);
|
|
56007
56017
|
this.setTextToEdit(undefined);
|
|
@@ -56055,7 +56065,7 @@ class BoardSelection {
|
|
|
56055
56065
|
editUnderPointer() {
|
|
56056
56066
|
this.removeAll();
|
|
56057
56067
|
const stack = this.board.items.getUnderPointer();
|
|
56058
|
-
const item = stack.pop();
|
|
56068
|
+
const item = this.getSelectableItem(stack.pop());
|
|
56059
56069
|
if (item) {
|
|
56060
56070
|
this.add(item);
|
|
56061
56071
|
this.setTextToEdit(undefined);
|
|
@@ -56089,7 +56099,7 @@ class BoardSelection {
|
|
|
56089
56099
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
56090
56100
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
56091
56101
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
56092
|
-
const
|
|
56102
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
56093
56103
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
56094
56104
|
if (textColor) {
|
|
56095
56105
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -56110,8 +56120,8 @@ class BoardSelection {
|
|
|
56110
56120
|
const stylesArr = styles;
|
|
56111
56121
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
56112
56122
|
}
|
|
56113
|
-
if (
|
|
56114
|
-
text5.setSelectionHorisontalAlignment(
|
|
56123
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
56124
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
56115
56125
|
}
|
|
56116
56126
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
56117
56127
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -56124,7 +56134,7 @@ class BoardSelection {
|
|
|
56124
56134
|
editTextUnderPointer() {
|
|
56125
56135
|
this.removeAll();
|
|
56126
56136
|
const stack = this.board.items.getUnderPointer();
|
|
56127
|
-
const top = stack.pop();
|
|
56137
|
+
const top = this.getSelectableItem(stack.pop());
|
|
56128
56138
|
if (top) {
|
|
56129
56139
|
this.add(top);
|
|
56130
56140
|
this.setContext("EditTextUnderPointer");
|
|
@@ -56734,7 +56744,7 @@ class BoardSelection {
|
|
|
56734
56744
|
selection: text5.editor.getSelection(),
|
|
56735
56745
|
ops
|
|
56736
56746
|
});
|
|
56737
|
-
tempStorage.
|
|
56747
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
56738
56748
|
}
|
|
56739
56749
|
this.emitApplied({
|
|
56740
56750
|
class: "RichText",
|
|
@@ -57671,9 +57681,10 @@ class Board {
|
|
|
57671
57681
|
if (!item || !(item instanceof Group)) {
|
|
57672
57682
|
return;
|
|
57673
57683
|
}
|
|
57674
|
-
item.getChildren()
|
|
57675
|
-
|
|
57676
|
-
|
|
57684
|
+
const children = [...item.getChildren()];
|
|
57685
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
57686
|
+
children.forEach((child) => {
|
|
57687
|
+
child.transformation.isLocked = false;
|
|
57677
57688
|
});
|
|
57678
57689
|
item.transformation.isLocked = false;
|
|
57679
57690
|
const removedItems = [];
|
|
@@ -57688,9 +57699,7 @@ class Board {
|
|
|
57688
57699
|
if (!item || !(item instanceof Group)) {
|
|
57689
57700
|
return;
|
|
57690
57701
|
}
|
|
57691
|
-
item.
|
|
57692
|
-
item2.parent = "Board";
|
|
57693
|
-
});
|
|
57702
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
57694
57703
|
const removedItems = [];
|
|
57695
57704
|
this.findItemAndApply(op.item, (item2) => {
|
|
57696
57705
|
this.index.remove(item2);
|
package/dist/esm/browser.js
CHANGED
|
@@ -7275,11 +7275,11 @@ class SessionStorage {
|
|
|
7275
7275
|
getFontHighlight(itemType) {
|
|
7276
7276
|
return this.get(`fontHighlightColor_${itemType}`);
|
|
7277
7277
|
}
|
|
7278
|
-
|
|
7279
|
-
this.set(`
|
|
7278
|
+
setHorisontalAlignment(itemType, horisontalAlignment) {
|
|
7279
|
+
this.set(`fontHorisontalAlignment_${itemType}`, horisontalAlignment);
|
|
7280
7280
|
}
|
|
7281
|
-
|
|
7282
|
-
return this.get(`
|
|
7281
|
+
getHorisontalAlignment(itemType) {
|
|
7282
|
+
return this.get(`fontHorisontalAlignment_${itemType}`);
|
|
7283
7283
|
}
|
|
7284
7284
|
setVerticalAlignment(itemType, verticalAlignment) {
|
|
7285
7285
|
this.set(`fontVerticalAlignment_${itemType}`, verticalAlignment);
|
|
@@ -17218,7 +17218,7 @@ class EditorContainer {
|
|
|
17218
17218
|
break;
|
|
17219
17219
|
case "setSelectionFontHighlight":
|
|
17220
17220
|
case "setSelectionFontStyle":
|
|
17221
|
-
case "
|
|
17221
|
+
case "setSelectionHorisontalAlignment":
|
|
17222
17222
|
this.applySelectionOp(op);
|
|
17223
17223
|
break;
|
|
17224
17224
|
case "setFontStyle":
|
|
@@ -21280,10 +21280,6 @@ class Items {
|
|
|
21280
21280
|
const unmodifiedSize = size;
|
|
21281
21281
|
size = 16;
|
|
21282
21282
|
const tolerated = this.index.getEnclosedOrCrossed(x - size, y - size, x + size, y + size);
|
|
21283
|
-
const groups = tolerated.filter((item) => item.itemType === "Group");
|
|
21284
|
-
if (groups.length > 0) {
|
|
21285
|
-
return groups;
|
|
21286
|
-
}
|
|
21287
21283
|
let enclosed = tolerated.some((item) => item instanceof Connector2) ? tolerated : this.index.getEnclosedOrCrossed(x, y, x, y);
|
|
21288
21284
|
const underPointer = this.getUnderPoint(new Point(x, y), size);
|
|
21289
21285
|
if (enclosed.length === 0) {
|
|
@@ -21823,6 +21819,20 @@ class BaseItem extends Mbr {
|
|
|
21823
21819
|
parentMatrix.apply(c);
|
|
21824
21820
|
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));
|
|
21825
21821
|
}
|
|
21822
|
+
hasAncestor(itemId) {
|
|
21823
|
+
let parentId = this.parent;
|
|
21824
|
+
while (parentId && parentId !== "Board") {
|
|
21825
|
+
if (parentId === itemId) {
|
|
21826
|
+
return true;
|
|
21827
|
+
}
|
|
21828
|
+
const parent = this.board.items.getById(parentId);
|
|
21829
|
+
if (!parent || parent.parent === parentId) {
|
|
21830
|
+
break;
|
|
21831
|
+
}
|
|
21832
|
+
parentId = parent.parent;
|
|
21833
|
+
}
|
|
21834
|
+
return false;
|
|
21835
|
+
}
|
|
21826
21836
|
applyAddChildren(childIds) {
|
|
21827
21837
|
if (!this.index) {
|
|
21828
21838
|
return;
|
|
@@ -21830,7 +21840,7 @@ class BaseItem extends Mbr {
|
|
|
21830
21840
|
const containerNestingMatrix = this.getNestingMatrix();
|
|
21831
21841
|
childIds.forEach((childId) => {
|
|
21832
21842
|
const foundItem = this.board.items.getById(childId);
|
|
21833
|
-
if (this.parent !== childId && this.getId() !== childId) {
|
|
21843
|
+
if (this.parent !== childId && this.getId() !== childId && !this.hasAncestor(childId)) {
|
|
21834
21844
|
if (!this.index?.getById(childId) && foundItem) {
|
|
21835
21845
|
const localMatrix = foundItem.transformation.toMatrix().toLocalOf(containerNestingMatrix);
|
|
21836
21846
|
this.board.items.index.remove(foundItem);
|
|
@@ -22295,7 +22305,7 @@ class RichText extends BaseItem {
|
|
|
22295
22305
|
return this.editor.maxWidth || this.container.getWidth();
|
|
22296
22306
|
}
|
|
22297
22307
|
if (this.isContainerSet) {
|
|
22298
|
-
return this.
|
|
22308
|
+
return this.getTransformedContainer().getWidth();
|
|
22299
22309
|
} else {
|
|
22300
22310
|
return this.containerMaxWidth || this.editor.maxWidth;
|
|
22301
22311
|
}
|
|
@@ -22325,12 +22335,14 @@ class RichText extends BaseItem {
|
|
|
22325
22335
|
top = container.top;
|
|
22326
22336
|
}
|
|
22327
22337
|
const point3 = new Point(left, top);
|
|
22328
|
-
this.
|
|
22338
|
+
if (!this.isInShape || this.autoSize) {
|
|
22339
|
+
this.getParentWorldMatrix().apply(point3);
|
|
22340
|
+
}
|
|
22329
22341
|
return {
|
|
22330
22342
|
point: point3,
|
|
22331
22343
|
width,
|
|
22332
22344
|
height,
|
|
22333
|
-
maxWidth: maxWidth ? maxWidth
|
|
22345
|
+
maxWidth: maxWidth ? maxWidth : undefined,
|
|
22334
22346
|
maxHeight,
|
|
22335
22347
|
textScale: this.isInShape && !this.autoSize ? 1 : this.getScale()
|
|
22336
22348
|
};
|
|
@@ -40018,6 +40030,7 @@ class Shape extends BaseItem {
|
|
|
40018
40030
|
this.text.deserialize(data.text);
|
|
40019
40031
|
}
|
|
40020
40032
|
this.transformPath();
|
|
40033
|
+
this.text.updateElement();
|
|
40021
40034
|
this.subject.publish(this);
|
|
40022
40035
|
return this;
|
|
40023
40036
|
}
|
|
@@ -40310,16 +40323,10 @@ class Shape extends BaseItem {
|
|
|
40310
40323
|
div.setAttribute("stroke-width", this.borderWidth.toString());
|
|
40311
40324
|
const textElement = this.text.renderHTML(documentFactory);
|
|
40312
40325
|
textElement.id = `${this.getId()}_text`;
|
|
40313
|
-
textElement.style.maxWidth = `${width}px`;
|
|
40314
40326
|
textElement.style.overflow = "auto";
|
|
40315
40327
|
positionRelatively(textElement, div);
|
|
40316
40328
|
resetElementScale(textElement);
|
|
40317
40329
|
scaleElementBy(textElement, 1 / scaleX, 1 / scaleY);
|
|
40318
|
-
const [dx, dy] = [
|
|
40319
|
-
(width - parseInt(textElement.style.width)) / scaleX / 2 - 1,
|
|
40320
|
-
(height - parseInt(textElement.style.height)) / scaleY / 2 - 1
|
|
40321
|
-
];
|
|
40322
|
-
translateElementBy(textElement, dx, dy);
|
|
40323
40330
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
40324
40331
|
if (this.getLinkTo()) {
|
|
40325
40332
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -43521,6 +43528,7 @@ class Group extends BaseItem {
|
|
|
43521
43528
|
constructor(board, events, children = [], id = "") {
|
|
43522
43529
|
super(board, id, undefined, true);
|
|
43523
43530
|
this.events = events;
|
|
43531
|
+
this.canBeNested = true;
|
|
43524
43532
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
43525
43533
|
this.transformation = new Transformation(this.id, this.events);
|
|
43526
43534
|
this.transformation.subject.subscribe(() => {
|
|
@@ -46949,7 +46957,8 @@ class Select extends Tool {
|
|
|
46949
46957
|
this.beginTimeStamp = Date.now();
|
|
46950
46958
|
const selectionMbr = selection.getMbr();
|
|
46951
46959
|
const selectionItems = selection.list();
|
|
46952
|
-
|
|
46960
|
+
const selectableHover = hover.map((item) => this.board.selection.getSelectableItem(item));
|
|
46961
|
+
this.isDownOnSelection = selectionMbr !== undefined && selectionMbr.isUnderPoint(pointer.point) && selectableHover.every((hovered) => hovered && selectionItems.some((selected) => selected.getId() === hovered.getId()));
|
|
46953
46962
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
46954
46963
|
if (this.isDraggingSelection) {
|
|
46955
46964
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -47275,7 +47284,7 @@ class Select extends Tool {
|
|
|
47275
47284
|
const hovered = this.board.items.getUnderPointer();
|
|
47276
47285
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
47277
47286
|
if (isCtrl || isShift) {
|
|
47278
|
-
const underPointer = hovered[0];
|
|
47287
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
47279
47288
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
47280
47289
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
47281
47290
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -47291,14 +47300,6 @@ class Select extends Tool {
|
|
|
47291
47300
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
47292
47301
|
if (isNotInSelection) {
|
|
47293
47302
|
this.board.selection.add(underPointer);
|
|
47294
|
-
if ("index" in underPointer && underPointer.index) {
|
|
47295
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
47296
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
47297
|
-
console.log("UNDERPOINTER", underPointer);
|
|
47298
|
-
console.log("CHILDREN", childrenIds);
|
|
47299
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
47300
|
-
this.board.selection.add(itemsInFrame);
|
|
47301
|
-
}
|
|
47302
47303
|
this.board.selection.setContext("EditUnderPointer");
|
|
47303
47304
|
} else {
|
|
47304
47305
|
this.board.selection.remove(underPointer);
|
|
@@ -47315,10 +47316,6 @@ class Select extends Tool {
|
|
|
47315
47316
|
} else {
|
|
47316
47317
|
this.board.selection.editUnderPointer();
|
|
47317
47318
|
}
|
|
47318
|
-
if (topItem2 instanceof Group) {
|
|
47319
|
-
const groupChildren = topItem2.getChildren();
|
|
47320
|
-
this.board.selection.add(groupChildren);
|
|
47321
|
-
}
|
|
47322
47319
|
this.board.tools.publish();
|
|
47323
47320
|
this.clear();
|
|
47324
47321
|
return false;
|
|
@@ -53354,10 +53351,23 @@ class BoardSelection {
|
|
|
53354
53351
|
getMbr() {
|
|
53355
53352
|
return this.items.getMbr();
|
|
53356
53353
|
}
|
|
53354
|
+
getSelectableItem(item) {
|
|
53355
|
+
if (!item) {
|
|
53356
|
+
return null;
|
|
53357
|
+
}
|
|
53358
|
+
if (!(item instanceof BaseItem) || item.parent === "Board") {
|
|
53359
|
+
return item;
|
|
53360
|
+
}
|
|
53361
|
+
const parent = this.board.items.getById(item.parent);
|
|
53362
|
+
if (parent instanceof Group) {
|
|
53363
|
+
return parent;
|
|
53364
|
+
}
|
|
53365
|
+
return item;
|
|
53366
|
+
}
|
|
53357
53367
|
selectUnderPointer() {
|
|
53358
53368
|
this.removeAll();
|
|
53359
53369
|
const stack = this.board.items.getUnderPointer();
|
|
53360
|
-
const top = stack.pop();
|
|
53370
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53361
53371
|
if (top) {
|
|
53362
53372
|
this.add(top);
|
|
53363
53373
|
this.setTextToEdit(undefined);
|
|
@@ -53411,7 +53421,7 @@ class BoardSelection {
|
|
|
53411
53421
|
editUnderPointer() {
|
|
53412
53422
|
this.removeAll();
|
|
53413
53423
|
const stack = this.board.items.getUnderPointer();
|
|
53414
|
-
const item = stack.pop();
|
|
53424
|
+
const item = this.getSelectableItem(stack.pop());
|
|
53415
53425
|
if (item) {
|
|
53416
53426
|
this.add(item);
|
|
53417
53427
|
this.setTextToEdit(undefined);
|
|
@@ -53445,7 +53455,7 @@ class BoardSelection {
|
|
|
53445
53455
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
53446
53456
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
53447
53457
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
53448
|
-
const
|
|
53458
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
53449
53459
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
53450
53460
|
if (textColor) {
|
|
53451
53461
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -53466,8 +53476,8 @@ class BoardSelection {
|
|
|
53466
53476
|
const stylesArr = styles;
|
|
53467
53477
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
53468
53478
|
}
|
|
53469
|
-
if (
|
|
53470
|
-
text5.setSelectionHorisontalAlignment(
|
|
53479
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
53480
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
53471
53481
|
}
|
|
53472
53482
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
53473
53483
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -53480,7 +53490,7 @@ class BoardSelection {
|
|
|
53480
53490
|
editTextUnderPointer() {
|
|
53481
53491
|
this.removeAll();
|
|
53482
53492
|
const stack = this.board.items.getUnderPointer();
|
|
53483
|
-
const top = stack.pop();
|
|
53493
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53484
53494
|
if (top) {
|
|
53485
53495
|
this.add(top);
|
|
53486
53496
|
this.setContext("EditTextUnderPointer");
|
|
@@ -54090,7 +54100,7 @@ class BoardSelection {
|
|
|
54090
54100
|
selection: text5.editor.getSelection(),
|
|
54091
54101
|
ops
|
|
54092
54102
|
});
|
|
54093
|
-
tempStorage.
|
|
54103
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
54094
54104
|
}
|
|
54095
54105
|
this.emitApplied({
|
|
54096
54106
|
class: "RichText",
|
|
@@ -55027,9 +55037,10 @@ class Board {
|
|
|
55027
55037
|
if (!item || !(item instanceof Group)) {
|
|
55028
55038
|
return;
|
|
55029
55039
|
}
|
|
55030
|
-
item.getChildren()
|
|
55031
|
-
|
|
55032
|
-
|
|
55040
|
+
const children = [...item.getChildren()];
|
|
55041
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
55042
|
+
children.forEach((child) => {
|
|
55043
|
+
child.transformation.isLocked = false;
|
|
55033
55044
|
});
|
|
55034
55045
|
item.transformation.isLocked = false;
|
|
55035
55046
|
const removedItems = [];
|
|
@@ -55044,9 +55055,7 @@ class Board {
|
|
|
55044
55055
|
if (!item || !(item instanceof Group)) {
|
|
55045
55056
|
return;
|
|
55046
55057
|
}
|
|
55047
|
-
item.
|
|
55048
|
-
item2.parent = "Board";
|
|
55049
|
-
});
|
|
55058
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
55050
55059
|
const removedItems = [];
|
|
55051
55060
|
this.findItemAndApply(op.item, (item2) => {
|
|
55052
55061
|
this.index.remove(item2);
|