microboard-temp 0.13.69 → 0.13.71

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.
@@ -61939,14 +61939,6 @@ class Board {
61939
61939
  }
61940
61940
  }
61941
61941
  }
61942
- console.log("[paste] childItemIds:", [...childItemIds]);
61943
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
61944
- id,
61945
- type: d.itemType,
61946
- tx: d.transformation?.translateX,
61947
- ty: d.transformation?.translateY,
61948
- isChild: childItemIds.has(id)
61949
- })));
61950
61942
  let minX = Infinity;
61951
61943
  let minY = Infinity;
61952
61944
  for (const itemId in itemsMap) {
@@ -61971,7 +61963,11 @@ class Board {
61971
61963
  minY = 0;
61972
61964
  }
61973
61965
  const { x, y } = this.pointer.point;
61974
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
61966
+ const originalTranslations = new Map;
61967
+ for (const itemId in itemsMap) {
61968
+ const t3 = itemsMap[itemId].transformation;
61969
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61970
+ }
61975
61971
  const mediaStorageIds = [];
61976
61972
  for (const itemId in itemsMap) {
61977
61973
  const itemData = itemsMap[itemId];
@@ -62005,7 +62001,6 @@ class Board {
62005
62001
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
62006
62002
  const newTx = translateX - minX + x;
62007
62003
  const newTy = translateY - minY + y;
62008
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
62009
62004
  itemData.transformation.translateX = newTx;
62010
62005
  itemData.transformation.translateY = newTy;
62011
62006
  const d = itemData;
@@ -62019,14 +62014,13 @@ class Board {
62019
62014
  }
62020
62015
  } else if (childItemIds.has(itemId)) {
62021
62016
  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;
62017
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
62018
+ const parentOrigTx = parentOrig?.tx ?? 0;
62019
+ const parentOrigTy = parentOrig?.ty ?? 0;
62025
62020
  const parentNewTx = parentOrigTx - minX + x;
62026
62021
  const parentNewTy = parentOrigTy - minY + y;
62027
62022
  const newChildTx = parentNewTx + translateX;
62028
62023
  const newChildTy = parentNewTy + translateY;
62029
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
62030
62024
  if (itemData.transformation) {
62031
62025
  itemData.transformation.translateX = newChildTx;
62032
62026
  itemData.transformation.translateY = newChildTy;
@@ -62060,16 +62054,7 @@ class Board {
62060
62054
  select: select2
62061
62055
  });
62062
62056
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
62063
- for (const item of items) {
62064
- const mbr = item.getMbr();
62065
- const pos = item.transformation.getTranslation();
62066
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
62067
- }
62068
62057
  this.handleNesting(items);
62069
- for (const item of items) {
62070
- const pos = item.transformation.getTranslation();
62071
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
62072
- }
62073
62058
  this.selection.removeAll();
62074
62059
  this.selection.add(items);
62075
62060
  this.selection.setContext("EditUnderPointer");
@@ -62164,6 +62149,11 @@ class Board {
62164
62149
  if (minY === Infinity) {
62165
62150
  minY = 0;
62166
62151
  }
62152
+ const dupOriginalTranslations = new Map;
62153
+ for (const itemId in itemsMap) {
62154
+ const t3 = itemsMap[itemId].transformation;
62155
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
62156
+ }
62167
62157
  const mbr = this.selection.getMbr();
62168
62158
  const selectedItems = this.selection.items.list();
62169
62159
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -62193,9 +62183,9 @@ class Board {
62193
62183
  }
62194
62184
  } else if (dupChildItemIds.has(itemId)) {
62195
62185
  const parentId = dupChildToParent.get(itemId);
62196
- const parentData = parentId ? itemsMap[parentId] : undefined;
62197
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
62198
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
62186
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
62187
+ const parentOrigTx = parentOrig?.tx ?? 0;
62188
+ const parentOrigTy = parentOrig?.ty ?? 0;
62199
62189
  const parentNewTx = parentOrigTx - minX + right + width2;
62200
62190
  const parentNewTy = parentOrigTy - minY + top;
62201
62191
  if (itemData.transformation) {
package/dist/cjs/index.js CHANGED
@@ -61939,14 +61939,6 @@ class Board {
61939
61939
  }
61940
61940
  }
61941
61941
  }
61942
- console.log("[paste] childItemIds:", [...childItemIds]);
61943
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
61944
- id,
61945
- type: d.itemType,
61946
- tx: d.transformation?.translateX,
61947
- ty: d.transformation?.translateY,
61948
- isChild: childItemIds.has(id)
61949
- })));
61950
61942
  let minX = Infinity;
