microboard-temp 0.5.60 → 0.5.62

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.
@@ -47552,6 +47552,9 @@ function registerItem({
47552
47552
  }
47553
47553
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47554
47554
  }
47555
+ function registerTool(toolData) {
47556
+ registeredTools[toolData.name] = toolData.tool;
47557
+ }
47555
47558
  function createItemFactory(item, defaultData2) {
47556
47559
  return function itemFactory(id, data, board) {
47557
47560
  if (data.itemType !== defaultData2.itemType) {
@@ -48917,6 +48920,28 @@ class AddScreen extends ShapeTool {
48917
48920
  }
48918
48921
  }
48919
48922
 
48923
+ class AddPouch extends ShapeTool {
48924
+ constructor(board, name) {
48925
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48926
+ }
48927
+ pointerUp() {
48928
+ this.item.applyOwnerId("");
48929
+ const currMbr = this.item.getMbr();
48930
+ 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));
48931
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48932
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48933
+ this.initTransformation(width2 / 100, height3 / 100);
48934
+ const screen = this.board.add(this.item);
48935
+ screen.emitNesting(screenChildren);
48936
+ this.isDown = false;
48937
+ this.board.selection.removeAll();
48938
+ this.board.selection.add(screen);
48939
+ this.board.tools.select();
48940
+ this.board.tools.publish();
48941
+ return true;
48942
+ }
48943
+ }
48944
+
48920
48945
  // src/Items/Examples/CardGame/Screen/Screen.ts
