microboard-temp 0.5.51 → 0.5.53

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.
@@ -46528,10 +46528,10 @@ class Select extends Tool {
46528
46528
  return false;
46529
46529
  }
46530
46530
  const draggingMbr = draggingItem.getMbr();
46531
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46532
- frames.forEach((frame) => {
46533
- if (frame.handleNesting(draggingItem)) {
46534
- this.nestingHighlighter.add(frame, draggingItem);
46531
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
46532
+ groups.forEach((group) => {
46533
+ if (group.handleNesting(draggingItem)) {
46534
+ this.nestingHighlighter.add(group, draggingItem);
46535
46535
  } else {
46536
46536
  this.nestingHighlighter.remove(draggingItem);
46537
46537
  }
@@ -46582,13 +46582,13 @@ class Select extends Tool {
46582
46582
  }
46583
46583
  }
46584
46584
  updateFramesNesting(selectionMbr, selection) {
46585
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46586
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46585
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
46586
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
46587
46587
  selection.list().forEach((item) => {
46588
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46589
- frames.forEach((frame) => {
46590
- if (frame.handleNesting(item)) {
46591
- this.nestingHighlighter.add(frame, item);
46588
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
46589
+ groups.forEach((group) => {
46590
+ if (group.handleNesting(item)) {
46591
+ this.nestingHighlighter.add(group, item);
46592
46592
  } else {
46593
46593
  this.nestingHighlighter.remove(item);
46594
46594
  }
@@ -48845,8 +48845,25 @@ class AddScreen extends ShapeTool {
48845
48845
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48846
48846
  }
48847
48847
  pointerUp() {
48848
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
48849
- return super.pointerUp();
48848
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
48849
+ if (!screenOwnerId) {
48850
+ screenOwnerId = v4_default();
48851
+ localStorage.setItem("screenOwnerId", screenOwnerId);
48852
+ }
48853
+ this.item.applyOwnerId(screenOwnerId);
48854
+ const currMbr = this.item.getMbr();
48855
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
48856
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48857
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48858
+ this.initTransformation(width2 / 100, height3 / 100);
48859
+ const screen = this.board.add(this.item);
48860
+ screen.emitNesting(screenChildren);
48861
+ this.isDown = false;
48862
+ this.board.selection.removeAll();
48863
+ this.board.selection.add(screen);
48864
+ this.board.tools.select();
48865
+ this.board.tools.publish();
48866
+ return true;
48850
48867
  }
48851
48868
  }
48852
48869
 
@@ -48977,7 +48994,7 @@ class Screen extends BaseItem {
48977
48994
  return;
48978
48995
  }
48979
48996
  this.path.render(context);
48980
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
48997
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48981
48998
  super.render(context);
48982
48999
  }
48983
49000
  }
@@ -51945,7 +51962,7 @@ function updateFrameChildren({
51945
51962
  }) {
51946
51963
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51947
51964
  board.selection.items.list().forEach((item) => {
51948
- if ("getChildrenIds" in item && item.getChildrenIds()) {
51965
+ if ("index" in item && item.index) {
51949
51966
  const currMbr = item.getMbr();
51950
51967
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51951
51968
  itemsToCheck.forEach((currItem) => {
package/dist/cjs/index.js CHANGED
@@ -46528,10 +46528,10 @@ class Select extends Tool {
46528
46528
  return false;
46529
46529
  }
46530
46530
  const draggingMbr = draggingItem.getMbr();
46531
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46532
- frames.forEach((frame) => {
46533
- if (frame.handleNesting(draggingItem)) {
46534
- this.nestingHighlighter.add(frame, draggingItem);
46531
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
46532
+ groups.forEach((group) => {
46533
+ if (group.handleNesting(draggingItem)) {
46534
+ this.nestingHighlighter.add(group, draggingItem);
46535
46535
  } else {
46536
46536
  this.nestingHighlighter.remove(draggingItem);
46537
46537
  }
@@ -46582,13 +46582,13 @@ class Select extends Tool {
46582
46582
  }
46583
46583
  }
46584
46584
  updateFramesNesting(selectionMbr, selection) {
46585
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46586
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46585
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
46586
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
46587
46587
  selection.list().forEach((item) => {
46588
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46589
- frames.forEach((frame) => {
46590
- if (frame.handleNesting(item)) {
46591
- this.nestingHighlighter.add(frame, item);
46588
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
46589
+ groups.forEach((group) => {
46590
+ if (group.handleNesting(item)) {
46591
+ this.nestingHighlighter.add(group, item);
46592
46592
  } else {
46593
46593
  this.nestingHighlighter.remove(item);
46594
46594
  }
@@ -48845,8 +48845,25 @@ class AddScreen extends ShapeTool {
48845
48845
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48846
48846
  }
48847
48847
  pointerUp() {
48848
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
48849
- return super.pointerUp();
48848
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
48849
+ if (!screenOwnerId) {
48850
+ screenOwnerId = v4_default();
48851
+ localStorage.setItem("screenOwnerId", screenOwnerId);
48852
+ }
48853
+ this.item.applyOwnerId(screenOwnerId);
48854
+ const currMbr = this.item.getMbr();
48855
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
48856
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48857
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48858
+ this.initTransformation(width2 / 100, height3 / 100);
48859
+ const screen = this.board.add(this.item);
48860
+ screen.emitNesting(screenChildren);
48861
+ this.isDown = false;
48862
+ this.board.selection.removeAll();
48863
+ this.board.selection.add(screen);
48864
+ this.board.tools.select();
48865
+ this.board.tools.publish();
48866
+ return true;
48850
48867
  }
48851
48868
  }
48852
48869
 
@@ -48977,7 +48994,7 @@ class Screen extends BaseItem {
48977
48994
  return;
48978
48995
  }
48979
48996
  this.path.render(context);
48980
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
48997
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48981
48998
  super.render(context);
48982
48999
  }
48983
49000
  }
@@ -51945,7 +51962,7 @@ function updateFrameChildren({
51945
51962
  }) {
51946
51963
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51947
51964
  board.selection.items.list().forEach((item) => {
51948
- if ("getChildrenIds" in item && item.getChildrenIds()) {
51965
+ if ("index" in item && item.index) {
51949
51966
  const currMbr = item.getMbr();
51950
51967
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51951
51968
  itemsToCheck.forEach((currItem) => {
package/dist/cjs/node.js CHANGED
@@ -49001,10 +49001,10 @@ class Select extends Tool {
49001
49001
  return false;
49002
49002
  }
49003
49003
  const draggingMbr = draggingItem.getMbr();
49004
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
49005
- frames.forEach((frame) => {
49006
- if (frame.handleNesting(draggingItem)) {
49007
- this.nestingHighlighter.add(frame, draggingItem);
49004
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
49005
+ groups.forEach((group) => {
49006
+ if (group.handleNesting(draggingItem)) {
49007
+ this.nestingHighlighter.add(group, draggingItem);
49008
49008
  } else {
49009
49009
  this.nestingHighlighter.remove(draggingItem);
49010
49010
  }
@@ -49055,13 +49055,13 @@ class Select extends Tool {
49055
49055
  }
49056
49056
  }
49057
49057
  updateFramesNesting(selectionMbr, selection) {
49058
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
49059
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
49058
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
49059
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
49060
49060
  selection.list().forEach((item) => {
49061
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
49062
- frames.forEach((frame) => {
49063
- if (frame.handleNesting(item)) {
49064
- this.nestingHighlighter.add(frame, item);
49061
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
49062
+ groups.forEach((group) => {
49063
+ if (group.handleNesting(item)) {
49064
+ this.nestingHighlighter.add(group, item);
49065
49065
  } else {
49066
49066
  this.nestingHighlighter.remove(item);
49067
49067
  }
@@ -51318,8 +51318,25 @@ class AddScreen extends ShapeTool {
51318
51318
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
51319
51319
  }
51320
51320
  pointerUp() {
51321
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
51322
- return super.pointerUp();
51321
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
51322
+ if (!screenOwnerId) {
51323
+ screenOwnerId = v4_default();
51324
+ localStorage.setItem("screenOwnerId", screenOwnerId);
51325
+ }
51326
+ this.item.applyOwnerId(screenOwnerId);
51327
+ const currMbr = this.item.getMbr();
51328
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
51329
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
51330
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
51331
+ this.initTransformation(width2 / 100, height3 / 100);
51332
+ const screen = this.board.add(this.item);
51333
+ screen.emitNesting(screenChildren);
51334
+ this.isDown = false;
51335
+ this.board.selection.removeAll();
51336
+ this.board.selection.add(screen);
51337
+ this.board.tools.select();
51338
+ this.board.tools.publish();
51339
+ return true;
51323
51340
  }
51324
51341
  }
51325
51342
 
@@ -51450,7 +51467,7 @@ class Screen extends BaseItem {
51450
51467
  return;
51451
51468
  }
51452
51469
  this.path.render(context);
51453
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
51470
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
51454
51471
  super.render(context);
51455
51472
  }
51456
51473
  }
@@ -54418,7 +54435,7 @@ function updateFrameChildren({
54418
54435
  }) {
54419
54436
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
54420
54437
  board.selection.items.list().forEach((item) => {
54421
- if ("getChildrenIds" in item && item.getChildrenIds()) {
54438
+ if ("index" in item && item.index) {
54422
54439
  const currMbr = item.getMbr();
54423
54440
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
54424
54441
  itemsToCheck.forEach((currItem) => {
@@ -46374,10 +46374,10 @@ class Select extends Tool {
46374
46374
  return false;
46375
46375
  }
46376
46376
  const draggingMbr = draggingItem.getMbr();
46377
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46378
- frames.forEach((frame) => {
46379
- if (frame.handleNesting(draggingItem)) {
46380
- this.nestingHighlighter.add(frame, draggingItem);
46377
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
46378
+ groups.forEach((group) => {
46379
+ if (group.handleNesting(draggingItem)) {
46380
+ this.nestingHighlighter.add(group, draggingItem);
46381
46381
  } else {
46382
46382
  this.nestingHighlighter.remove(draggingItem);
46383
46383
  }
@@ -46428,13 +46428,13 @@ class Select extends Tool {
46428
46428
  }
46429
46429
  }
46430
46430
  updateFramesNesting(selectionMbr, selection) {
46431
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46432
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46431
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
46432
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
46433
46433
  selection.list().forEach((item) => {
46434
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46435
- frames.forEach((frame) => {
46436
- if (frame.handleNesting(item)) {
46437
- this.nestingHighlighter.add(frame, item);
46434
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
46435
+ groups.forEach((group) => {
46436
+ if (group.handleNesting(item)) {
46437
+ this.nestingHighlighter.add(group, item);
46438
46438
  } else {
46439
46439
  this.nestingHighlighter.remove(item);
46440
46440
  }
@@ -48691,8 +48691,25 @@ class AddScreen extends ShapeTool {
48691
48691
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48692
48692
  }
48693
48693
  pointerUp() {
48694
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
48695
- return super.pointerUp();
48694
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
48695
+ if (!screenOwnerId) {
48696
+ screenOwnerId = v4_default();
48697
+ localStorage.setItem("screenOwnerId", screenOwnerId);
48698
+ }
48699
+ this.item.applyOwnerId(screenOwnerId);
48700
+ const currMbr = this.item.getMbr();
48701
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
48702
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48703
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48704
+ this.initTransformation(width2 / 100, height3 / 100);
48705
+ const screen = this.board.add(this.item);
48706
+ screen.emitNesting(screenChildren);
48707
+ this.isDown = false;
48708
+ this.board.selection.removeAll();
48709
+ this.board.selection.add(screen);
48710
+ this.board.tools.select();
48711
+ this.board.tools.publish();
48712
+ return true;
48696
48713
  }
48697
48714
  }
48698
48715
 
@@ -48823,7 +48840,7 @@ class Screen extends BaseItem {
48823
48840
  return;
48824
48841
  }
48825
48842
  this.path.render(context);
48826
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
48843
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48827
48844
  super.render(context);
48828
48845
  }
48829
48846
  }
@@ -51791,7 +51808,7 @@ function updateFrameChildren({
51791
51808
  }) {
51792
51809
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51793
51810
  board.selection.items.list().forEach((item) => {
51794
- if ("getChildrenIds" in item && item.getChildrenIds()) {
51811
+ if ("index" in item && item.index) {
51795
51812
  const currMbr = item.getMbr();
51796
51813
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51797
51814
  itemsToCheck.forEach((currItem) => {
package/dist/esm/index.js CHANGED
@@ -46367,10 +46367,10 @@ class Select extends Tool {
46367
46367
  return false;
46368
46368
  }
46369
46369
  const draggingMbr = draggingItem.getMbr();
46370
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
46371
- frames.forEach((frame) => {
46372
- if (frame.handleNesting(draggingItem)) {
46373
- this.nestingHighlighter.add(frame, draggingItem);
46370
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
46371
+ groups.forEach((group) => {
46372
+ if (group.handleNesting(draggingItem)) {
46373
+ this.nestingHighlighter.add(group, draggingItem);
46374
46374
  } else {
46375
46375
  this.nestingHighlighter.remove(draggingItem);
46376
46376
  }
@@ -46421,13 +46421,13 @@ class Select extends Tool {
46421
46421
  }
46422
46422
  }
46423
46423
  updateFramesNesting(selectionMbr, selection) {
46424
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
46425
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
46424
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
46425
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
46426
46426
  selection.list().forEach((item) => {
46427
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
46428
- frames.forEach((frame) => {
46429
- if (frame.handleNesting(item)) {
46430
- this.nestingHighlighter.add(frame, item);
46427
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
46428
+ groups.forEach((group) => {
46429
+ if (group.handleNesting(item)) {
46430
+ this.nestingHighlighter.add(group, item);
46431
46431
  } else {
46432
46432
  this.nestingHighlighter.remove(item);
46433
46433
  }
@@ -48684,8 +48684,25 @@ class AddScreen extends ShapeTool {
48684
48684
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48685
48685
  }
48686
48686
  pointerUp() {
48687
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
48688
- return super.pointerUp();
48687
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
48688
+ if (!screenOwnerId) {
48689
+ screenOwnerId = v4_default();
48690
+ localStorage.setItem("screenOwnerId", screenOwnerId);
48691
+ }
48692
+ this.item.applyOwnerId(screenOwnerId);
48693
+ const currMbr = this.item.getMbr();
48694
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
48695
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48696
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48697
+ this.initTransformation(width2 / 100, height3 / 100);
48698
+ const screen = this.board.add(this.item);
48699
+ screen.emitNesting(screenChildren);
48700
+ this.isDown = false;
48701
+ this.board.selection.removeAll();
48702
+ this.board.selection.add(screen);
48703
+ this.board.tools.select();
48704
+ this.board.tools.publish();
48705
+ return true;
48689
48706
  }
48690
48707
  }
48691
48708
 
@@ -48816,7 +48833,7 @@ class Screen extends BaseItem {
48816
48833
  return;
48817
48834
  }
48818
48835
  this.path.render(context);
48819
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
48836
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48820
48837
  super.render(context);
48821
48838
  }
48822
48839
  }
@@ -51784,7 +51801,7 @@ function updateFrameChildren({
51784
51801
  }) {
51785
51802
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
51786
51803
  board.selection.items.list().forEach((item) => {
51787
- if ("getChildrenIds" in item && item.getChildrenIds()) {
51804
+ if ("index" in item && item.index) {
51788
51805
  const currMbr = item.getMbr();
51789
51806
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
51790
51807
  itemsToCheck.forEach((currItem) => {
package/dist/esm/node.js CHANGED
@@ -48835,10 +48835,10 @@ class Select extends Tool {
48835
48835
  return false;
48836
48836
  }
48837
48837
  const draggingMbr = draggingItem.getMbr();
48838
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
48839
- frames.forEach((frame) => {
48840
- if (frame.handleNesting(draggingItem)) {
48841
- this.nestingHighlighter.add(frame, draggingItem);
48838
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
48839
+ groups.forEach((group) => {
48840
+ if (group.handleNesting(draggingItem)) {
48841
+ this.nestingHighlighter.add(group, draggingItem);
48842
48842
  } else {
48843
48843
  this.nestingHighlighter.remove(draggingItem);
48844
48844
  }
@@ -48889,13 +48889,13 @@ class Select extends Tool {
48889
48889
  }
48890
48890
  }
48891
48891
  updateFramesNesting(selectionMbr, selection) {
48892
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
48893
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
48892
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
48893
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
48894
48894
  selection.list().forEach((item) => {
48895
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
48896
- frames.forEach((frame) => {
48897
- if (frame.handleNesting(item)) {
48898
- this.nestingHighlighter.add(frame, item);
48895
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
48896
+ groups.forEach((group) => {
48897
+ if (group.handleNesting(item)) {
48898
+ this.nestingHighlighter.add(group, item);
48899
48899
  } else {
48900
48900
  this.nestingHighlighter.remove(item);
48901
48901
  }
@@ -51152,8 +51152,25 @@ class AddScreen extends ShapeTool {
51152
51152
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
51153
51153
  }
51154
51154
  pointerUp() {
51155
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
51156
- return super.pointerUp();
51155
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
51156
+ if (!screenOwnerId) {
51157
+ screenOwnerId = v4_default();
51158
+ localStorage.setItem("screenOwnerId", screenOwnerId);
51159
+ }
51160
+ this.item.applyOwnerId(screenOwnerId);
51161
+ const currMbr = this.item.getMbr();
51162
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
51163
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
51164
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
51165
+ this.initTransformation(width2 / 100, height3 / 100);
51166
+ const screen = this.board.add(this.item);
51167
+ screen.emitNesting(screenChildren);
51168
+ this.isDown = false;
51169
+ this.board.selection.removeAll();
51170
+ this.board.selection.add(screen);
51171
+ this.board.tools.select();
51172
+ this.board.tools.publish();
51173
+ return true;
51157
51174
  }
51158
51175
  }
51159
51176
 
@@ -51284,7 +51301,7 @@ class Screen extends BaseItem {
51284
51301
  return;
51285
51302
  }
51286
51303
  this.path.render(context);
51287
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
51304
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
51288
51305
  super.render(context);
51289
51306
  }
51290
51307
  }
@@ -54252,7 +54269,7 @@ function updateFrameChildren({
54252
54269
  }) {
54253
54270
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
54254
54271
  board.selection.items.list().forEach((item) => {
54255
- if ("getChildrenIds" in item && item.getChildrenIds()) {
54272
+ if ("index" in item && item.index) {
54256
54273
  const currMbr = item.getMbr();
54257
54274
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
54258
54275
  itemsToCheck.forEach((currItem) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.51",
3
+ "version": "0.5.53",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",