61951
61943
  let minY = Infinity;
61952
61944
  for (const itemId in itemsMap) {
@@ -61971,7 +61963,11 @@ class Board {
61971
61963
  minY = 0;
61972
61964
  }
61973
61965
  const { x, y } = this.pointer.point;
61974
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
61966
+ const originalTranslations = new Map;
61967
+ for (const itemId in itemsMap) {
61968
+ const t3 = itemsMap[itemId].transformation;
61969
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61970
+ }
61975
61971
  const mediaStorageIds = [];
61976
61972
  for (const itemId in itemsMap) {
61977
61973
  const itemData = itemsMap[itemId];
@@ -62005,7 +62001,6 @@ class Board {
62005
62001
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
62006
62002
  const newTx = translateX - minX + x;
62007
62003
  const newTy = translateY - minY + y;
62008
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
62009
62004
  itemData.transformation.translateX = newTx;
62010
62005
  itemData.transformation.translateY = newTy;
62011
62006
  const d = itemData;
@@ -62019,14 +62014,13 @@ class Board {
62019
62014
  }
62020
62015
  } else if (childItemIds.has(itemId)) {
62021
62016
  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;
62017
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
62018
+ const parentOrigTx = parentOrig?.tx ?? 0;
62019
+ const parentOrigTy = parentOrig?.ty ?? 0;
62025
62020
  const parentNewTx = parentOrigTx - minX + x;
62026
62021
  const parentNewTy = parentOrigTy - minY + y;
62027
62022
  const newChildTx = parentNewTx + translateX;
62028
62023
  const newChildTy = parentNewTy + translateY;
62029
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
62030
62024
  if (itemData.transformation) {
62031
62025
  itemData.transformation.translateX = newChildTx;
62032
62026
  itemData.transformation.translateY = newChildTy;
@@ -62060,16 +62054,7 @@ class Board {
62060
62054
  select: select2
62061
62055
  });
62062
62056
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
62063
- for (const item of items) {
62064
- const mbr = item.getMbr();
62065
- const pos = item.transformation.getTranslation();
62066
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
62067
- }
62068
62057
  this.handleNesting(items);
62069
- for (const item of items) {
62070
- const pos = item.transformation.getTranslation();
62071
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
62072
- }
62073
62058
  this.selection.removeAll();
62074
62059
  this.selection.add(items);
62075
62060
  this.selection.setContext("EditUnderPointer");
@@ -62164,6 +62149,11 @@ class Board {
62164
62149
  if (minY === Infinity) {
62165
62150
  minY = 0;
62166
62151
  }
62152
+ const dupOriginalTranslations = new Map;
62153
+ for (const itemId in itemsMap) {
62154
+ const t3 = itemsMap[itemId].transformation;
62155
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
62156
+ }
62167
62157
  const mbr = this.selection.getMbr();
62168
62158
  const selectedItems = this.selection.items.list();
62169
62159
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -62193,9 +62183,9 @@ class Board {
62193
62183
  }
62194
62184
  } else if (dupChildItemIds.has(itemId)) {
62195
62185
  const parentId = dupChildToParent.get(itemId);
62196
- const parentData = parentId ? itemsMap[parentId] : undefined;
62197
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
62198
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
62186
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
62187
+ const parentOrigTx = parentOrig?.tx ?? 0;
62188
+ const parentOrigTy = parentOrig?.ty ?? 0;
62199
62189
  const parentNewTx = parentOrigTx - minX + right + width2;
62200
62190
  const parentNewTy = parentOrigTy - minY + top;
62201
62191
  if (itemData.transformation) {
package/dist/cjs/node.js CHANGED
@@ -64414,14 +64414,6 @@ class Board {
64414
64414
  }
64415
64415
  }
64416
64416
  }
64417
- console.log("[paste] childItemIds:", [...childItemIds]);
64418
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
64419
- id,
64420
- type: d.itemType,
64421
- tx: d.transformation?.translateX,
64422
- ty: d.transformation?.translateY,
64423
- isChild: childItemIds.has(id)
64424
- })));
64425
64417
  let minX = Infinity;
64426
64418
  let minY = Infinity;