48921
48946
  var screenPath = new Path([
48922
48947
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -48971,6 +48996,9 @@ class Screen extends BaseItem {
48971
48996
  }
48972
48997
  this.subject.publish(this);
48973
48998
  }
48999
+ getOwnerId() {
49000
+ return this.ownerId;
49001
+ }
48974
49002
  getBackgroundColor() {
48975
49003
  return this.backgroundColor;
48976
49004
  }
@@ -49043,6 +49071,11 @@ class Screen extends BaseItem {
49043
49071
  }
49044
49072
  applyOwnerId(ownerId) {
49045
49073
  this.ownerId = ownerId;
49074
+ if (!this.ownerId) {
49075
+ this.index.getUnderPoint = () => [];
49076
+ this.index.getEnclosed = () => [];
49077
+ this.index.getEnclosedOrCrossed = () => [];
49078
+ }
49046
49079
  }
49047
49080
  transformPath() {
49048
49081
  this.path = screenPath.copy();
@@ -49060,10 +49093,25 @@ class Screen extends BaseItem {
49060
49093
  }
49061
49094
  deserialize(data) {
49062
49095
  super.deserialize(data);
49096
+ if (this.backgroundUrl) {
49097
+ this.applyBackgroundUrl(this.backgroundUrl);
49098
+ }
49099
+ if (!this.ownerId) {
49100
+ this.index.getUnderPoint = () => [];
49101
+ this.index.getEnclosed = () => [];
49102
+ this.index.getEnclosedOrCrossed = () => [];
49103
+ }
49063
49104
  this.transformPath();
49064
49105
  this.subject.publish(this);
49065
49106
  return this;
49066
49107
  }
49108
+ getRandomItem() {
49109
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
49110
+ if (item) {
49111
+ this.removeChildItems(item);
49112
+ return item;
49113
+ }
49114
+ }
49067
49115
  render(context) {
49068
49116
  if (this.transformationRenderBlock) {
49069
49117
  return;
@@ -49097,6 +49145,7 @@ registerItem({
49097
49145
  defaultData: defaultScreenData,
49098
49146
  toolData: { name: "AddScreen", tool: AddScreen }
49099
49147
  });
49148
+ registerTool({ name: "AddPouch", tool: AddPouch });
49100
49149
  // src/Pointer/Cursor.ts
49101
49150
  var defaultCursors = [
49102
49151
  "default",
package/dist/cjs/index.js CHANGED
@@ -47552,6 +47552,9 @@ function registerItem({
47552
47552
  }
47553
47553
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47554
47554
  }
47555
+ function registerTool(toolData) {
47556
+ registeredTools[toolData.name] = toolData.tool;
47557
+ }
47555
47558
  function createItemFactory(item, defaultData2) {
47556
47559
  return function itemFactory(id, data, board) {
47557
47560
  if (data.itemType !== defaultData2.itemType) {
@@ -48917,6 +48920,28 @@ class AddScreen extends ShapeTool {
48917
48920
  }
48918
48921
  }
48919
48922
 
48923
+ class AddPouch extends ShapeTool {
48924
+ constructor(board, name) {
48925
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48926
+ }
48927
+ pointerUp() {
48928
+ this.item.applyOwnerId("");
48929
+ const currMbr = this.item.getMbr();
48930
+ 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));
48931
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48932
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48933
+ this.initTransformation(width2 / 100, height3 / 100);
48934
+ const screen = this.board.add(this.item);
48935
+ screen.emitNesting(screenChildren);
48936
+ this.isDown = false;
48937
+ this.board.selection.removeAll();
48938
+ this.board.selection.add(screen);
48939
+ this.board.tools.select();
48940
+ this.board.tools.publish();
48941
+ return true;
48942
+ }
48943
+ }
48944
+
48920
48945
  // src/Items/Examples/CardGame/Screen/Screen.ts
48921
48946
  var screenPath = new Path([
48922
48947
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -48971,6 +48996,9 @@ class Screen extends BaseItem {
48971
48996
  }
48972
48997
  this.subject.publish(this);
48973
48998
  }
48999
+ getOwnerId() {
49000
+ return this.ownerId;
49001
+ }
48974
49002
  getBackgroundColor() {
48975
49003
  return this.backgroundColor;
48976
49004
  }
@@ -49043,6 +49071,11 @@ class Screen extends BaseItem {
49043
49071
  }
49044
49072
  applyOwnerId(ownerId) {
49045
49073
  this.ownerId = ownerId;
49074
+ if (!this.ownerId) {
49075
+ this.index.getUnderPoint = () => [];
49076
+ this.index.getEnclosed = () => [];
49077
+ this.index.getEnclosedOrCrossed = () => [];
49078
+ }
49046
49079
  }
49047
49080
  transformPath() {
49048
49081
  this.path = screenPath.copy();
@@ -49060,10 +49093,25 @@ class Screen extends BaseItem {
49060
49093
  }
49061
49094
  deserialize(data) {
49062
49095
  super.deserialize(data);
49096
+ if (this.backgroundUrl) {
49097
+ this.applyBackgroundUrl(this.backgroundUrl);
49098
+ }
49099
+ if (!this.ownerId) {
49100
+ this.index.getUnderPoint = () => [];
49101
+ this.index.getEnclosed = () => [];
49102
+ this.index.getEnclosedOrCrossed = () => [];
49103
+ }
49063
49104
  this.transformPath();
49064
49105
  this.subject.publish(this);
49065
49106
  return this;
49066
49107
  }
49108
+ getRandomItem() {
49109
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
49110
+ if (item) {
49111
+ this.removeChildItems(item);
49112
+ return item;
49113
+ }
49114
+ }
49067
49115
  render(context) {
49068
49116
  if (this.transformationRenderBlock) {
49069
49117
  return;
@@ -49097,6 +49145,7 @@ registerItem({
49097
49145
  defaultData: defaultScreenData,
49098
49146
  toolData: { name: "AddScreen", tool: AddScreen }
49099
49147
  });
49148
+ registerTool({ name: "AddPouch", tool: AddPouch });
49100
49149
  // src/Pointer/Cursor.ts
49101
49150
  var defaultCursors = [
49102
49151
  "default",
package/dist/cjs/node.js CHANGED
@@ -50025,6 +50025,9 @@ function registerItem({
50025
50025
  }
50026
50026
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
50027
50027
  }
50028
+ function registerTool(toolData) {
50029
+ registeredTools[toolData.name] = toolData.tool;
50030
+ }
50028
50031
  function createItemFactory(item, defaultData2) {
50029
50032
  return function itemFactory(id, data, board) {
50030
50033
  if (data.itemType !== defaultData2.itemType) {
@@ -51390,6 +51393,28 @@ class AddScreen extends ShapeTool {
51390
51393
  }
51391
51394
  }
51392
51395
 
51396
+ class AddPouch extends ShapeTool {
51397
+ constructor(board, name) {
51398
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
51399
+ }
51400
+ pointerUp() {
51401
+ this.item.applyOwnerId("");
51402
+ const currMbr = this.item.getMbr();
51403
+ 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));
51404
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
51405
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
51406
+ this.initTransformation(width2 / 100, height3 / 100);
51407
+ const screen = this.board.add(this.item);
51408
+ screen.emitNesting(screenChildren);
51409
+ this.isDown = false;
51410
+ this.board.selection.removeAll();
51411
+ this.board.selection.add(screen);
51412
+ this.board.tools.select();
51413
+ this.board.tools.publish();
51414
+ return true;
51415
+ }
51416
+ }
51417
+
51393
51418
  // src/Items/Examples/CardGame/Screen/Screen.ts
51394
51419
  var screenPath = new Path([
51395
51420
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -51444,6 +51469,9 @@ class Screen extends BaseItem {
51444
51469
  }
51445
51470
  this.subject.publish(this);
51446
51471
  }
51472
+ getOwnerId() {
51473
+ return this.ownerId;
51474
+ }
51447
51475
  getBackgroundColor() {
51448
51476
  return this.backgroundColor;
51449
51477
  }
@@ -51516,6 +51544,11 @@ class Screen extends BaseItem {
51516
51544
  }
51517
51545
  applyOwnerId(ownerId) {
51518
51546
  this.ownerId = ownerId;
51547
+ if (!this.ownerId) {
51548
+ this.index.getUnderPoint = () => [];
51549
+ this.index.getEnclosed = () => [];
51550
+ this.index.getEnclosedOrCrossed = () => [];
51551
+ }
51519
51552
  }
51520
51553
  transformPath() {
51521
51554
  this.path = screenPath.copy();
@@ -51533,10 +51566,25 @@ class Screen extends BaseItem {
51533
51566
  }
51534
51567
  deserialize(data) {
51535
51568
  super.deserialize(data);
51569
+ if (this.backgroundUrl) {
51570
+ this.applyBackgroundUrl(this.backgroundUrl);
51571
+ }
51572
+ if (!this.ownerId) {
51573
+ this.index.getUnderPoint = () => [];
51574
+ this.index.getEnclosed = () => [];
51575
+ this.index.getEnclosedOrCrossed = () => [];
51576
+ }
51536
51577
  this.transformPath();
51537
51578
  this.subject.publish(this);
51538
51579
  return this;
51539
51580
  }
51581
+ getRandomItem() {
51582
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
51583
+ if (item) {
51584
+ this.removeChildItems(item);
51585
+ return item;
51586
+ }
51587
+ }
51540
51588
  render(context) {
51541
51589
  if (this.transformationRenderBlock) {
51542
51590
  return;
@@ -51570,6 +51618,7 @@ registerItem({
51570
51618
  defaultData: defaultScreenData,
51571
51619
  toolData: { name: "AddScreen", tool: AddScreen }
51572
51620
  });
51621
+ registerTool({ name: "AddPouch", tool: AddPouch });
51573
51622
  // src/Pointer/Cursor.ts
51574
51623
  var defaultCursors = [
51575
51624
  "default",
@@ -47398,6 +47398,9 @@ function registerItem({
47398
47398
  }
47399
47399
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47400
47400
  }
47401
+ function registerTool(toolData) {
47402
+ registeredTools[toolData.name] = toolData.tool;
47403
+ }
47401
47404
  function createItemFactory(item, defaultData2) {
47402
47405
  return function itemFactory(id, data, board) {
47403
47406
  if (data.itemType !== defaultData2.itemType) {
@@ -48763,6 +48766,28 @@ class AddScreen extends ShapeTool {
48763
48766
  }
48764
48767
  }
48765
48768
 
48769
+ class AddPouch extends ShapeTool {
48770
+ constructor(board, name) {
48771
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48772
+ }
48773
+ pointerUp() {
48774
+ this.item.applyOwnerId("");
48775
+ const currMbr = this.item.getMbr();
48776
+ 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));
48777
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48778
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48779
+ this.initTransformation(width2 / 100, height3 / 100);
48780
+ const screen = this.board.add(this.item);
48781
+ screen.emitNesting(screenChildren);
48782
+ this.isDown = false;
48783
+ this.board.selection.removeAll();
48784
+ this.board.selection.add(screen);
48785
+ this.board.tools.select();
48786
+ this.board.tools.publish();
48787
+ return true;
48788
+ }
48789
+ }
48790
+
48766
48791
  // src/Items/Examples/CardGame/Screen/Screen.ts
48767
48792
  var screenPath = new Path([
48768
48793
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -48817,6 +48842,9 @@ class Screen extends BaseItem {
48817
48842
  }
48818
48843
  this.subject.publish(this);
48819
48844
  }
48845
+ getOwnerId() {
48846
+ return this.ownerId;
48847
+ }
48820
48848
  getBackgroundColor() {
48821
48849
  return this.backgroundColor;
48822
48850
  }
@@ -48889,6 +48917,11 @@ class Screen extends BaseItem {
48889
48917
  }
48890
48918
  applyOwnerId(ownerId) {
48891
48919
  this.ownerId = ownerId;
48920
+ if (!this.ownerId) {
48921
+ this.index.getUnderPoint = () => [];
48922
+ this.index.getEnclosed = () => [];
48923
+ this.index.getEnclosedOrCrossed = () => [];
48924
+ }
48892
48925
  }
48893
48926
  transformPath() {
48894
48927
  this.path = screenPath.copy();
@@ -48906,10 +48939,25 @@ class Screen extends BaseItem {
48906
48939
  }
48907
48940
  deserialize(data) {
48908
48941
  super.deserialize(data);
48942
+ if (this.backgroundUrl) {
48943
+ this.applyBackgroundUrl(this.backgroundUrl);
48944
+ }
48945
+ if (!this.ownerId) {
48946
+ this.index.getUnderPoint = () => [];
48947
+ this.index.getEnclosed = () => [];
48948
+ this.index.getEnclosedOrCrossed = () => [];
48949
+ }
48909
48950
  this.transformPath();
48910
48951
  this.subject.publish(this);
48911
48952
  return this;
48912
48953
  }
48954
+ getRandomItem() {
48955
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
48956
+ if (item) {
48957
+ this.removeChildItems(item);
48958
+ return item;
48959
+ }
48960
+ }
48913
48961
  render(context) {
48914
48962
  if (this.transformationRenderBlock) {
48915
48963
  return;
@@ -48943,6 +48991,7 @@ registerItem({
48943
48991
  defaultData: defaultScreenData,
48944
48992
  toolData: { name: "AddScreen", tool: AddScreen }
48945
48993
  });
48994
+ registerTool({ name: "AddPouch", tool: AddPouch });
48946
48995
  // src/Pointer/Cursor.ts
48947
48996
  var defaultCursors = [
48948
48997
  "default",
package/dist/esm/index.js CHANGED
@@ -47391,6 +47391,9 @@ function registerItem({
47391
47391
  }
47392
47392
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
47393
47393
  }
47394
+ function registerTool(toolData) {
47395
+ registeredTools[toolData.name] = toolData.tool;
47396
+ }
47394
47397
  function createItemFactory(item, defaultData2) {
47395
47398
  return function itemFactory(id, data, board) {
47396
47399
  if (data.itemType !== defaultData2.itemType) {
@@ -48756,6 +48759,28 @@ class AddScreen extends ShapeTool {
48756
48759
  }
48757
48760
  }
48758
48761
 
48762
+ class AddPouch extends ShapeTool {
48763
+ constructor(board, name) {
48764
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
48765
+ }
48766
+ pointerUp() {
48767
+ this.item.applyOwnerId("");
48768
+ const currMbr = this.item.getMbr();
48769
+ 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));
48770
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
48771
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
48772
+ this.initTransformation(width2 / 100, height3 / 100);
48773
+ const screen = this.board.add(this.item);
48774
+ screen.emitNesting(screenChildren);
48775
+ this.isDown = false;
48776
+ this.board.selection.removeAll();
48777
+ this.board.selection.add(screen);
48778
+ this.board.tools.select();
48779
+ this.board.tools.publish();
48780
+ return true;
48781
+ }
48782
+ }
48783
+
48759
48784
  // src/Items/Examples/CardGame/Screen/Screen.ts
48760
48785
  var screenPath = new Path([
48761
48786
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -48810,6 +48835,9 @@ class Screen extends BaseItem {
48810
48835
  }
48811
48836
  this.subject.publish(this);
48812
48837
  }
48838
+ getOwnerId() {
48839
+ return this.ownerId;
48840
+ }
48813
48841
  getBackgroundColor() {
48814
48842
  return this.backgroundColor;
48815
48843
  }
@@ -48882,6 +48910,11 @@ class Screen extends BaseItem {
48882
48910
  }
48883
48911
  applyOwnerId(ownerId) {
48884
48912
  this.ownerId = ownerId;
48913
+ if (!this.ownerId) {
48914
+ this.index.getUnderPoint = () => [];
48915
+ this.index.getEnclosed = () => [];
48916
+ this.index.getEnclosedOrCrossed = () => [];
48917
+ }
48885
48918
  }
48886
48919
  transformPath() {
48887
48920
  this.path = screenPath.copy();
@@ -48899,10 +48932,25 @@ class Screen extends BaseItem {
48899
48932
  }
48900
48933
  deserialize(data) {
48901
48934
  super.deserialize(data);
48935
+ if (this.backgroundUrl) {
48936
+ this.applyBackgroundUrl(this.backgroundUrl);
48937
+ }
48938
+ if (!this.ownerId) {
48939
+ this.index.getUnderPoint = () => [];
48940
+ this.index.getEnclosed = () => [];
48941
+ this.index.getEnclosedOrCrossed = () => [];
48942
+ }
48902
48943
  this.transformPath();
48903
48944
  this.subject.publish(this);
48904
48945
  return this;
48905
48946
  }
48947
+ getRandomItem() {
48948
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
48949
+ if (item) {
48950
+ this.removeChildItems(item);
48951
+ return item;
48952
+ }
48953
+ }
48906
48954
  render(context) {
48907
48955
  if (this.transformationRenderBlock) {
48908
48956
  return;
@@ -48936,6 +48984,7 @@ registerItem({
48936
48984
  defaultData: defaultScreenData,
48937
48985
  toolData: { name: "AddScreen", tool: AddScreen }
48938
48986
  });
48987
+ registerTool({ name: "AddPouch", tool: AddPouch });
48939
48988
  // src/Pointer/Cursor.ts
48940
48989
  var defaultCursors = [
48941
48990
  "default",
package/dist/esm/node.js CHANGED
@@ -49859,6 +49859,9 @@ function registerItem({
49859
49859
  }
49860
49860
  itemCommandFactories[itemType] = createItemCommandFactory(itemType);
49861
49861
  }
49862
+ function registerTool(toolData) {
49863
+ registeredTools[toolData.name] = toolData.tool;
49864
+ }
49862
49865
  function createItemFactory(item, defaultData2) {
49863
49866
  return function itemFactory(id, data, board) {
49864
49867
  if (data.itemType !== defaultData2.itemType) {
@@ -51224,6 +51227,28 @@ class AddScreen extends ShapeTool {
51224
51227
  }
51225
51228
  }
51226
51229
 
51230
+ class AddPouch extends ShapeTool {
51231
+ constructor(board, name) {
51232
+ super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
51233
+ }
51234
+ pointerUp() {
51235
+ this.item.applyOwnerId("");
51236
+ const currMbr = this.item.getMbr();
51237
+ 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));
51238
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
51239
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
51240
+ this.initTransformation(width2 / 100, height3 / 100);
51241
+ const screen = this.board.add(this.item);
51242
+ screen.emitNesting(screenChildren);
51243
+ this.isDown = false;
51244
+ this.board.selection.removeAll();
51245
+ this.board.selection.add(screen);
51246
+ this.board.tools.select();
51247
+ this.board.tools.publish();
51248
+ return true;
51249
+ }
51250
+ }
51251
+
51227
51252
  // src/Items/Examples/CardGame/Screen/Screen.ts
51228
51253
  var screenPath = new Path([
51229
51254
  new Line(new Point(0, 0), new Point(100, 0)),
@@ -51278,6 +51303,9 @@ class Screen extends BaseItem {
51278
51303
  }
51279
51304
  this.subject.publish(this);
51280
51305
  }
51306
+ getOwnerId() {
51307
+ return this.ownerId;
51308
+ }
51281
51309
  getBackgroundColor() {
51282
51310
  return this.backgroundColor;
51283
51311
  }
@@ -51350,6 +51378,11 @@ class Screen extends BaseItem {
51350
51378
  }
51351
51379
  applyOwnerId(ownerId) {
51352
51380
  this.ownerId = ownerId;
51381
+ if (!this.ownerId) {
51382
+ this.index.getUnderPoint = () => [];
51383
+ this.index.getEnclosed = () => [];
51384
+ this.index.getEnclosedOrCrossed = () => [];
51385
+ }
51353
51386
  }
51354
51387
  transformPath() {
51355
51388
  this.path = screenPath.copy();
@@ -51367,10 +51400,25 @@ class Screen extends BaseItem {
51367
51400
  }
51368
51401
  deserialize(data) {
51369
51402
  super.deserialize(data);
51403
+ if (this.backgroundUrl) {
51404
+ this.applyBackgroundUrl(this.backgroundUrl);
51405
+ }
51406
+ if (!this.ownerId) {
51407
+ this.index.getUnderPoint = () => [];
51408
+ this.index.getEnclosed = () => [];
51409
+ this.index.getEnclosedOrCrossed = () => [];
51410
+ }
51370
51411
  this.transformPath();
51371
51412
  this.subject.publish(this);
51372
51413
  return this;
51373
51414
  }
51415
+ getRandomItem() {
51416
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
51417
+ if (item) {
51418
+ this.removeChildItems(item);
51419
+ return item;
51420
+ }
51421
+ }
51374
51422
  render(context) {
51375
51423
  if (this.transformationRenderBlock) {
51376
51424
  return;
@@ -51404,6 +51452,7 @@ registerItem({
51404
51452
  defaultData: defaultScreenData,
51405
51453
  toolData: { name: "AddScreen", tool: AddScreen }
51406
51454
  });
51455
+ registerTool({ name: "AddPouch", tool: AddPouch });
51407
51456
  // src/Pointer/Cursor.ts
51408
51457
  var defaultCursors = [
51409
51458
  "default",
@@ -4,3 +4,7 @@ export declare class AddScreen extends ShapeTool {
4
4
  constructor(board: Board, name: string);
5
5
  pointerUp(): boolean;
6
6
  }
7
+ export declare class AddPouch extends ShapeTool {
8
+ constructor(board: Board, name: string);
9
+ pointerUp(): boolean;
10
+ }
@@ -16,6 +16,7 @@ export declare class Screen extends BaseItem {
16
16
  backgroundImage: HTMLImageElement | null;
17
17
  constructor(board: Board, id?: string, ownerId?: string);
18
18
  apply(op: ScreenOperation): void;
19
+ getOwnerId(): string;
19
20
  getBackgroundColor(): string;
20
21
  getBorderStyle(): string;
21
22
  getStrokeColor(): string;
@@ -32,6 +33,7 @@ export declare class Screen extends BaseItem {
32
33
  private transformPath;
33
34
  updateMbr(): void;
34
35
  deserialize(data: SerializedItemData): this;
36
+ getRandomItem(): BaseItem | undefined;
35
37
  render(context: DrawingContext): void;
36
38
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
37
39
  }
@@ -9,4 +9,8 @@ type RegisterItemArgs = {
9
9
  };
10
10
  };
11
11
  export declare function registerItem({ item, defaultData, toolData, }: RegisterItemArgs): void;
12
+ export declare function registerTool(toolData: {
13
+ name: string;
14
+ tool: typeof CustomTool;
15
+ }): void;
12
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.60",
3
+ "version": "0.5.62",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",