microboard-temp 0.13.65 → 0.13.67
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 +78 -2
- package/dist/cjs/index.js +78 -2
- package/dist/cjs/node.js +78 -2
- package/dist/esm/browser.js +78 -2
- package/dist/esm/index.js +78 -2
- package/dist/esm/node.js +78 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -61929,11 +61929,14 @@ class Board {
|
|
|
61929
61929
|
}
|
|
61930
61930
|
const newMap = {};
|
|
61931
61931
|
const childItemIds = new Set;
|
|
61932
|
+
const childToParent = new Map;
|
|
61932
61933
|
for (const itemId in itemsMap) {
|
|
61933
61934
|
const d = itemsMap[itemId];
|
|
61934
61935
|
if (Array.isArray(d.childIds)) {
|
|
61935
|
-
for (const cid of d.childIds)
|
|
61936
|
+
for (const cid of d.childIds) {
|
|
61936
61937
|
childItemIds.add(cid);
|
|
61938
|
+
childToParent.set(cid, itemId);
|
|
61939
|
+
}
|
|
61937
61940
|
}
|
|
61938
61941
|
}
|
|
61939
61942
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -62005,8 +62008,38 @@ class Board {
|
|
|
62005
62008
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
62006
62009
|
itemData.transformation.translateX = newTx;
|
|
62007
62010
|
itemData.transformation.translateY = newTy;
|
|
62011
|
+
const d = itemData;
|
|
62012
|
+
if (d.text && typeof d.text === "object") {
|
|
62013
|
+
const textData = d.text;
|
|
62014
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
62015
|
+
const tt = textData.transformation;
|
|
62016
|
+
tt.translateX = newTx;
|
|
62017
|
+
tt.translateY = newTy;
|
|
62018
|
+
}
|
|
62019
|
+
}
|
|
62008
62020
|
} else if (childItemIds.has(itemId)) {
|
|
62009
|
-
|
|
62021
|
+
const parentId = childToParent.get(itemId);
|
|
62022
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
62023
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
62024
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
62025
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
62026
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
62027
|
+
const newChildTx = parentNewTx + translateX;
|
|
62028
|
+
const newChildTy = parentNewTy + translateY;
|
|
62029
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
62030
|
+
if (itemData.transformation) {
|
|
62031
|
+
itemData.transformation.translateX = newChildTx;
|
|
62032
|
+
itemData.transformation.translateY = newChildTy;
|
|
62033
|
+
const d2 = itemData;
|
|
62034
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62035
|
+
const textData = d2.text;
|
|
62036
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
62037
|
+
const tt = textData.transformation;
|
|
62038
|
+
tt.translateX = newChildTx;
|
|
62039
|
+
tt.translateY = newChildTy;
|
|
62040
|
+
}
|
|
62041
|
+
}
|
|
62042
|
+
}
|
|
62010
62043
|
}
|
|
62011
62044
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
62012
62045
|
const itemDataWithChildren = itemData;
|
|
@@ -62088,9 +62121,22 @@ class Board {
|
|
|
62088
62121
|
}
|
|
62089
62122
|
}
|
|
62090
62123
|
const newMap = {};
|
|
62124
|
+
const dupChildItemIds = new Set;
|
|
62125
|
+
const dupChildToParent = new Map;
|
|
62126
|
+
for (const itemId in itemsMap) {
|
|
62127
|
+
const d = itemsMap[itemId];
|
|
62128
|
+
if (Array.isArray(d.childIds)) {
|
|
62129
|
+
for (const cid of d.childIds) {
|
|
62130
|
+
dupChildItemIds.add(cid);
|
|
62131
|
+
dupChildToParent.set(cid, itemId);
|
|
62132
|
+
}
|
|
62133
|
+
}
|
|
62134
|
+
}
|
|
62091
62135
|
let minX = Infinity;
|
|
62092
62136
|
let minY = Infinity;
|
|
62093
62137
|
for (const itemId in itemsMap) {
|
|
62138
|
+
if (dupChildItemIds.has(itemId))
|
|
62139
|
+
continue;
|
|
62094
62140
|
const itemData = itemsMap[itemId];
|
|
62095
62141
|
const { translateX, translateY } = itemData.transformation || {
|
|
62096
62142
|
translateX: 0,
|
|
@@ -62136,6 +62182,28 @@ class Board {
|
|
|
62136
62182
|
itemData.middlePoint.x += -minX + right + width2;
|
|
62137
62183
|
itemData.middlePoint.y += -minY + top;
|
|
62138
62184
|
}
|
|
62185
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
62186
|
+
const parentId = dupChildToParent.get(itemId);
|
|
62187
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
62188
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
62189
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
62190
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
62191
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
62192
|
+
if (itemData.transformation) {
|
|
62193
|
+
const newChildTx = parentNewTx + translateX;
|
|
62194
|
+
const newChildTy = parentNewTy + translateY;
|
|
62195
|
+
itemData.transformation.translateX = newChildTx;
|
|
62196
|
+
itemData.transformation.translateY = newChildTy;
|
|
62197
|
+
itemData.transformation.isLocked = false;
|
|
62198
|
+
const d2 = itemData;
|
|
62199
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62200
|
+
const tt = d2.text.transformation;
|
|
62201
|
+
if (tt) {
|
|
62202
|
+
tt.translateX = newChildTx;
|
|
62203
|
+
tt.translateY = newChildTy;
|
|
62204
|
+
}
|
|
62205
|
+
}
|
|
62206
|
+
}
|
|
62139
62207
|
} else if (itemData.transformation) {
|
|
62140
62208
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
62141
62209
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -62146,6 +62214,14 @@ class Board {
|
|
|
62146
62214
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
62147
62215
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
62148
62216
|
}
|
|
62217
|
+
const d2 = itemData;
|
|
62218
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62219
|
+
const tt = d2.text.transformation;
|
|
62220
|
+
if (tt) {
|
|
62221
|
+
tt.translateX = itemData.transformation.translateX;
|
|
62222
|
+
tt.translateY = itemData.transformation.translateY;
|
|
62223
|
+
}
|
|
62224
|
+
}
|
|
62149
62225
|
}
|
|
62150
62226
|
const itemDataWithChildren = itemData;
|
|
62151
62227
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -61929,11 +61929,14 @@ class Board {
|
|
|
61929
61929
|
}
|
|
61930
61930
|
const newMap = {};
|
|
61931
61931
|
const childItemIds = new Set;
|
|
61932
|
+
const childToParent = new Map;
|
|
61932
61933
|
for (const itemId in itemsMap) {
|
|
61933
61934
|
const d = itemsMap[itemId];
|
|
61934
61935
|
if (Array.isArray(d.childIds)) {
|
|
61935
|
-
for (const cid of d.childIds)
|
|
61936
|
+
for (const cid of d.childIds) {
|
|
61936
61937
|
childItemIds.add(cid);
|
|
61938
|
+
childToParent.set(cid, itemId);
|
|
61939
|
+
}
|
|
61937
61940
|
}
|
|
61938
61941
|
}
|
|
61939
61942
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -62005,8 +62008,38 @@ class Board {
|
|
|
62005
62008
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
62006
62009
|
itemData.transformation.translateX = newTx;
|
|
62007
62010
|
itemData.transformation.translateY = newTy;
|
|
62011
|
+
const d = itemData;
|
|
62012
|
+
if (d.text && typeof d.text === "object") {
|
|
62013
|
+
const textData = d.text;
|
|
62014
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
62015
|
+
const tt = textData.transformation;
|
|
62016
|
+
tt.translateX = newTx;
|
|
62017
|
+
tt.translateY = newTy;
|
|
62018
|
+
}
|
|
62019
|
+
}
|
|
62008
62020
|
} else if (childItemIds.has(itemId)) {
|
|
62009
|
-
|
|
62021
|
+
const parentId = childToParent.get(itemId);
|
|
62022
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
62023
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
62024
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
62025
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
62026
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
62027
|
+
const newChildTx = parentNewTx + translateX;
|
|
62028
|
+
const newChildTy = parentNewTy + translateY;
|
|
62029
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
62030
|
+
if (itemData.transformation) {
|
|
62031
|
+
itemData.transformation.translateX = newChildTx;
|
|
62032
|
+
itemData.transformation.translateY = newChildTy;
|
|
62033
|
+
const d2 = itemData;
|
|
62034
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62035
|
+
const textData = d2.text;
|
|
62036
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
62037
|
+
const tt = textData.transformation;
|
|
62038
|
+
tt.translateX = newChildTx;
|
|
62039
|
+
tt.translateY = newChildTy;
|
|
62040
|
+
}
|
|
62041
|
+
}
|
|
62042
|
+
}
|
|
62010
62043
|
}
|
|
62011
62044
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
62012
62045
|
const itemDataWithChildren = itemData;
|
|
@@ -62088,9 +62121,22 @@ class Board {
|
|
|
62088
62121
|
}
|
|
62089
62122
|
}
|
|
62090
62123
|
const newMap = {};
|
|
62124
|
+
const dupChildItemIds = new Set;
|
|
62125
|
+
const dupChildToParent = new Map;
|
|
62126
|
+
for (const itemId in itemsMap) {
|
|
62127
|
+
const d = itemsMap[itemId];
|
|
62128
|
+
if (Array.isArray(d.childIds)) {
|
|
62129
|
+
for (const cid of d.childIds) {
|
|
62130
|
+
dupChildItemIds.add(cid);
|
|
62131
|
+
dupChildToParent.set(cid, itemId);
|
|
62132
|
+
}
|
|
62133
|
+
}
|
|
62134
|
+
}
|
|
62091
62135
|
let minX = Infinity;
|
|
62092
62136
|
let minY = Infinity;
|
|
62093
62137
|
for (const itemId in itemsMap) {
|
|
62138
|
+
if (dupChildItemIds.has(itemId))
|
|
62139
|
+
continue;
|
|
62094
62140
|
const itemData = itemsMap[itemId];
|
|
62095
62141
|
const { translateX, translateY } = itemData.transformation || {
|
|
62096
62142
|
translateX: 0,
|
|
@@ -62136,6 +62182,28 @@ class Board {
|
|
|
62136
62182
|
itemData.middlePoint.x += -minX + right + width2;
|
|
62137
62183
|
itemData.middlePoint.y += -minY + top;
|
|
62138
62184
|
}
|
|
62185
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
62186
|
+
const parentId = dupChildToParent.get(itemId);
|
|
62187
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
62188
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
62189
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
62190
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
62191
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
62192
|
+
if (itemData.transformation) {
|
|
62193
|
+
const newChildTx = parentNewTx + translateX;
|
|
62194
|
+
const newChildTy = parentNewTy + translateY;
|
|
62195
|
+
itemData.transformation.translateX = newChildTx;
|
|
62196
|
+
itemData.transformation.translateY = newChildTy;
|
|
62197
|
+
itemData.transformation.isLocked = false;
|
|
62198
|
+
const d2 = itemData;
|
|
62199
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62200
|
+
const tt = d2.text.transformation;
|
|
62201
|
+
if (tt) {
|
|
62202
|
+
tt.translateX = newChildTx;
|
|
62203
|
+
tt.translateY = newChildTy;
|
|
62204
|
+
}
|
|
62205
|
+
}
|
|
62206
|
+
}
|
|
62139
62207
|
} else if (itemData.transformation) {
|
|
62140
62208
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
62141
62209
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -62146,6 +62214,14 @@ class Board {
|
|
|
62146
62214
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
62147
62215
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
62148
62216
|
}
|
|
62217
|
+
const d2 = itemData;
|
|
62218
|
+
if (d2.text && typeof d2.text === "object") {
|
|
62219
|
+
const tt = d2.text.transformation;
|
|
62220
|
+
if (tt) {
|
|
62221
|
+
tt.translateX = itemData.transformation.translateX;
|
|
62222
|
+
tt.translateY = itemData.transformation.translateY;
|
|
62223
|
+
}
|
|
62224
|
+
}
|
|
62149
62225
|
}
|
|
62150
62226
|
const itemDataWithChildren = itemData;
|
|
62151
62227
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|
package/dist/cjs/node.js
CHANGED
|
@@ -64404,11 +64404,14 @@ class Board {
|
|
|
64404
64404
|
}
|
|
64405
64405
|
const newMap = {};
|
|
64406
64406
|
const childItemIds = new Set;
|
|
64407
|
+
const childToParent = new Map;
|
|
64407
64408
|
for (const itemId in itemsMap) {
|
|
64408
64409
|
const d = itemsMap[itemId];
|
|
64409
64410
|
if (Array.isArray(d.childIds)) {
|
|
64410
|
-
for (const cid of d.childIds)
|
|
64411
|
+
for (const cid of d.childIds) {
|
|
64411
64412
|
childItemIds.add(cid);
|
|
64413
|
+
childToParent.set(cid, itemId);
|
|
64414
|
+
}
|
|
64412
64415
|
}
|
|
64413
64416
|
}
|
|
64414
64417
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -64480,8 +64483,38 @@ class Board {
|
|
|
64480
64483
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
64481
64484
|
itemData.transformation.translateX = newTx;
|
|
64482
64485
|
itemData.transformation.translateY = newTy;
|
|
64486
|
+
const d = itemData;
|
|
64487
|
+
if (d.text && typeof d.text === "object") {
|
|
64488
|
+
const textData = d.text;
|
|
64489
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
64490
|
+
const tt = textData.transformation;
|
|
64491
|
+
tt.translateX = newTx;
|
|
64492
|
+
tt.translateY = newTy;
|
|
64493
|
+
}
|
|
64494
|
+
}
|
|
64483
64495
|
} else if (childItemIds.has(itemId)) {
|
|
64484
|
-
|
|
64496
|
+
const parentId = childToParent.get(itemId);
|
|
64497
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
64498
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
64499
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
64500
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
64501
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
64502
|
+
const newChildTx = parentNewTx + translateX;
|
|
64503
|
+
const newChildTy = parentNewTy + translateY;
|
|
64504
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
64505
|
+
if (itemData.transformation) {
|
|
64506
|
+
itemData.transformation.translateX = newChildTx;
|
|
64507
|
+
itemData.transformation.translateY = newChildTy;
|
|
64508
|
+
const d2 = itemData;
|
|
64509
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64510
|
+
const textData = d2.text;
|
|
64511
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
64512
|
+
const tt = textData.transformation;
|
|
64513
|
+
tt.translateX = newChildTx;
|
|
64514
|
+
tt.translateY = newChildTy;
|
|
64515
|
+
}
|
|
64516
|
+
}
|
|
64517
|
+
}
|
|
64485
64518
|
}
|
|
64486
64519
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
64487
64520
|
const itemDataWithChildren = itemData;
|
|
@@ -64563,9 +64596,22 @@ class Board {
|
|
|
64563
64596
|
}
|
|
64564
64597
|
}
|
|
64565
64598
|
const newMap = {};
|
|
64599
|
+
const dupChildItemIds = new Set;
|
|
64600
|
+
const dupChildToParent = new Map;
|
|
64601
|
+
for (const itemId in itemsMap) {
|
|
64602
|
+
const d = itemsMap[itemId];
|
|
64603
|
+
if (Array.isArray(d.childIds)) {
|
|
64604
|
+
for (const cid of d.childIds) {
|
|
64605
|
+
dupChildItemIds.add(cid);
|
|
64606
|
+
dupChildToParent.set(cid, itemId);
|
|
64607
|
+
}
|
|
64608
|
+
}
|
|
64609
|
+
}
|
|
64566
64610
|
let minX = Infinity;
|
|
64567
64611
|
let minY = Infinity;
|
|
64568
64612
|
for (const itemId in itemsMap) {
|
|
64613
|
+
if (dupChildItemIds.has(itemId))
|
|
64614
|
+
continue;
|
|
64569
64615
|
const itemData = itemsMap[itemId];
|
|
64570
64616
|
const { translateX, translateY } = itemData.transformation || {
|
|
64571
64617
|
translateX: 0,
|
|
@@ -64611,6 +64657,28 @@ class Board {
|
|
|
64611
64657
|
itemData.middlePoint.x += -minX + right + width2;
|
|
64612
64658
|
itemData.middlePoint.y += -minY + top;
|
|
64613
64659
|
}
|
|
64660
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
64661
|
+
const parentId = dupChildToParent.get(itemId);
|
|
64662
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
64663
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
64664
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
64665
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
64666
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
64667
|
+
if (itemData.transformation) {
|
|
64668
|
+
const newChildTx = parentNewTx + translateX;
|
|
64669
|
+
const newChildTy = parentNewTy + translateY;
|
|
64670
|
+
itemData.transformation.translateX = newChildTx;
|
|
64671
|
+
itemData.transformation.translateY = newChildTy;
|
|
64672
|
+
itemData.transformation.isLocked = false;
|
|
64673
|
+
const d2 = itemData;
|
|
64674
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64675
|
+
const tt = d2.text.transformation;
|
|
64676
|
+
if (tt) {
|
|
64677
|
+
tt.translateX = newChildTx;
|
|
64678
|
+
tt.translateY = newChildTy;
|
|
64679
|
+
}
|
|
64680
|
+
}
|
|
64681
|
+
}
|
|
64614
64682
|
} else if (itemData.transformation) {
|
|
64615
64683
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
64616
64684
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -64621,6 +64689,14 @@ class Board {
|
|
|
64621
64689
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
64622
64690
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
64623
64691
|
}
|
|
64692
|
+
const d2 = itemData;
|
|
64693
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64694
|
+
const tt = d2.text.transformation;
|
|
64695
|
+
if (tt) {
|
|
64696
|
+
tt.translateX = itemData.transformation.translateX;
|
|
64697
|
+
tt.translateY = itemData.transformation.translateY;
|
|
64698
|
+
}
|
|
64699
|
+
}
|
|
64624
64700
|
}
|
|
64625
64701
|
const itemDataWithChildren = itemData;
|
|
64626
64702
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|
package/dist/esm/browser.js
CHANGED
|
@@ -61672,11 +61672,14 @@ class Board {
|
|
|
61672
61672
|
}
|
|
61673
61673
|
const newMap = {};
|
|
61674
61674
|
const childItemIds = new Set;
|
|
61675
|
+
const childToParent = new Map;
|
|
61675
61676
|
for (const itemId in itemsMap) {
|
|
61676
61677
|
const d = itemsMap[itemId];
|
|
61677
61678
|
if (Array.isArray(d.childIds)) {
|
|
61678
|
-
for (const cid of d.childIds)
|
|
61679
|
+
for (const cid of d.childIds) {
|
|
61679
61680
|
childItemIds.add(cid);
|
|
61681
|
+
childToParent.set(cid, itemId);
|
|
61682
|
+
}
|
|
61680
61683
|
}
|
|
61681
61684
|
}
|
|
61682
61685
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -61748,8 +61751,38 @@ class Board {
|
|
|
61748
61751
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
61749
61752
|
itemData.transformation.translateX = newTx;
|
|
61750
61753
|
itemData.transformation.translateY = newTy;
|
|
61754
|
+
const d = itemData;
|
|
61755
|
+
if (d.text && typeof d.text === "object") {
|
|
61756
|
+
const textData = d.text;
|
|
61757
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
61758
|
+
const tt = textData.transformation;
|
|
61759
|
+
tt.translateX = newTx;
|
|
61760
|
+
tt.translateY = newTy;
|
|
61761
|
+
}
|
|
61762
|
+
}
|
|
61751
61763
|
} else if (childItemIds.has(itemId)) {
|
|
61752
|
-
|
|
61764
|
+
const parentId = childToParent.get(itemId);
|
|
61765
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
61766
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
61767
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
61768
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
61769
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
61770
|
+
const newChildTx = parentNewTx + translateX;
|
|
61771
|
+
const newChildTy = parentNewTy + translateY;
|
|
61772
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
61773
|
+
if (itemData.transformation) {
|
|
61774
|
+
itemData.transformation.translateX = newChildTx;
|
|
61775
|
+
itemData.transformation.translateY = newChildTy;
|
|
61776
|
+
const d2 = itemData;
|
|
61777
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61778
|
+
const textData = d2.text;
|
|
61779
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
61780
|
+
const tt = textData.transformation;
|
|
61781
|
+
tt.translateX = newChildTx;
|
|
61782
|
+
tt.translateY = newChildTy;
|
|
61783
|
+
}
|
|
61784
|
+
}
|
|
61785
|
+
}
|
|
61753
61786
|
}
|
|
61754
61787
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
61755
61788
|
const itemDataWithChildren = itemData;
|
|
@@ -61831,9 +61864,22 @@ class Board {
|
|
|
61831
61864
|
}
|
|
61832
61865
|
}
|
|
61833
61866
|
const newMap = {};
|
|
61867
|
+
const dupChildItemIds = new Set;
|
|
61868
|
+
const dupChildToParent = new Map;
|
|
61869
|
+
for (const itemId in itemsMap) {
|
|
61870
|
+
const d = itemsMap[itemId];
|
|
61871
|
+
if (Array.isArray(d.childIds)) {
|
|
61872
|
+
for (const cid of d.childIds) {
|
|
61873
|
+
dupChildItemIds.add(cid);
|
|
61874
|
+
dupChildToParent.set(cid, itemId);
|
|
61875
|
+
}
|
|
61876
|
+
}
|
|
61877
|
+
}
|
|
61834
61878
|
let minX = Infinity;
|
|
61835
61879
|
let minY = Infinity;
|
|
61836
61880
|
for (const itemId in itemsMap) {
|
|
61881
|
+
if (dupChildItemIds.has(itemId))
|
|
61882
|
+
continue;
|
|
61837
61883
|
const itemData = itemsMap[itemId];
|
|
61838
61884
|
const { translateX, translateY } = itemData.transformation || {
|
|
61839
61885
|
translateX: 0,
|
|
@@ -61879,6 +61925,28 @@ class Board {
|
|
|
61879
61925
|
itemData.middlePoint.x += -minX + right + width2;
|
|
61880
61926
|
itemData.middlePoint.y += -minY + top;
|
|
61881
61927
|
}
|
|
61928
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
61929
|
+
const parentId = dupChildToParent.get(itemId);
|
|
61930
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
61931
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
61932
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
61933
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
61934
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
61935
|
+
if (itemData.transformation) {
|
|
61936
|
+
const newChildTx = parentNewTx + translateX;
|
|
61937
|
+
const newChildTy = parentNewTy + translateY;
|
|
61938
|
+
itemData.transformation.translateX = newChildTx;
|
|
61939
|
+
itemData.transformation.translateY = newChildTy;
|
|
61940
|
+
itemData.transformation.isLocked = false;
|
|
61941
|
+
const d2 = itemData;
|
|
61942
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61943
|
+
const tt = d2.text.transformation;
|
|
61944
|
+
if (tt) {
|
|
61945
|
+
tt.translateX = newChildTx;
|
|
61946
|
+
tt.translateY = newChildTy;
|
|
61947
|
+
}
|
|
61948
|
+
}
|
|
61949
|
+
}
|
|
61882
61950
|
} else if (itemData.transformation) {
|
|
61883
61951
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
61884
61952
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -61889,6 +61957,14 @@ class Board {
|
|
|
61889
61957
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
61890
61958
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
61891
61959
|
}
|
|
61960
|
+
const d2 = itemData;
|
|
61961
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61962
|
+
const tt = d2.text.transformation;
|
|
61963
|
+
if (tt) {
|
|
61964
|
+
tt.translateX = itemData.transformation.translateX;
|
|
61965
|
+
tt.translateY = itemData.transformation.translateY;
|
|
61966
|
+
}
|
|
61967
|
+
}
|
|
61892
61968
|
}
|
|
61893
61969
|
const itemDataWithChildren = itemData;
|
|
61894
61970
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|
package/dist/esm/index.js
CHANGED
|
@@ -61665,11 +61665,14 @@ class Board {
|
|
|
61665
61665
|
}
|
|
61666
61666
|
const newMap = {};
|
|
61667
61667
|
const childItemIds = new Set;
|
|
61668
|
+
const childToParent = new Map;
|
|
61668
61669
|
for (const itemId in itemsMap) {
|
|
61669
61670
|
const d = itemsMap[itemId];
|
|
61670
61671
|
if (Array.isArray(d.childIds)) {
|
|
61671
|
-
for (const cid of d.childIds)
|
|
61672
|
+
for (const cid of d.childIds) {
|
|
61672
61673
|
childItemIds.add(cid);
|
|
61674
|
+
childToParent.set(cid, itemId);
|
|
61675
|
+
}
|
|
61673
61676
|
}
|
|
61674
61677
|
}
|
|
61675
61678
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -61741,8 +61744,38 @@ class Board {
|
|
|
61741
61744
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
61742
61745
|
itemData.transformation.translateX = newTx;
|
|
61743
61746
|
itemData.transformation.translateY = newTy;
|
|
61747
|
+
const d = itemData;
|
|
61748
|
+
if (d.text && typeof d.text === "object") {
|
|
61749
|
+
const textData = d.text;
|
|
61750
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
61751
|
+
const tt = textData.transformation;
|
|
61752
|
+
tt.translateX = newTx;
|
|
61753
|
+
tt.translateY = newTy;
|
|
61754
|
+
}
|
|
61755
|
+
}
|
|
61744
61756
|
} else if (childItemIds.has(itemId)) {
|
|
61745
|
-
|
|
61757
|
+
const parentId = childToParent.get(itemId);
|
|
61758
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
61759
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
61760
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
61761
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
61762
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
61763
|
+
const newChildTx = parentNewTx + translateX;
|
|
61764
|
+
const newChildTy = parentNewTy + translateY;
|
|
61765
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
61766
|
+
if (itemData.transformation) {
|
|
61767
|
+
itemData.transformation.translateX = newChildTx;
|
|
61768
|
+
itemData.transformation.translateY = newChildTy;
|
|
61769
|
+
const d2 = itemData;
|
|
61770
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61771
|
+
const textData = d2.text;
|
|
61772
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
61773
|
+
const tt = textData.transformation;
|
|
61774
|
+
tt.translateX = newChildTx;
|
|
61775
|
+
tt.translateY = newChildTy;
|
|
61776
|
+
}
|
|
61777
|
+
}
|
|
61778
|
+
}
|
|
61746
61779
|
}
|
|
61747
61780
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
61748
61781
|
const itemDataWithChildren = itemData;
|
|
@@ -61824,9 +61857,22 @@ class Board {
|
|
|
61824
61857
|
}
|
|
61825
61858
|
}
|
|
61826
61859
|
const newMap = {};
|
|
61860
|
+
const dupChildItemIds = new Set;
|
|
61861
|
+
const dupChildToParent = new Map;
|
|
61862
|
+
for (const itemId in itemsMap) {
|
|
61863
|
+
const d = itemsMap[itemId];
|
|
61864
|
+
if (Array.isArray(d.childIds)) {
|
|
61865
|
+
for (const cid of d.childIds) {
|
|
61866
|
+
dupChildItemIds.add(cid);
|
|
61867
|
+
dupChildToParent.set(cid, itemId);
|
|
61868
|
+
}
|
|
61869
|
+
}
|
|
61870
|
+
}
|
|
61827
61871
|
let minX = Infinity;
|
|
61828
61872
|
let minY = Infinity;
|
|
61829
61873
|
for (const itemId in itemsMap) {
|
|
61874
|
+
if (dupChildItemIds.has(itemId))
|
|
61875
|
+
continue;
|
|
61830
61876
|
const itemData = itemsMap[itemId];
|
|
61831
61877
|
const { translateX, translateY } = itemData.transformation || {
|
|
61832
61878
|
translateX: 0,
|
|
@@ -61872,6 +61918,28 @@ class Board {
|
|
|
61872
61918
|
itemData.middlePoint.x += -minX + right + width2;
|
|
61873
61919
|
itemData.middlePoint.y += -minY + top;
|
|
61874
61920
|
}
|
|
61921
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
61922
|
+
const parentId = dupChildToParent.get(itemId);
|
|
61923
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
61924
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
61925
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
61926
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
61927
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
61928
|
+
if (itemData.transformation) {
|
|
61929
|
+
const newChildTx = parentNewTx + translateX;
|
|
61930
|
+
const newChildTy = parentNewTy + translateY;
|
|
61931
|
+
itemData.transformation.translateX = newChildTx;
|
|
61932
|
+
itemData.transformation.translateY = newChildTy;
|
|
61933
|
+
itemData.transformation.isLocked = false;
|
|
61934
|
+
const d2 = itemData;
|
|
61935
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61936
|
+
const tt = d2.text.transformation;
|
|
61937
|
+
if (tt) {
|
|
61938
|
+
tt.translateX = newChildTx;
|
|
61939
|
+
tt.translateY = newChildTy;
|
|
61940
|
+
}
|
|
61941
|
+
}
|
|
61942
|
+
}
|
|
61875
61943
|
} else if (itemData.transformation) {
|
|
61876
61944
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
61877
61945
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -61882,6 +61950,14 @@ class Board {
|
|
|
61882
61950
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
61883
61951
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
61884
61952
|
}
|
|
61953
|
+
const d2 = itemData;
|
|
61954
|
+
if (d2.text && typeof d2.text === "object") {
|
|
61955
|
+
const tt = d2.text.transformation;
|
|
61956
|
+
if (tt) {
|
|
61957
|
+
tt.translateX = itemData.transformation.translateX;
|
|
61958
|
+
tt.translateY = itemData.transformation.translateY;
|
|
61959
|
+
}
|
|
61960
|
+
}
|
|
61885
61961
|
}
|
|
61886
61962
|
const itemDataWithChildren = itemData;
|
|
61887
61963
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|
package/dist/esm/node.js
CHANGED
|
@@ -64129,11 +64129,14 @@ class Board {
|
|
|
64129
64129
|
}
|
|
64130
64130
|
const newMap = {};
|
|
64131
64131
|
const childItemIds = new Set;
|
|
64132
|
+
const childToParent = new Map;
|
|
64132
64133
|
for (const itemId in itemsMap) {
|
|
64133
64134
|
const d = itemsMap[itemId];
|
|
64134
64135
|
if (Array.isArray(d.childIds)) {
|
|
64135
|
-
for (const cid of d.childIds)
|
|
64136
|
+
for (const cid of d.childIds) {
|
|
64136
64137
|
childItemIds.add(cid);
|
|
64138
|
+
childToParent.set(cid, itemId);
|
|
64139
|
+
}
|
|
64137
64140
|
}
|
|
64138
64141
|
}
|
|
64139
64142
|
console.log("[paste] childItemIds:", [...childItemIds]);
|
|
@@ -64205,8 +64208,38 @@ class Board {
|
|
|
64205
64208
|
console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
|
|
64206
64209
|
itemData.transformation.translateX = newTx;
|
|
64207
64210
|
itemData.transformation.translateY = newTy;
|
|
64211
|
+
const d = itemData;
|
|
64212
|
+
if (d.text && typeof d.text === "object") {
|
|
64213
|
+
const textData = d.text;
|
|
64214
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
64215
|
+
const tt = textData.transformation;
|
|
64216
|
+
tt.translateX = newTx;
|
|
64217
|
+
tt.translateY = newTy;
|
|
64218
|
+
}
|
|
64219
|
+
}
|
|
64208
64220
|
} else if (childItemIds.has(itemId)) {
|
|
64209
|
-
|
|
64221
|
+
const parentId = childToParent.get(itemId);
|
|
64222
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
64223
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
64224
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
64225
|
+
const parentNewTx = parentOrigTx - minX + x;
|
|
64226
|
+
const parentNewTy = parentOrigTy - minY + y;
|
|
64227
|
+
const newChildTx = parentNewTx + translateX;
|
|
64228
|
+
const newChildTy = parentNewTy + translateY;
|
|
64229
|
+
console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
|
|
64230
|
+
if (itemData.transformation) {
|
|
64231
|
+
itemData.transformation.translateX = newChildTx;
|
|
64232
|
+
itemData.transformation.translateY = newChildTy;
|
|
64233
|
+
const d2 = itemData;
|
|
64234
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64235
|
+
const textData = d2.text;
|
|
64236
|
+
if (textData.transformation && typeof textData.transformation === "object") {
|
|
64237
|
+
const tt = textData.transformation;
|
|
64238
|
+
tt.translateX = newChildTx;
|
|
64239
|
+
tt.translateY = newChildTy;
|
|
64240
|
+
}
|
|
64241
|
+
}
|
|
64242
|
+
}
|
|
64210
64243
|
}
|
|
64211
64244
|
if (itemData.itemType !== "RichText" && "childIds" in itemData && itemData.childIds?.length) {
|
|
64212
64245
|
const itemDataWithChildren = itemData;
|
|
@@ -64288,9 +64321,22 @@ class Board {
|
|
|
64288
64321
|
}
|
|
64289
64322
|
}
|
|
64290
64323
|
const newMap = {};
|
|
64324
|
+
const dupChildItemIds = new Set;
|
|
64325
|
+
const dupChildToParent = new Map;
|
|
64326
|
+
for (const itemId in itemsMap) {
|
|
64327
|
+
const d = itemsMap[itemId];
|
|
64328
|
+
if (Array.isArray(d.childIds)) {
|
|
64329
|
+
for (const cid of d.childIds) {
|
|
64330
|
+
dupChildItemIds.add(cid);
|
|
64331
|
+
dupChildToParent.set(cid, itemId);
|
|
64332
|
+
}
|
|
64333
|
+
}
|
|
64334
|
+
}
|
|
64291
64335
|
let minX = Infinity;
|
|
64292
64336
|
let minY = Infinity;
|
|
64293
64337
|
for (const itemId in itemsMap) {
|
|
64338
|
+
if (dupChildItemIds.has(itemId))
|
|
64339
|
+
continue;
|
|
64294
64340
|
const itemData = itemsMap[itemId];
|
|
64295
64341
|
const { translateX, translateY } = itemData.transformation || {
|
|
64296
64342
|
translateX: 0,
|
|
@@ -64336,6 +64382,28 @@ class Board {
|
|
|
64336
64382
|
itemData.middlePoint.x += -minX + right + width2;
|
|
64337
64383
|
itemData.middlePoint.y += -minY + top;
|
|
64338
64384
|
}
|
|
64385
|
+
} else if (dupChildItemIds.has(itemId)) {
|
|
64386
|
+
const parentId = dupChildToParent.get(itemId);
|
|
64387
|
+
const parentData = parentId ? itemsMap[parentId] : undefined;
|
|
64388
|
+
const parentOrigTx = parentData?.transformation?.translateX ?? 0;
|
|
64389
|
+
const parentOrigTy = parentData?.transformation?.translateY ?? 0;
|
|
64390
|
+
const parentNewTx = parentOrigTx - minX + right + width2;
|
|
64391
|
+
const parentNewTy = parentOrigTy - minY + top;
|
|
64392
|
+
if (itemData.transformation) {
|
|
64393
|
+
const newChildTx = parentNewTx + translateX;
|
|
64394
|
+
const newChildTy = parentNewTy + translateY;
|
|
64395
|
+
itemData.transformation.translateX = newChildTx;
|
|
64396
|
+
itemData.transformation.translateY = newChildTy;
|
|
64397
|
+
itemData.transformation.isLocked = false;
|
|
64398
|
+
const d2 = itemData;
|
|
64399
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64400
|
+
const tt = d2.text.transformation;
|
|
64401
|
+
if (tt) {
|
|
64402
|
+
tt.translateX = newChildTx;
|
|
64403
|
+
tt.translateY = newChildTy;
|
|
64404
|
+
}
|
|
64405
|
+
}
|
|
64406
|
+
}
|
|
64339
64407
|
} else if (itemData.transformation) {
|
|
64340
64408
|
itemData.transformation.translateX = translateX - minX + right + width2;
|
|
64341
64409
|
itemData.transformation.translateY = translateY - minY + top;
|
|
@@ -64346,6 +64414,14 @@ class Board {
|
|
|
64346
64414
|
if (height3 === 0 || isSelectedItemsMinWidth) {
|
|
64347
64415
|
itemData.transformation.translateX = translateX + width2 * 10 + 10;
|
|
64348
64416
|
}
|
|
64417
|
+
const d2 = itemData;
|
|
64418
|
+
if (d2.text && typeof d2.text === "object") {
|
|
64419
|
+
const tt = d2.text.transformation;
|
|
64420
|
+
if (tt) {
|
|
64421
|
+
tt.translateX = itemData.transformation.translateX;
|
|
64422
|
+
tt.translateY = itemData.transformation.translateY;
|
|
64423
|
+
}
|
|
64424
|
+
}
|
|
64349
64425
|
}
|
|
64350
64426
|
const itemDataWithChildren = itemData;
|
|
64351
64427
|
if ("childIds" in itemDataWithChildren && itemDataWithChildren.childIds?.length) {
|