64427
64419
  for (const itemId in itemsMap) {
@@ -64446,7 +64438,11 @@ class Board {
64446
64438
  minY = 0;
64447
64439
  }
64448
64440
  const { x, y } = this.pointer.point;
64449
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
64441
+ const originalTranslations = new Map;
64442
+ for (const itemId in itemsMap) {
64443
+ const t3 = itemsMap[itemId].transformation;
64444
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
64445
+ }
64450
64446
  const mediaStorageIds = [];
64451
64447
  for (const itemId in itemsMap) {
64452
64448
  const itemData = itemsMap[itemId];
@@ -64480,7 +64476,6 @@ class Board {
64480
64476
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
64481
64477
  const newTx = translateX - minX + x;
64482
64478
  const newTy = translateY - minY + y;
64483
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
64484
64479
  itemData.transformation.translateX = newTx;
64485
64480
  itemData.transformation.translateY = newTy;
64486
64481
  const d = itemData;
@@ -64494,14 +64489,13 @@ class Board {
64494
64489
  }
64495
64490
  } else if (childItemIds.has(itemId)) {
64496
64491
  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;
64492
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
64493
+ const parentOrigTx = parentOrig?.tx ?? 0;
64494
+ const parentOrigTy = parentOrig?.ty ?? 0;
64500
64495
  const parentNewTx = parentOrigTx - minX + x;
64501
64496
  const parentNewTy = parentOrigTy - minY + y;
64502
64497
  const newChildTx = parentNewTx + translateX;
64503
64498
  const newChildTy = parentNewTy + translateY;
64504
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
64505
64499
  if (itemData.transformation) {
64506
64500
  itemData.transformation.translateX = newChildTx;
64507
64501
  itemData.transformation.translateY = newChildTy;
@@ -64535,16 +64529,7 @@ class Board {
64535
64529
  select: select2
64536
64530
  });
64537
64531
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
64538
- for (const item of items) {
64539
- const mbr = item.getMbr();
64540
- const pos = item.transformation.getTranslation();
64541
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
64542
- }
64543
64532
  this.handleNesting(items);
64544
- for (const item of items) {
64545
- const pos = item.transformation.getTranslation();
64546
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
64547
- }
64548
64533
  this.selection.removeAll();
64549
64534
  this.selection.add(items);
64550
64535
  this.selection.setContext("EditUnderPointer");
@@ -64639,6 +64624,11 @@ class Board {
64639
64624
  if (minY === Infinity) {
64640
64625
  minY = 0;
64641
64626
  }
64627
+ const dupOriginalTranslations = new Map;
64628
+ for (const itemId in itemsMap) {
64629
+ const t3 = itemsMap[itemId].transformation;
64630
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
64631
+ }
64642
64632
  const mbr = this.selection.getMbr();
64643
64633
  const selectedItems = this.selection.items.list();
64644
64634
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -64668,9 +64658,9 @@ class Board {
64668
64658
  }
64669
64659
  } else if (dupChildItemIds.has(itemId)) {
64670
64660
  const parentId = dupChildToParent.get(itemId);
64671
- const parentData = parentId ? itemsMap[parentId] : undefined;
64672
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
64673
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
64661
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
64662
+ const parentOrigTx = parentOrig?.tx ?? 0;
64663
+ const parentOrigTy = parentOrig?.ty ?? 0;
64674
64664
  const parentNewTx = parentOrigTx - minX + right + width2;
64675
64665
  const parentNewTy = parentOrigTy - minY + top;
64676
64666
  if (itemData.transformation) {
@@ -61682,14 +61682,6 @@ class Board {
61682
61682
  }
61683
61683
  }
61684
61684
  }
61685
- console.log("[paste] childItemIds:", [...childItemIds]);
61686
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
61687
- id,
61688
- type: d.itemType,
61689
- tx: d.transformation?.translateX,
61690
- ty: d.transformation?.translateY,
61691
- isChild: childItemIds.has(id)
61692
- })));
61693
61685
  let minX = Infinity;
61694
61686
  let minY = Infinity;
