microboard-temp 0.13.31 → 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 +54 -39
- package/dist/cjs/index.js +54 -39
- package/dist/cjs/node.js +54 -39
- package/dist/esm/browser.js +54 -39
- package/dist/esm/index.js +54 -39
- package/dist/esm/node.js +54 -39
- 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);
|
|
@@ -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
|
}
|
|
@@ -46159,6 +46172,7 @@ class Group extends BaseItem {
|
|
|
46159
46172
|
constructor(board, events, children = [], id = "") {
|
|
46160
46173
|
super(board, id, undefined, true);
|
|
46161
46174
|
this.events = events;
|
|
46175
|
+
this.canBeNested = true;
|
|
46162
46176
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
46163
46177
|
this.transformation = new Transformation(this.id, this.events);
|
|
46164
46178
|
this.transformation.subject.subscribe(() => {
|
|
@@ -49587,7 +49601,8 @@ class Select extends Tool {
|
|
|
49587
49601
|
this.beginTimeStamp = Date.now();
|
|
49588
49602
|
const selectionMbr = selection.getMbr();
|
|
49589
49603
|
const selectionItems = selection.list();
|
|
49590
|
-
|
|
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()));
|
|
49591
49606
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
49592
49607
|
if (this.isDraggingSelection) {
|
|
49593
49608
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -49913,7 +49928,7 @@ class Select extends Tool {
|
|
|
49913
49928
|
const hovered = this.board.items.getUnderPointer();
|
|
49914
49929
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
49915
49930
|
if (isCtrl || isShift) {
|
|
49916
|
-
const underPointer = hovered[0];
|
|
49931
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
49917
49932
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
49918
49933
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
49919
49934
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -49929,14 +49944,6 @@ class Select extends Tool {
|
|
|
49929
49944
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
49930
49945
|
if (isNotInSelection) {
|
|
49931
49946
|
this.board.selection.add(underPointer);
|
|
49932
|
-
if ("index" in underPointer && underPointer.index) {
|
|
49933
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
49934
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
49935
|
-
console.log("UNDERPOINTER", underPointer);
|
|
49936
|
-
console.log("CHILDREN", childrenIds);
|
|
49937
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
49938
|
-
this.board.selection.add(itemsInFrame);
|
|
49939
|
-
}
|
|
49940
49947
|
this.board.selection.setContext("EditUnderPointer");
|
|
49941
49948
|
} else {
|
|
49942
49949
|
this.board.selection.remove(underPointer);
|
|
@@ -49953,10 +49960,6 @@ class Select extends Tool {
|
|
|
49953
49960
|
} else {
|
|
49954
49961
|
this.board.selection.editUnderPointer();
|
|
49955
49962
|
}
|
|
49956
|
-
if (topItem2 instanceof Group) {
|
|
49957
|
-
const groupChildren = topItem2.getChildren();
|
|
49958
|
-
this.board.selection.add(groupChildren);
|
|
49959
|
-
}
|
|
49960
49963
|
this.board.tools.publish();
|
|
49961
49964
|
this.clear();
|
|
49962
49965
|
return false;
|
|
@@ -55992,10 +55995,23 @@ class BoardSelection {
|
|
|
55992
55995
|
getMbr() {
|
|
55993
55996
|
return this.items.getMbr();
|
|
55994
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
|
+
}
|
|
55995
56011
|
selectUnderPointer() {
|
|
55996
56012
|
this.removeAll();
|
|
55997
56013
|
const stack = this.board.items.getUnderPointer();
|
|
55998
|
-
const top = stack.pop();
|
|
56014
|
+
const top = this.getSelectableItem(stack.pop());
|
|
55999
56015
|
if (top) {
|
|
56000
56016
|
this.add(top);
|
|
56001
56017
|
this.setTextToEdit(undefined);
|
|
@@ -56049,7 +56065,7 @@ class BoardSelection {
|
|
|
56049
56065
|
editUnderPointer() {
|
|
56050
56066
|
this.removeAll();
|
|
56051
56067
|
const stack = this.board.items.getUnderPointer();
|
|
56052
|
-
const item = stack.pop();
|
|
56068
|
+
const item = this.getSelectableItem(stack.pop());
|
|
56053
56069
|
if (item) {
|
|
56054
56070
|
this.add(item);
|
|
56055
56071
|
this.setTextToEdit(undefined);
|
|
@@ -56083,7 +56099,7 @@ class BoardSelection {
|
|
|
56083
56099
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
56084
56100
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
56085
56101
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
56086
|
-
const
|
|
56102
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
56087
56103
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
56088
56104
|
if (textColor) {
|
|
56089
56105
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -56104,8 +56120,8 @@ class BoardSelection {
|
|
|
56104
56120
|
const stylesArr = styles;
|
|
56105
56121
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
56106
56122
|
}
|
|
56107
|
-
if (
|
|
56108
|
-
text5.setSelectionHorisontalAlignment(
|
|
56123
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
56124
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
56109
56125
|
}
|
|
56110
56126
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
56111
56127
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -56118,7 +56134,7 @@ class BoardSelection {
|
|
|
56118
56134
|
editTextUnderPointer() {
|
|
56119
56135
|
this.removeAll();
|
|
56120
56136
|
const stack = this.board.items.getUnderPointer();
|
|
56121
|
-
const top = stack.pop();
|
|
56137
|
+
const top = this.getSelectableItem(stack.pop());
|
|
56122
56138
|
if (top) {
|
|
56123
56139
|
this.add(top);
|
|
56124
56140
|
this.setContext("EditTextUnderPointer");
|
|
@@ -56728,7 +56744,7 @@ class BoardSelection {
|
|
|
56728
56744
|
selection: text5.editor.getSelection(),
|
|
56729
56745
|
ops
|
|
56730
56746
|
});
|
|
56731
|
-
tempStorage.
|
|
56747
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
56732
56748
|
}
|
|
56733
56749
|
this.emitApplied({
|
|
56734
56750
|
class: "RichText",
|
|
@@ -57665,9 +57681,10 @@ class Board {
|
|
|
57665
57681
|
if (!item || !(item instanceof Group)) {
|
|
57666
57682
|
return;
|
|
57667
57683
|
}
|
|
57668
|
-
item.getChildren()
|
|
57669
|
-
|
|
57670
|
-
|
|
57684
|
+
const children = [...item.getChildren()];
|
|
57685
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
57686
|
+
children.forEach((child) => {
|
|
57687
|
+
child.transformation.isLocked = false;
|
|
57671
57688
|
});
|
|
57672
57689
|
item.transformation.isLocked = false;
|
|
57673
57690
|
const removedItems = [];
|
|
@@ -57682,9 +57699,7 @@ class Board {
|
|
|
57682
57699
|
if (!item || !(item instanceof Group)) {
|
|
57683
57700
|
return;
|
|
57684
57701
|
}
|
|
57685
|
-
item.
|
|
57686
|
-
item2.parent = "Board";
|
|
57687
|
-
});
|
|
57702
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
57688
57703
|
const removedItems = [];
|
|
57689
57704
|
this.findItemAndApply(op.item, (item2) => {
|
|
57690
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);
|
|
@@ -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
|
}
|
|
@@ -43515,6 +43528,7 @@ class Group extends BaseItem {
|
|
|
43515
43528
|
constructor(board, events, children = [], id = "") {
|
|
43516
43529
|
super(board, id, undefined, true);
|
|
43517
43530
|
this.events = events;
|
|
43531
|
+
this.canBeNested = true;
|
|
43518
43532
|
this.linkTo = new LinkTo(this.id, this.events);
|
|
43519
43533
|
this.transformation = new Transformation(this.id, this.events);
|
|
43520
43534
|
this.transformation.subject.subscribe(() => {
|
|
@@ -46943,7 +46957,8 @@ class Select extends Tool {
|
|
|
46943
46957
|
this.beginTimeStamp = Date.now();
|
|
46944
46958
|
const selectionMbr = selection.getMbr();
|
|
46945
46959
|
const selectionItems = selection.list();
|
|
46946
|
-
|
|
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()));
|
|
46947
46962
|
this.isDraggingSelection = this.isDownOnSelection;
|
|
46948
46963
|
if (this.isDraggingSelection) {
|
|
46949
46964
|
this.board.selection.transformationRenderBlock = true;
|
|
@@ -47269,7 +47284,7 @@ class Select extends Tool {
|
|
|
47269
47284
|
const hovered = this.board.items.getUnderPointer();
|
|
47270
47285
|
this.board.pointer.subject.publish(this.board.pointer);
|
|
47271
47286
|
if (isCtrl || isShift) {
|
|
47272
|
-
const underPointer = hovered[0];
|
|
47287
|
+
const underPointer = this.board.selection.getSelectableItem(hovered[0]);
|
|
47273
47288
|
const isEmptySelection = this.board.selection.items.list().length === 0;
|
|
47274
47289
|
if (!underPointer && !isEmptySelection && isShift) {
|
|
47275
47290
|
this.board.selection.add(this.board.selection.items.list());
|
|
@@ -47285,14 +47300,6 @@ class Select extends Tool {
|
|
|
47285
47300
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
47286
47301
|
if (isNotInSelection) {
|
|
47287
47302
|
this.board.selection.add(underPointer);
|
|
47288
|
-
if ("index" in underPointer && underPointer.index) {
|
|
47289
|
-
const { left, right, top, bottom } = underPointer.getMbr();
|
|
47290
|
-
const childrenIds = underPointer.getChildrenIds();
|
|
47291
|
-
console.log("UNDERPOINTER", underPointer);
|
|
47292
|
-
console.log("CHILDREN", childrenIds);
|
|
47293
|
-
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => childrenIds && childrenIds.includes(item.getId()));
|
|
47294
|
-
this.board.selection.add(itemsInFrame);
|
|
47295
|
-
}
|
|
47296
47303
|
this.board.selection.setContext("EditUnderPointer");
|
|
47297
47304
|
} else {
|
|
47298
47305
|
this.board.selection.remove(underPointer);
|
|
@@ -47309,10 +47316,6 @@ class Select extends Tool {
|
|
|
47309
47316
|
} else {
|
|
47310
47317
|
this.board.selection.editUnderPointer();
|
|
47311
47318
|
}
|
|
47312
|
-
if (topItem2 instanceof Group) {
|
|
47313
|
-
const groupChildren = topItem2.getChildren();
|
|
47314
|
-
this.board.selection.add(groupChildren);
|
|
47315
|
-
}
|
|
47316
47319
|
this.board.tools.publish();
|
|
47317
47320
|
this.clear();
|
|
47318
47321
|
return false;
|
|
@@ -53348,10 +53351,23 @@ class BoardSelection {
|
|
|
53348
53351
|
getMbr() {
|
|
53349
53352
|
return this.items.getMbr();
|
|
53350
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
|
+
}
|
|
53351
53367
|
selectUnderPointer() {
|
|
53352
53368
|
this.removeAll();
|
|
53353
53369
|
const stack = this.board.items.getUnderPointer();
|
|
53354
|
-
const top = stack.pop();
|
|
53370
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53355
53371
|
if (top) {
|
|
53356
53372
|
this.add(top);
|
|
53357
53373
|
this.setTextToEdit(undefined);
|
|
@@ -53405,7 +53421,7 @@ class BoardSelection {
|
|
|
53405
53421
|
editUnderPointer() {
|
|
53406
53422
|
this.removeAll();
|
|
53407
53423
|
const stack = this.board.items.getUnderPointer();
|
|
53408
|
-
const item = stack.pop();
|
|
53424
|
+
const item = this.getSelectableItem(stack.pop());
|
|
53409
53425
|
if (item) {
|
|
53410
53426
|
this.add(item);
|
|
53411
53427
|
this.setTextToEdit(undefined);
|
|
@@ -53439,7 +53455,7 @@ class BoardSelection {
|
|
|
53439
53455
|
const textSize = tempStorage.getFontSize(item.itemType);
|
|
53440
53456
|
const highlightColor = tempStorage.getFontHighlight(item.itemType);
|
|
53441
53457
|
const styles = tempStorage.getFontStyles(item.itemType);
|
|
53442
|
-
const
|
|
53458
|
+
const horisontalAlignment = tempStorage.getHorisontalAlignment(item.itemType);
|
|
53443
53459
|
const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
|
|
53444
53460
|
if (textColor) {
|
|
53445
53461
|
text5.setSelectionFontColor(textColor, "None");
|
|
@@ -53460,8 +53476,8 @@ class BoardSelection {
|
|
|
53460
53476
|
const stylesArr = styles;
|
|
53461
53477
|
text5.setSelectionFontStyle(stylesArr, "None");
|
|
53462
53478
|
}
|
|
53463
|
-
if (
|
|
53464
|
-
text5.setSelectionHorisontalAlignment(
|
|
53479
|
+
if (horisontalAlignment && !(item instanceof Sticker)) {
|
|
53480
|
+
text5.setSelectionHorisontalAlignment(horisontalAlignment);
|
|
53465
53481
|
}
|
|
53466
53482
|
if (verticalAlignment && !(item instanceof Sticker)) {
|
|
53467
53483
|
this.setVerticalAlignment(verticalAlignment);
|
|
@@ -53474,7 +53490,7 @@ class BoardSelection {
|
|
|
53474
53490
|
editTextUnderPointer() {
|
|
53475
53491
|
this.removeAll();
|
|
53476
53492
|
const stack = this.board.items.getUnderPointer();
|
|
53477
|
-
const top = stack.pop();
|
|
53493
|
+
const top = this.getSelectableItem(stack.pop());
|
|
53478
53494
|
if (top) {
|
|
53479
53495
|
this.add(top);
|
|
53480
53496
|
this.setContext("EditTextUnderPointer");
|
|
@@ -54084,7 +54100,7 @@ class BoardSelection {
|
|
|
54084
54100
|
selection: text5.editor.getSelection(),
|
|
54085
54101
|
ops
|
|
54086
54102
|
});
|
|
54087
|
-
tempStorage.
|
|
54103
|
+
tempStorage.setHorisontalAlignment(item.itemType, horisontalAlignment);
|
|
54088
54104
|
}
|
|
54089
54105
|
this.emitApplied({
|
|
54090
54106
|
class: "RichText",
|
|
@@ -55021,9 +55037,10 @@ class Board {
|
|
|
55021
55037
|
if (!item || !(item instanceof Group)) {
|
|
55022
55038
|
return;
|
|
55023
55039
|
}
|
|
55024
|
-
item.getChildren()
|
|
55025
|
-
|
|
55026
|
-
|
|
55040
|
+
const children = [...item.getChildren()];
|
|
55041
|
+
item.applyRemoveChildren(children.map((child) => child.getId()));
|
|
55042
|
+
children.forEach((child) => {
|
|
55043
|
+
child.transformation.isLocked = false;
|
|
55027
55044
|
});
|
|
55028
55045
|
item.transformation.isLocked = false;
|
|
55029
55046
|
const removedItems = [];
|
|
@@ -55038,9 +55055,7 @@ class Board {
|
|
|
55038
55055
|
if (!item || !(item instanceof Group)) {
|
|
55039
55056
|
return;
|
|
55040
55057
|
}
|
|
55041
|
-
item.
|
|
55042
|
-
item2.parent = "Board";
|
|
55043
|
-
});
|
|
55058
|
+
item.applyRemoveChildren(item.getChildrenIds());
|
|
55044
55059
|
const removedItems = [];
|
|
55045
55060
|
this.findItemAndApply(op.item, (item2) => {
|
|
55046
55061
|
this.index.remove(item2);
|