microboard-temp 0.5.59 → 0.5.61

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)),
@@ -49043,6 +49068,11 @@ class Screen extends BaseItem {
49043
49068
  }
49044
49069
  applyOwnerId(ownerId) {
49045
49070
  this.ownerId = ownerId;
49071
+ if (!this.ownerId) {
49072
+ this.index.getUnderPoint = () => [];
49073
+ this.index.getEnclosed = () => [];
49074
+ this.index.getEnclosedOrCrossed = () => [];
49075
+ }
49046
49076
  }
49047
49077
  transformPath() {
49048
49078
  this.path = screenPath.copy();
@@ -49060,10 +49090,25 @@ class Screen extends BaseItem {
49060
49090
  }
49061
49091
  deserialize(data) {
49062
49092
  super.deserialize(data);
49093
+ if (this.backgroundUrl) {
49094
+ this.applyBackgroundUrl(this.backgroundUrl);
49095
+ }
49096
+ if (!this.ownerId) {
49097
+ this.index.getUnderPoint = () => [];
49098
+ this.index.getEnclosed = () => [];
49099
+ this.index.getEnclosedOrCrossed = () => [];
49100
+ }
49063
49101
  this.transformPath();
49064
49102
  this.subject.publish(this);
49065
49103
  return this;
49066
49104
  }
49105
+ getRandomItem() {
49106
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
49107
+ if (item) {
49108
+ this.removeChildItems(item);
49109
+ return item;
49110
+ }
49111
+ }
49067
49112
  render(context) {
49068
49113
  if (this.transformationRenderBlock) {
49069
49114
  return;
@@ -49071,8 +49116,7 @@ class Screen extends BaseItem {
49071
49116
  if (this.backgroundImage && this.backgroundImage.complete) {
49072
49117
  const ctx = context.ctx;
49073
49118
  ctx.save();
49074
- this.transformation.matrix.applyToContext(ctx);
49075
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
49119
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
49076
49120
  ctx.restore();
49077
49121
  }
49078
49122
  this.path.render(context);
@@ -49098,6 +49142,7 @@ registerItem({
49098
49142
  defaultData: defaultScreenData,
49099
49143
  toolData: { name: "AddScreen", tool: AddScreen }
49100
49144
  });
49145
+ registerTool({ name: "AddPouch", tool: AddPouch });
49101
49146
  // src/Pointer/Cursor.ts
49102
49147
  var defaultCursors = [
49103
49148
  "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)),
@@ -49043,6 +49068,11 @@ class Screen extends BaseItem {
49043
49068
  }
49044
49069
  applyOwnerId(ownerId) {
49045
49070
  this.ownerId = ownerId;
49071
+ if (!this.ownerId) {
49072
+ this.index.getUnderPoint = () => [];
49073
+ this.index.getEnclosed = () => [];
49074
+ this.index.getEnclosedOrCrossed = () => [];
49075
+ }
49046
49076
  }
49047
49077
  transformPath() {
49048
49078
  this.path = screenPath.copy();
@@ -49060,10 +49090,25 @@ class Screen extends BaseItem {
49060
49090
  }
49061
49091
  deserialize(data) {
49062
49092
  super.deserialize(data);
49093
+ if (this.backgroundUrl) {
49094
+ this.applyBackgroundUrl(this.backgroundUrl);
49095
+ }
49096
+ if (!this.ownerId) {
49097
+ this.index.getUnderPoint = () => [];
49098
+ this.index.getEnclosed = () => [];
49099
+ this.index.getEnclosedOrCrossed = () => [];
49100
+ }
49063
49101
  this.transformPath();
49064
49102
  this.subject.publish(this);
49065
49103
  return this;
49066
49104
  }
49105
+ getRandomItem() {
49106
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
49107
+ if (item) {
49108
+ this.removeChildItems(item);
49109
+ return item;
49110
+ }
49111
+ }
49067
49112
  render(context) {
49068
49113
  if (this.transformationRenderBlock) {
49069
49114
  return;
@@ -49071,8 +49116,7 @@ class Screen extends BaseItem {
49071
49116
  if (this.backgroundImage && this.backgroundImage.complete) {
49072
49117
  const ctx = context.ctx;
49073
49118
  ctx.save();
49074
- this.transformation.matrix.applyToContext(ctx);
49075
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
49119
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
49076
49120
  ctx.restore();
49077
49121
  }
49078
49122
  this.path.render(context);
@@ -49098,6 +49142,7 @@ registerItem({
49098
49142
  defaultData: defaultScreenData,
49099
49143
  toolData: { name: "AddScreen", tool: AddScreen }
49100
49144
  });
49145
+ registerTool({ name: "AddPouch", tool: AddPouch });
49101
49146
  // src/Pointer/Cursor.ts
49102
49147
  var defaultCursors = [
49103
49148
  "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)),
@@ -51516,6 +51541,11 @@ class Screen extends BaseItem {
51516
51541
  }
51517
51542
  applyOwnerId(ownerId) {
51518
51543
  this.ownerId = ownerId;
51544
+ if (!this.ownerId) {
51545
+ this.index.getUnderPoint = () => [];
51546
+ this.index.getEnclosed = () => [];
51547
+ this.index.getEnclosedOrCrossed = () => [];
51548
+ }
51519
51549
  }
51520
51550
  transformPath() {
51521
51551
  this.path = screenPath.copy();
@@ -51533,10 +51563,25 @@ class Screen extends BaseItem {
51533
51563
  }
51534
51564
  deserialize(data) {
51535
51565
  super.deserialize(data);
51566
+ if (this.backgroundUrl) {
51567
+ this.applyBackgroundUrl(this.backgroundUrl);
51568
+ }
51569
+ if (!this.ownerId) {
51570
+ this.index.getUnderPoint = () => [];
51571
+ this.index.getEnclosed = () => [];
51572
+ this.index.getEnclosedOrCrossed = () => [];
51573
+ }
51536
51574
  this.transformPath();
51537
51575
  this.subject.publish(this);
51538
51576
  return this;
51539
51577
  }
51578
+ getRandomItem() {
51579
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
51580
+ if (item) {
51581
+ this.removeChildItems(item);
51582
+ return item;
51583
+ }
51584
+ }
51540
51585
  render(context) {
51541
51586
  if (this.transformationRenderBlock) {
51542
51587
  return;
@@ -51544,8 +51589,7 @@ class Screen extends BaseItem {
51544
51589
  if (this.backgroundImage && this.backgroundImage.complete) {
51545
51590
  const ctx = context.ctx;
51546
51591
  ctx.save();
51547
- this.transformation.matrix.applyToContext(ctx);
51548
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
51592
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
51549
51593
  ctx.restore();
51550
51594
  }
51551
51595
  this.path.render(context);
@@ -51571,6 +51615,7 @@ registerItem({
51571
51615
  defaultData: defaultScreenData,
51572
51616
  toolData: { name: "AddScreen", tool: AddScreen }
51573
51617
  });
51618
+ registerTool({ name: "AddPouch", tool: AddPouch });
51574
51619
  // src/Pointer/Cursor.ts
51575
51620
  var defaultCursors = [
51576
51621
  "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)),
@@ -48889,6 +48914,11 @@ class Screen extends BaseItem {
48889
48914
  }
48890
48915
  applyOwnerId(ownerId) {
48891
48916
  this.ownerId = ownerId;
48917
+ if (!this.ownerId) {
48918
+ this.index.getUnderPoint = () => [];
48919
+ this.index.getEnclosed = () => [];
48920
+ this.index.getEnclosedOrCrossed = () => [];
48921
+ }
48892
48922
  }
48893
48923
  transformPath() {
48894
48924
  this.path = screenPath.copy();
@@ -48906,10 +48936,25 @@ class Screen extends BaseItem {
48906
48936
  }
48907
48937
  deserialize(data) {
48908
48938
  super.deserialize(data);
48939
+ if (this.backgroundUrl) {
48940
+ this.applyBackgroundUrl(this.backgroundUrl);
48941
+ }
48942
+ if (!this.ownerId) {
48943
+ this.index.getUnderPoint = () => [];
48944
+ this.index.getEnclosed = () => [];
48945
+ this.index.getEnclosedOrCrossed = () => [];
48946
+ }
48909
48947
  this.transformPath();
48910
48948
  this.subject.publish(this);
48911
48949
  return this;
48912
48950
  }
48951
+ getRandomItem() {
48952
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
48953
+ if (item) {
48954
+ this.removeChildItems(item);
48955
+ return item;
48956
+ }
48957
+ }
48913
48958
  render(context) {
48914
48959
  if (this.transformationRenderBlock) {
48915
48960
  return;
@@ -48917,8 +48962,7 @@ class Screen extends BaseItem {
48917
48962
  if (this.backgroundImage && this.backgroundImage.complete) {
48918
48963
  const ctx = context.ctx;
48919
48964
  ctx.save();
48920
- this.transformation.matrix.applyToContext(ctx);
48921
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
48965
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
48922
48966
  ctx.restore();
48923
48967
  }
48924
48968
  this.path.render(context);
@@ -48944,6 +48988,7 @@ registerItem({
48944
48988
  defaultData: defaultScreenData,
48945
48989
  toolData: { name: "AddScreen", tool: AddScreen }
48946
48990
  });
48991
+ registerTool({ name: "AddPouch", tool: AddPouch });
48947
48992
  // src/Pointer/Cursor.ts
48948
48993
  var defaultCursors = [
48949
48994
  "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)),
@@ -48882,6 +48907,11 @@ class Screen extends BaseItem {
48882
48907
  }
48883
48908
  applyOwnerId(ownerId) {
48884
48909
  this.ownerId = ownerId;
48910
+ if (!this.ownerId) {
48911
+ this.index.getUnderPoint = () => [];
48912
+ this.index.getEnclosed = () => [];
48913
+ this.index.getEnclosedOrCrossed = () => [];
48914
+ }
48885
48915
  }
48886
48916
  transformPath() {
48887
48917
  this.path = screenPath.copy();
@@ -48899,10 +48929,25 @@ class Screen extends BaseItem {
48899
48929
  }
48900
48930
  deserialize(data) {
48901
48931
  super.deserialize(data);
48932
+ if (this.backgroundUrl) {
48933
+ this.applyBackgroundUrl(this.backgroundUrl);
48934
+ }
48935
+ if (!this.ownerId) {
48936
+ this.index.getUnderPoint = () => [];
48937
+ this.index.getEnclosed = () => [];
48938
+ this.index.getEnclosedOrCrossed = () => [];
48939
+ }
48902
48940
  this.transformPath();
48903
48941
  this.subject.publish(this);
48904
48942
  return this;
48905
48943
  }
48944
+ getRandomItem() {
48945
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
48946
+ if (item) {
48947
+ this.removeChildItems(item);
48948
+ return item;
48949
+ }
48950
+ }
48906
48951
  render(context) {
48907
48952
  if (this.transformationRenderBlock) {
48908
48953
  return;
@@ -48910,8 +48955,7 @@ class Screen extends BaseItem {
48910
48955
  if (this.backgroundImage && this.backgroundImage.complete) {
48911
48956
  const ctx = context.ctx;
48912
48957
  ctx.save();
48913
- this.transformation.matrix.applyToContext(ctx);
48914
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
48958
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
48915
48959
  ctx.restore();
48916
48960
  }
48917
48961
  this.path.render(context);
@@ -48937,6 +48981,7 @@ registerItem({
48937
48981
  defaultData: defaultScreenData,
48938
48982
  toolData: { name: "AddScreen", tool: AddScreen }
48939
48983
  });
48984
+ registerTool({ name: "AddPouch", tool: AddPouch });
48940
48985
  // src/Pointer/Cursor.ts
48941
48986
  var defaultCursors = [
48942
48987
  "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)),
@@ -51350,6 +51375,11 @@ class Screen extends BaseItem {
51350
51375
  }
51351
51376
  applyOwnerId(ownerId) {
51352
51377
  this.ownerId = ownerId;
51378
+ if (!this.ownerId) {
51379
+ this.index.getUnderPoint = () => [];
51380
+ this.index.getEnclosed = () => [];
51381
+ this.index.getEnclosedOrCrossed = () => [];
51382
+ }
51353
51383
  }
51354
51384
  transformPath() {
51355
51385
  this.path = screenPath.copy();
@@ -51367,10 +51397,25 @@ class Screen extends BaseItem {
51367
51397
  }
51368
51398
  deserialize(data) {
51369
51399
  super.deserialize(data);
51400
+ if (this.backgroundUrl) {
51401
+ this.applyBackgroundUrl(this.backgroundUrl);
51402
+ }
51403
+ if (!this.ownerId) {
51404
+ this.index.getUnderPoint = () => [];
51405
+ this.index.getEnclosed = () => [];
51406
+ this.index.getEnclosedOrCrossed = () => [];
51407
+ }
51370
51408
  this.transformPath();
51371
51409
  this.subject.publish(this);
51372
51410
  return this;
51373
51411
  }
51412
+ getRandomItem() {
51413
+ const item = this.index?.list()[Math.floor(Math.random() * this.index?.list().length)];
51414
+ if (item) {
51415
+ this.removeChildItems(item);
51416
+ return item;
51417
+ }
51418
+ }
51374
51419
  render(context) {
51375
51420
  if (this.transformationRenderBlock) {
51376
51421
  return;
@@ -51378,8 +51423,7 @@ class Screen extends BaseItem {
51378
51423
  if (this.backgroundImage && this.backgroundImage.complete) {
51379
51424
  const ctx = context.ctx;
51380
51425
  ctx.save();
51381
- this.transformation.matrix.applyToContext(ctx);
51382
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
51426
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
51383
51427
  ctx.restore();
51384
51428
  }
51385
51429
  this.path.render(context);
@@ -51405,6 +51449,7 @@ registerItem({
51405
51449
  defaultData: defaultScreenData,
51406
51450
  toolData: { name: "AddScreen", tool: AddScreen }
51407
51451
  });
51452
+ registerTool({ name: "AddPouch", tool: AddPouch });
51408
51453
  // src/Pointer/Cursor.ts
51409
51454
  var defaultCursors = [
51410
51455
  "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
+ }
@@ -32,6 +32,7 @@ export declare class Screen extends BaseItem {
32
32
  private transformPath;
33
33
  updateMbr(): void;
34
34
  deserialize(data: SerializedItemData): this;
35
+ getRandomItem(): BaseItem | undefined;
35
36
  render(context: DrawingContext): void;
36
37
  renderHTML(documentFactory: DocumentFactory): HTMLElement;
37
38
  }
@@ -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.59",
3
+ "version": "0.5.61",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",