61695
61687
  for (const itemId in itemsMap) {
@@ -61714,7 +61706,11 @@ class Board {
61714
61706
  minY = 0;
61715
61707
  }
61716
61708
  const { x, y } = this.pointer.point;
61717
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
61709
+ const originalTranslations = new Map;
61710
+ for (const itemId in itemsMap) {
61711
+ const t3 = itemsMap[itemId].transformation;
61712
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61713
+ }
61718
61714
  const mediaStorageIds = [];
61719
61715
  for (const itemId in itemsMap) {
61720
61716
  const itemData = itemsMap[itemId];
@@ -61748,7 +61744,6 @@ class Board {
61748
61744
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
61749
61745
  const newTx = translateX - minX + x;
61750
61746
  const newTy = translateY - minY + y;
61751
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
61752
61747
  itemData.transformation.translateX = newTx;
61753
61748
  itemData.transformation.translateY = newTy;
61754
61749
  const d = itemData;
@@ -61762,14 +61757,13 @@ class Board {
61762
61757
  }
61763
61758
  } else if (childItemIds.has(itemId)) {
61764
61759
  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;
61760
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
61761
+ const parentOrigTx = parentOrig?.tx ?? 0;
61762
+ const parentOrigTy = parentOrig?.ty ?? 0;
61768
61763
  const parentNewTx = parentOrigTx - minX + x;
61769
61764
  const parentNewTy = parentOrigTy - minY + y;
61770
61765
  const newChildTx = parentNewTx + translateX;
61771
61766
  const newChildTy = parentNewTy + translateY;
61772
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
61773
61767
  if (itemData.transformation) {
61774
61768
  itemData.transformation.translateX = newChildTx;
61775
61769
  itemData.transformation.translateY = newChildTy;
@@ -61803,16 +61797,7 @@ class Board {
61803
61797
  select: select2
61804
61798
  });
61805
61799
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
61806
- for (const item of items) {
61807
- const mbr = item.getMbr();
61808
- const pos = item.transformation.getTranslation();
61809
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
61810
- }
61811
61800
  this.handleNesting(items);
61812
- for (const item of items) {
61813
- const pos = item.transformation.getTranslation();
61814
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
61815
- }
61816
61801
  this.selection.removeAll();
61817
61802
  this.selection.add(items);
61818
61803
  this.selection.setContext("EditUnderPointer");
@@ -61907,6 +61892,11 @@ class Board {
61907
61892
  if (minY === Infinity) {
61908
61893
  minY = 0;
61909
61894
  }
61895
+ const dupOriginalTranslations = new Map;
61896
+ for (const itemId in itemsMap) {
61897
+ const t3 = itemsMap[itemId].transformation;
61898
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61899
+ }
61910
61900
  const mbr = this.selection.getMbr();
61911
61901
  const selectedItems = this.selection.items.list();
61912
61902
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -61936,9 +61926,9 @@ class Board {
61936
61926
  }
61937
61927
  } else if (dupChildItemIds.has(itemId)) {
61938
61928
  const parentId = dupChildToParent.get(itemId);
61939
- const parentData = parentId ? itemsMap[parentId] : undefined;
61940
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
61941
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
61929
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
61930
+ const parentOrigTx = parentOrig?.tx ?? 0;
61931
+ const parentOrigTy = parentOrig?.ty ?? 0;
61942
61932
  const parentNewTx = parentOrigTx - minX + right + width2;
61943
61933
  const parentNewTy = parentOrigTy - minY + top;
61944
61934
  if (itemData.transformation) {
package/dist/esm/index.js CHANGED
@@ -61675,14 +61675,6 @@ class Board {
61675
61675
  }
61676
61676
  }
61677
61677
  }
61678
- console.log("[paste] childItemIds:", [...childItemIds]);
61679
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
61680
- id,
61681
- type: d.itemType,
61682
- tx: d.transformation?.translateX,
61683
- ty: d.transformation?.translateY,
61684
- isChild: childItemIds.has(id)
61685
- })));
61686
61678
  let minX = Infinity;
61687
61679
  let minY = Infinity;
61688
61680
  for (const itemId in itemsMap) {
@@ -61707,7 +61699,11 @@ class Board {
61707
61699
  minY = 0;
61708
61700
  }
61709
61701
  const { x, y } = this.pointer.point;
61710
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
61702
+ const originalTranslations = new Map;
61703
+ for (const itemId in itemsMap) {
61704
+ const t3 = itemsMap[itemId].transformation;
61705
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61706
+ }
61711
61707
  const mediaStorageIds = [];
61712
61708
  for (const itemId in itemsMap) {
61713
61709
  const itemData = itemsMap[itemId];
@@ -61741,7 +61737,6 @@ class Board {
61741
61737
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
61742
61738
  const newTx = translateX - minX + x;
61743
61739
  const newTy = translateY - minY + y;
61744
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
61745
61740
  itemData.transformation.translateX = newTx;
61746
61741
  itemData.transformation.translateY = newTy;
61747
61742
  const d = itemData;
@@ -61755,14 +61750,13 @@ class Board {
61755
61750
  }
61756
61751
  } else if (childItemIds.has(itemId)) {
61757
61752
  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;
61753
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
61754
+ const parentOrigTx = parentOrig?.tx ?? 0;
61755
+ const parentOrigTy = parentOrig?.ty ?? 0;
61761
61756
  const parentNewTx = parentOrigTx - minX + x;
61762
61757
  const parentNewTy = parentOrigTy - minY + y;
61763
61758
  const newChildTx = parentNewTx + translateX;
61764
61759
  const newChildTy = parentNewTy + translateY;
61765
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
61766
61760
  if (itemData.transformation) {
61767
61761
  itemData.transformation.translateX = newChildTx;
61768
61762
  itemData.transformation.translateY = newChildTy;
@@ -61796,16 +61790,7 @@ class Board {
61796
61790
  select: select2
61797
61791
  });
61798
61792
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
61799
- for (const item of items) {
61800
- const mbr = item.getMbr();
61801
- const pos = item.transformation.getTranslation();
61802
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
61803
- }
61804
61793
  this.handleNesting(items);
61805
- for (const item of items) {
61806
- const pos = item.transformation.getTranslation();
61807
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
61808
- }
61809
61794
  this.selection.removeAll();
61810
61795
  this.selection.add(items);
61811
61796
  this.selection.setContext("EditUnderPointer");
@@ -61900,6 +61885,11 @@ class Board {
61900
61885
  if (minY === Infinity) {
61901
61886
  minY = 0;
61902
61887
  }
61888
+ const dupOriginalTranslations = new Map;
61889
+ for (const itemId in itemsMap) {
61890
+ const t3 = itemsMap[itemId].transformation;
61891
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
61892
+ }
61903
61893
  const mbr = this.selection.getMbr();
61904
61894
  const selectedItems = this.selection.items.list();
61905
61895
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -61929,9 +61919,9 @@ class Board {
61929
61919
  }
61930
61920
  } else if (dupChildItemIds.has(itemId)) {
61931
61921
  const parentId = dupChildToParent.get(itemId);
61932
- const parentData = parentId ? itemsMap[parentId] : undefined;
61933
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
61934
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
61922
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
61923
+ const parentOrigTx = parentOrig?.tx ?? 0;
61924
+ const parentOrigTy = parentOrig?.ty ?? 0;
61935
61925
  const parentNewTx = parentOrigTx - minX + right + width2;
61936
61926
  const parentNewTy = parentOrigTy - minY + top;
61937
61927
  if (itemData.transformation) {
package/dist/esm/node.js CHANGED
@@ -64139,14 +64139,6 @@ class Board {
64139
64139
  }
64140
64140
  }
64141
64141
  }
64142
- console.log("[paste] childItemIds:", [...childItemIds]);
64143
- console.log("[paste] items in map:", Object.entries(itemsMap).map(([id, d]) => ({
64144
- id,
64145
- type: d.itemType,
64146
- tx: d.transformation?.translateX,
64147
- ty: d.transformation?.translateY,
64148
- isChild: childItemIds.has(id)
64149
- })));
64150
64142
  let minX = Infinity;
64151
64143
  let minY = Infinity;
64152
64144
  for (const itemId in itemsMap) {
@@ -64171,7 +64163,11 @@ class Board {
64171
64163
  minY = 0;
64172
64164
  }
64173
64165
  const { x, y } = this.pointer.point;
64174
- console.log("[paste] minX:", minX, "minY:", minY, "pointer:", x, y);
64166
+ const originalTranslations = new Map;
64167
+ for (const itemId in itemsMap) {
64168
+ const t3 = itemsMap[itemId].transformation;
64169
+ originalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
64170
+ }
64175
64171
  const mediaStorageIds = [];
64176
64172
  for (const itemId in itemsMap) {
64177
64173
  const itemData = itemsMap[itemId];
@@ -64205,7 +64201,6 @@ class Board {
64205
64201
  } else if (itemData.transformation && !childItemIds.has(itemId)) {
64206
64202
  const newTx = translateX - minX + x;
64207
64203
  const newTy = translateY - minY + y;
64208
- console.log(`[paste] ${itemData.itemType} ${itemId}: (${translateX},${translateY}) → (${newTx},${newTy})`);
64209
64204
  itemData.transformation.translateX = newTx;
64210
64205
  itemData.transformation.translateY = newTy;
64211
64206
  const d = itemData;
@@ -64219,14 +64214,13 @@ class Board {
64219
64214
  }
64220
64215
  } else if (childItemIds.has(itemId)) {
64221
64216
  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;
64217
+ const parentOrig = parentId ? originalTranslations.get(parentId) : undefined;
64218
+ const parentOrigTx = parentOrig?.tx ?? 0;
64219
+ const parentOrigTy = parentOrig?.ty ?? 0;
64225
64220
  const parentNewTx = parentOrigTx - minX + x;
64226
64221
  const parentNewTy = parentOrigTy - minY + y;
64227
64222
  const newChildTx = parentNewTx + translateX;
64228
64223
  const newChildTy = parentNewTy + translateY;
64229
- console.log(`[paste] child ${itemData.itemType} ${itemId}: local=(${translateX},${translateY}) parentNew=(${parentNewTx},${parentNewTy}) → world=(${newChildTx},${newChildTy})`);
64230
64224
  if (itemData.transformation) {
64231
64225
  itemData.transformation.translateX = newChildTx;
64232
64226
  itemData.transformation.translateY = newChildTy;
@@ -64260,16 +64254,7 @@ class Board {
64260
64254
  select: select2
64261
64255
  });
64262
64256
  const items = Object.keys(newMap).map((id) => this.items.getById(id)).filter((item) => typeof item !== "undefined");
64263
- for (const item of items) {
64264
- const mbr = item.getMbr();
64265
- const pos = item.transformation.getTranslation();
64266
- console.log(`[nest-pre] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) mbr=(${mbr.left.toFixed(0)},${mbr.top.toFixed(0)},${mbr.right.toFixed(0)},${mbr.bottom.toFixed(0)}) parent=${item.parent}`);
64267
- }
64268
64257
  this.handleNesting(items);
64269
- for (const item of items) {
64270
- const pos = item.transformation.getTranslation();
64271
- console.log(`[nest-post] ${item.itemType} ${item.getId()}: pos=(${pos.x.toFixed(0)},${pos.y.toFixed(0)}) parent=${item.parent}`);
64272
- }
64273
64258
  this.selection.removeAll();
64274
64259
  this.selection.add(items);
64275
64260
  this.selection.setContext("EditUnderPointer");
@@ -64364,6 +64349,11 @@ class Board {
64364
64349
  if (minY === Infinity) {
64365
64350
  minY = 0;
64366
64351
  }
64352
+ const dupOriginalTranslations = new Map;
64353
+ for (const itemId in itemsMap) {
64354
+ const t3 = itemsMap[itemId].transformation;
64355
+ dupOriginalTranslations.set(itemId, { tx: t3?.translateX ?? 0, ty: t3?.translateY ?? 0 });
64356
+ }
64367
64357
  const mbr = this.selection.getMbr();
64368
64358
  const selectedItems = this.selection.items.list();
64369
64359
  const isSelectedItemsMinWidth = selectedItems.some((item) => item.getMbr().getWidth() === 0);
@@ -64393,9 +64383,9 @@ class Board {
64393
64383
  }
64394
64384
  } else if (dupChildItemIds.has(itemId)) {
64395
64385
  const parentId = dupChildToParent.get(itemId);
64396
- const parentData = parentId ? itemsMap[parentId] : undefined;
64397
- const parentOrigTx = parentData?.transformation?.translateX ?? 0;
64398
- const parentOrigTy = parentData?.transformation?.translateY ?? 0;
64386
+ const parentOrig = parentId ? dupOriginalTranslations.get(parentId) : undefined;
64387
+ const parentOrigTx = parentOrig?.tx ?? 0;
64388
+ const parentOrigTy = parentOrig?.ty ?? 0;
64399
64389
  const parentNewTx = parentOrigTx - minX + right + width2;
64400
64390
  const parentNewTy = parentOrigTy - minY + top;
64401
64391
  if (itemData.transformation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.69",
3
+ "version": "0.13.71",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",