microboard-temp 0.5.56 → 0.5.58

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.
@@ -48918,7 +48918,7 @@ class AddScreen extends ShapeTool {
48918
48918
  }
48919
48919
 
48920
48920
  // src/Items/Examples/CardGame/Screen/Screen.ts
48921
- var handPath = new Path([
48921
+ var screenPath = new Path([
48922
48922
  new Line(new Point(0, 0), new Point(100, 0)),
48923
48923
  new Line(new Point(100, 0), new Point(100, 100)),
48924
48924
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -48926,7 +48926,8 @@ var handPath = new Path([
48926
48926
  ], true, "#FFFFFF", "#000000");
48927
48927
  var defaultScreenData = {
48928
48928
  itemType: "Screen",
48929
- ownerId: ""
48929
+ ownerId: "",
48930
+ backgroundUrl: ""
48930
48931
  };
48931
48932
 
48932
48933
  class Screen extends BaseItem {
@@ -48935,6 +48936,8 @@ class Screen extends BaseItem {
48935
48936
  path;
48936
48937
  borderWidth = 1;
48937
48938
  backgroundColor = "#FFFFFF";
48939
+ backgroundUrl = "";
48940
+ backgroundImage = null;
48938
48941
  constructor(board, id = "", ownerId = "") {
48939
48942
  super(board, id, defaultScreenData, true);
48940
48943
  this.ownerId = ownerId;
@@ -48960,6 +48963,9 @@ class Screen extends BaseItem {
48960
48963
  case "setBorderColor":
48961
48964
  this.applyBorderColor(op.newData.borderColor);
48962
48965
  break;
48966
+ case "setBackgroundUrl":
48967
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
48968
+ break;
48963
48969
  }
48964
48970
  break;
48965
48971
  }
@@ -48983,7 +48989,7 @@ class Screen extends BaseItem {
48983
48989
  }
48984
48990
  setBackgroundColor(backgroundColor) {
48985
48991
  this.emit({
48986
- class: "Dice",
48992
+ class: "Screen",
48987
48993
  method: "setBackgroundColor",
48988
48994
  item: [this.getId()],
48989
48995
  newData: { backgroundColor },
@@ -48996,7 +49002,7 @@ class Screen extends BaseItem {
48996
49002
  }
48997
49003
  setBorderWidth(borderWidth) {
48998
49004
  this.emit({
48999
- class: "Dice",
49005
+ class: "Screen",
49000
49006
  method: "setBorderWidth",
49001
49007
  item: [this.getId()],
49002
49008
  newData: { borderWidth },
@@ -49009,18 +49015,37 @@ class Screen extends BaseItem {
49009
49015
  }
49010
49016
  setBorderColor(borderColor) {
49011
49017
  this.emit({
49012
- class: "Dice",
49018
+ class: "Screen",
49013
49019
  method: "setBorderColor",
49014
49020
  item: [this.getId()],
49015
49021
  newData: { borderColor },
49016
49022
  prevData: { borderColor: this.borderColor }
49017
49023
  });
49018
49024
  }
49025
+ applyBackgroundUrl(url) {
49026
+ this.backgroundUrl = url || "";
49027
+ if (url) {
49028
+ this.backgroundImage = new Image;
49029
+ this.backgroundImage.src = url;
49030
+ this.applyBackgroundColor("none");
49031
+ } else {
49032
+ this.backgroundImage = null;
49033
+ }
49034
+ }
49035
+ setBackgroundUrl(url) {
49036
+ this.emit({
49037
+ class: "Screen",
49038
+ method: "setBackgroundUrl",
49039
+ item: [this.getId()],
49040
+ newData: { backgroundUrl: url },
49041
+ prevData: { backgroundUrl: this.backgroundUrl }
49042
+ });
49043
+ }
49019
49044
  applyOwnerId(ownerId) {
49020
49045
  this.ownerId = ownerId;
49021
49046
  }
49022
49047
  transformPath() {
49023
- this.path = handPath.copy();
49048
+ this.path = screenPath.copy();
49024
49049
  this.path.transform(this.transformation.matrix);
49025
49050
  this.path.setBackgroundColor(this.backgroundColor);
49026
49051
  this.path.setBorderColor(this.borderColor);
@@ -49043,6 +49068,13 @@ class Screen extends BaseItem {
49043
49068
  if (this.transformationRenderBlock) {
49044
49069
  return;
49045
49070
  }
49071
+ if (this.backgroundImage && this.backgroundImage.complete) {
49072
+ const ctx = context.ctx;
49073
+ ctx.save();
49074
+ this.transformation.matrix.applyToContext(ctx);
49075
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
49076
+ ctx.restore();
49077
+ }
49046
49078
  this.path.render(context);
49047
49079
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
49048
49080
  super.render(context);
package/dist/cjs/index.js CHANGED
@@ -48918,7 +48918,7 @@ class AddScreen extends ShapeTool {
48918
48918
  }
48919
48919
 
48920
48920
  // src/Items/Examples/CardGame/Screen/Screen.ts
48921
- var handPath = new Path([
48921
+ var screenPath = new Path([
48922
48922
  new Line(new Point(0, 0), new Point(100, 0)),
48923
48923
  new Line(new Point(100, 0), new Point(100, 100)),
48924
48924
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -48926,7 +48926,8 @@ var handPath = new Path([
48926
48926
  ], true, "#FFFFFF", "#000000");
48927
48927
  var defaultScreenData = {
48928
48928
  itemType: "Screen",
48929
- ownerId: ""
48929
+ ownerId: "",
48930
+ backgroundUrl: ""
48930
48931
  };
48931
48932
 
48932
48933
  class Screen extends BaseItem {
@@ -48935,6 +48936,8 @@ class Screen extends BaseItem {
48935
48936
  path;
48936
48937
  borderWidth = 1;
48937
48938
  backgroundColor = "#FFFFFF";
48939
+ backgroundUrl = "";
48940
+ backgroundImage = null;
48938
48941
  constructor(board, id = "", ownerId = "") {
48939
48942
  super(board, id, defaultScreenData, true);
48940
48943
  this.ownerId = ownerId;
@@ -48960,6 +48963,9 @@ class Screen extends BaseItem {
48960
48963
  case "setBorderColor":
48961
48964
  this.applyBorderColor(op.newData.borderColor);
48962
48965
  break;
48966
+ case "setBackgroundUrl":
48967
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
48968
+ break;
48963
48969
  }
48964
48970
  break;
48965
48971
  }
@@ -48983,7 +48989,7 @@ class Screen extends BaseItem {
48983
48989
  }
48984
48990
  setBackgroundColor(backgroundColor) {
48985
48991
  this.emit({
48986
- class: "Dice",
48992
+ class: "Screen",
48987
48993
  method: "setBackgroundColor",
48988
48994
  item: [this.getId()],
48989
48995
  newData: { backgroundColor },
@@ -48996,7 +49002,7 @@ class Screen extends BaseItem {
48996
49002
  }
48997
49003
  setBorderWidth(borderWidth) {
48998
49004
  this.emit({
48999
- class: "Dice",
49005
+ class: "Screen",
49000
49006
  method: "setBorderWidth",
49001
49007
  item: [this.getId()],
49002
49008
  newData: { borderWidth },
@@ -49009,18 +49015,37 @@ class Screen extends BaseItem {
49009
49015
  }
49010
49016
  setBorderColor(borderColor) {
49011
49017
  this.emit({
49012
- class: "Dice",
49018
+ class: "Screen",
49013
49019
  method: "setBorderColor",
49014
49020
  item: [this.getId()],
49015
49021
  newData: { borderColor },
49016
49022
  prevData: { borderColor: this.borderColor }
49017
49023
  });
49018
49024
  }
49025
+ applyBackgroundUrl(url) {
49026
+ this.backgroundUrl = url || "";
49027
+ if (url) {
49028
+ this.backgroundImage = new Image;
49029
+ this.backgroundImage.src = url;
49030
+ this.applyBackgroundColor("none");
49031
+ } else {
49032
+ this.backgroundImage = null;
49033
+ }
49034
+ }
49035
+ setBackgroundUrl(url) {
49036
+ this.emit({
49037
+ class: "Screen",
49038
+ method: "setBackgroundUrl",
49039
+ item: [this.getId()],
49040
+ newData: { backgroundUrl: url },
49041
+ prevData: { backgroundUrl: this.backgroundUrl }
49042
+ });
49043
+ }
49019
49044
  applyOwnerId(ownerId) {
49020
49045
  this.ownerId = ownerId;
49021
49046
  }
49022
49047
  transformPath() {
49023
- this.path = handPath.copy();
49048
+ this.path = screenPath.copy();
49024
49049
  this.path.transform(this.transformation.matrix);
49025
49050
  this.path.setBackgroundColor(this.backgroundColor);
49026
49051
  this.path.setBorderColor(this.borderColor);
@@ -49043,6 +49068,13 @@ class Screen extends BaseItem {
49043
49068
  if (this.transformationRenderBlock) {
49044
49069
  return;
49045
49070
  }
49071
+ if (this.backgroundImage && this.backgroundImage.complete) {
49072
+ const ctx = context.ctx;
49073
+ ctx.save();
49074
+ this.transformation.matrix.applyToContext(ctx);
49075
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
49076
+ ctx.restore();
49077
+ }
49046
49078
  this.path.render(context);
49047
49079
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
49048
49080
  super.render(context);
package/dist/cjs/node.js CHANGED
@@ -51391,7 +51391,7 @@ class AddScreen extends ShapeTool {
51391
51391
  }
51392
51392
 
51393
51393
  // src/Items/Examples/CardGame/Screen/Screen.ts
51394
- var handPath = new Path([
51394
+ var screenPath = new Path([
51395
51395
  new Line(new Point(0, 0), new Point(100, 0)),
51396
51396
  new Line(new Point(100, 0), new Point(100, 100)),
51397
51397
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -51399,7 +51399,8 @@ var handPath = new Path([
51399
51399
  ], true, "#FFFFFF", "#000000");
51400
51400
  var defaultScreenData = {
51401
51401
  itemType: "Screen",
51402
- ownerId: ""
51402
+ ownerId: "",
51403
+ backgroundUrl: ""
51403
51404
  };
51404
51405
 
51405
51406
  class Screen extends BaseItem {
@@ -51408,6 +51409,8 @@ class Screen extends BaseItem {
51408
51409
  path;
51409
51410
  borderWidth = 1;
51410
51411
  backgroundColor = "#FFFFFF";
51412
+ backgroundUrl = "";
51413
+ backgroundImage = null;
51411
51414
  constructor(board, id = "", ownerId = "") {
51412
51415
  super(board, id, defaultScreenData, true);
51413
51416
  this.ownerId = ownerId;
@@ -51433,6 +51436,9 @@ class Screen extends BaseItem {
51433
51436
  case "setBorderColor":
51434
51437
  this.applyBorderColor(op.newData.borderColor);
51435
51438
  break;
51439
+ case "setBackgroundUrl":
51440
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
51441
+ break;
51436
51442
  }
51437
51443
  break;
51438
51444
  }
@@ -51456,7 +51462,7 @@ class Screen extends BaseItem {
51456
51462
  }
51457
51463
  setBackgroundColor(backgroundColor) {
51458
51464
  this.emit({
51459
- class: "Dice",
51465
+ class: "Screen",
51460
51466
  method: "setBackgroundColor",
51461
51467
  item: [this.getId()],
51462
51468
  newData: { backgroundColor },
@@ -51469,7 +51475,7 @@ class Screen extends BaseItem {
51469
51475
  }
51470
51476
  setBorderWidth(borderWidth) {
51471
51477
  this.emit({
51472
- class: "Dice",
51478
+ class: "Screen",
51473
51479
  method: "setBorderWidth",
51474
51480
  item: [this.getId()],
51475
51481
  newData: { borderWidth },
@@ -51482,18 +51488,37 @@ class Screen extends BaseItem {
51482
51488
  }
51483
51489
  setBorderColor(borderColor) {
51484
51490
  this.emit({
51485
- class: "Dice",
51491
+ class: "Screen",
51486
51492
  method: "setBorderColor",
51487
51493
  item: [this.getId()],
51488
51494
  newData: { borderColor },
51489
51495
  prevData: { borderColor: this.borderColor }
51490
51496
  });
51491
51497
  }
51498
+ applyBackgroundUrl(url) {
51499
+ this.backgroundUrl = url || "";
51500
+ if (url) {
51501
+ this.backgroundImage = new Image;
51502
+ this.backgroundImage.src = url;
51503
+ this.applyBackgroundColor("none");
51504
+ } else {
51505
+ this.backgroundImage = null;
51506
+ }
51507
+ }
51508
+ setBackgroundUrl(url) {
51509
+ this.emit({
51510
+ class: "Screen",
51511
+ method: "setBackgroundUrl",
51512
+ item: [this.getId()],
51513
+ newData: { backgroundUrl: url },
51514
+ prevData: { backgroundUrl: this.backgroundUrl }
51515
+ });
51516
+ }
51492
51517
  applyOwnerId(ownerId) {
51493
51518
  this.ownerId = ownerId;
51494
51519
  }
51495
51520
  transformPath() {
51496
- this.path = handPath.copy();
51521
+ this.path = screenPath.copy();
51497
51522
  this.path.transform(this.transformation.matrix);
51498
51523
  this.path.setBackgroundColor(this.backgroundColor);
51499
51524
  this.path.setBorderColor(this.borderColor);
@@ -51516,6 +51541,13 @@ class Screen extends BaseItem {
51516
51541
  if (this.transformationRenderBlock) {
51517
51542
  return;
51518
51543
  }
51544
+ if (this.backgroundImage && this.backgroundImage.complete) {
51545
+ const ctx = context.ctx;
51546
+ ctx.save();
51547
+ this.transformation.matrix.applyToContext(ctx);
51548
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
51549
+ ctx.restore();
51550
+ }
51519
51551
  this.path.render(context);
51520
51552
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
51521
51553
  super.render(context);
@@ -48764,7 +48764,7 @@ class AddScreen extends ShapeTool {
48764
48764
  }
48765
48765
 
48766
48766
  // src/Items/Examples/CardGame/Screen/Screen.ts
48767
- var handPath = new Path([
48767
+ var screenPath = new Path([
48768
48768
  new Line(new Point(0, 0), new Point(100, 0)),
48769
48769
  new Line(new Point(100, 0), new Point(100, 100)),
48770
48770
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -48772,7 +48772,8 @@ var handPath = new Path([
48772
48772
  ], true, "#FFFFFF", "#000000");
48773
48773
  var defaultScreenData = {
48774
48774
  itemType: "Screen",
48775
- ownerId: ""
48775
+ ownerId: "",
48776
+ backgroundUrl: ""
48776
48777
  };
48777
48778
 
48778
48779
  class Screen extends BaseItem {
@@ -48781,6 +48782,8 @@ class Screen extends BaseItem {
48781
48782
  path;
48782
48783
  borderWidth = 1;
48783
48784
  backgroundColor = "#FFFFFF";
48785
+ backgroundUrl = "";
48786
+ backgroundImage = null;
48784
48787
  constructor(board, id = "", ownerId = "") {
48785
48788
  super(board, id, defaultScreenData, true);
48786
48789
  this.ownerId = ownerId;
@@ -48806,6 +48809,9 @@ class Screen extends BaseItem {
48806
48809
  case "setBorderColor":
48807
48810
  this.applyBorderColor(op.newData.borderColor);
48808
48811
  break;
48812
+ case "setBackgroundUrl":
48813
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
48814
+ break;
48809
48815
  }
48810
48816
  break;
48811
48817
  }
@@ -48829,7 +48835,7 @@ class Screen extends BaseItem {
48829
48835
  }
48830
48836
  setBackgroundColor(backgroundColor) {
48831
48837
  this.emit({
48832
- class: "Dice",
48838
+ class: "Screen",
48833
48839
  method: "setBackgroundColor",
48834
48840
  item: [this.getId()],
48835
48841
  newData: { backgroundColor },
@@ -48842,7 +48848,7 @@ class Screen extends BaseItem {
48842
48848
  }
48843
48849
  setBorderWidth(borderWidth) {
48844
48850
  this.emit({
48845
- class: "Dice",
48851
+ class: "Screen",
48846
48852
  method: "setBorderWidth",
48847
48853
  item: [this.getId()],
48848
48854
  newData: { borderWidth },
@@ -48855,18 +48861,37 @@ class Screen extends BaseItem {
48855
48861
  }
48856
48862
  setBorderColor(borderColor) {
48857
48863
  this.emit({
48858
- class: "Dice",
48864
+ class: "Screen",
48859
48865
  method: "setBorderColor",
48860
48866
  item: [this.getId()],
48861
48867
  newData: { borderColor },
48862
48868
  prevData: { borderColor: this.borderColor }
48863
48869
  });
48864
48870
  }
48871
+ applyBackgroundUrl(url) {
48872
+ this.backgroundUrl = url || "";
48873
+ if (url) {
48874
+ this.backgroundImage = new Image;
48875
+ this.backgroundImage.src = url;
48876
+ this.applyBackgroundColor("none");
48877
+ } else {
48878
+ this.backgroundImage = null;
48879
+ }
48880
+ }
48881
+ setBackgroundUrl(url) {
48882
+ this.emit({
48883
+ class: "Screen",
48884
+ method: "setBackgroundUrl",
48885
+ item: [this.getId()],
48886
+ newData: { backgroundUrl: url },
48887
+ prevData: { backgroundUrl: this.backgroundUrl }
48888
+ });
48889
+ }
48865
48890
  applyOwnerId(ownerId) {
48866
48891
  this.ownerId = ownerId;
48867
48892
  }
48868
48893
  transformPath() {
48869
- this.path = handPath.copy();
48894
+ this.path = screenPath.copy();
48870
48895
  this.path.transform(this.transformation.matrix);
48871
48896
  this.path.setBackgroundColor(this.backgroundColor);
48872
48897
  this.path.setBorderColor(this.borderColor);
@@ -48889,6 +48914,13 @@ class Screen extends BaseItem {
48889
48914
  if (this.transformationRenderBlock) {
48890
48915
  return;
48891
48916
  }
48917
+ if (this.backgroundImage && this.backgroundImage.complete) {
48918
+ const ctx = context.ctx;
48919
+ ctx.save();
48920
+ this.transformation.matrix.applyToContext(ctx);
48921
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
48922
+ ctx.restore();
48923
+ }
48892
48924
  this.path.render(context);
48893
48925
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48894
48926
  super.render(context);
package/dist/esm/index.js CHANGED
@@ -48757,7 +48757,7 @@ class AddScreen extends ShapeTool {
48757
48757
  }
48758
48758
 
48759
48759
  // src/Items/Examples/CardGame/Screen/Screen.ts
48760
- var handPath = new Path([
48760
+ var screenPath = new Path([
48761
48761
  new Line(new Point(0, 0), new Point(100, 0)),
48762
48762
  new Line(new Point(100, 0), new Point(100, 100)),
48763
48763
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -48765,7 +48765,8 @@ var handPath = new Path([
48765
48765
  ], true, "#FFFFFF", "#000000");
48766
48766
  var defaultScreenData = {
48767
48767
  itemType: "Screen",
48768
- ownerId: ""
48768
+ ownerId: "",
48769
+ backgroundUrl: ""
48769
48770
  };
48770
48771
 
48771
48772
  class Screen extends BaseItem {
@@ -48774,6 +48775,8 @@ class Screen extends BaseItem {
48774
48775
  path;
48775
48776
  borderWidth = 1;
48776
48777
  backgroundColor = "#FFFFFF";
48778
+ backgroundUrl = "";
48779
+ backgroundImage = null;
48777
48780
  constructor(board, id = "", ownerId = "") {
48778
48781
  super(board, id, defaultScreenData, true);
48779
48782
  this.ownerId = ownerId;
@@ -48799,6 +48802,9 @@ class Screen extends BaseItem {
48799
48802
  case "setBorderColor":
48800
48803
  this.applyBorderColor(op.newData.borderColor);
48801
48804
  break;
48805
+ case "setBackgroundUrl":
48806
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
48807
+ break;
48802
48808
  }
48803
48809
  break;
48804
48810
  }
@@ -48822,7 +48828,7 @@ class Screen extends BaseItem {
48822
48828
  }
48823
48829
  setBackgroundColor(backgroundColor) {
48824
48830
  this.emit({
48825
- class: "Dice",
48831
+ class: "Screen",
48826
48832
  method: "setBackgroundColor",
48827
48833
  item: [this.getId()],
48828
48834
  newData: { backgroundColor },
@@ -48835,7 +48841,7 @@ class Screen extends BaseItem {
48835
48841
  }
48836
48842
  setBorderWidth(borderWidth) {
48837
48843
  this.emit({
48838
- class: "Dice",
48844
+ class: "Screen",
48839
48845
  method: "setBorderWidth",
48840
48846
  item: [this.getId()],
48841
48847
  newData: { borderWidth },
@@ -48848,18 +48854,37 @@ class Screen extends BaseItem {
48848
48854
  }
48849
48855
  setBorderColor(borderColor) {
48850
48856
  this.emit({
48851
- class: "Dice",
48857
+ class: "Screen",
48852
48858
  method: "setBorderColor",
48853
48859
  item: [this.getId()],
48854
48860
  newData: { borderColor },
48855
48861
  prevData: { borderColor: this.borderColor }
48856
48862
  });
48857
48863
  }
48864
+ applyBackgroundUrl(url) {
48865
+ this.backgroundUrl = url || "";
48866
+ if (url) {
48867
+ this.backgroundImage = new Image;
48868
+ this.backgroundImage.src = url;
48869
+ this.applyBackgroundColor("none");
48870
+ } else {
48871
+ this.backgroundImage = null;
48872
+ }
48873
+ }
48874
+ setBackgroundUrl(url) {
48875
+ this.emit({
48876
+ class: "Screen",
48877
+ method: "setBackgroundUrl",
48878
+ item: [this.getId()],
48879
+ newData: { backgroundUrl: url },
48880
+ prevData: { backgroundUrl: this.backgroundUrl }
48881
+ });
48882
+ }
48858
48883
  applyOwnerId(ownerId) {
48859
48884
  this.ownerId = ownerId;
48860
48885
  }
48861
48886
  transformPath() {
48862
- this.path = handPath.copy();
48887
+ this.path = screenPath.copy();
48863
48888
  this.path.transform(this.transformation.matrix);
48864
48889
  this.path.setBackgroundColor(this.backgroundColor);
48865
48890
  this.path.setBorderColor(this.borderColor);
@@ -48882,6 +48907,13 @@ class Screen extends BaseItem {
48882
48907
  if (this.transformationRenderBlock) {
48883
48908
  return;
48884
48909
  }
48910
+ if (this.backgroundImage && this.backgroundImage.complete) {
48911
+ const ctx = context.ctx;
48912
+ ctx.save();
48913
+ this.transformation.matrix.applyToContext(ctx);
48914
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
48915
+ ctx.restore();
48916
+ }
48885
48917
  this.path.render(context);
48886
48918
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
48887
48919
  super.render(context);
package/dist/esm/node.js CHANGED
@@ -51225,7 +51225,7 @@ class AddScreen extends ShapeTool {
51225
51225
  }
51226
51226
 
51227
51227
  // src/Items/Examples/CardGame/Screen/Screen.ts
51228
- var handPath = new Path([
51228
+ var screenPath = new Path([
51229
51229
  new Line(new Point(0, 0), new Point(100, 0)),
51230
51230
  new Line(new Point(100, 0), new Point(100, 100)),
51231
51231
  new Line(new Point(100, 100), new Point(0, 100)),
@@ -51233,7 +51233,8 @@ var handPath = new Path([
51233
51233
  ], true, "#FFFFFF", "#000000");
51234
51234
  var defaultScreenData = {
51235
51235
  itemType: "Screen",
51236
- ownerId: ""
51236
+ ownerId: "",
51237
+ backgroundUrl: ""
51237
51238
  };
51238
51239
 
51239
51240
  class Screen extends BaseItem {
@@ -51242,6 +51243,8 @@ class Screen extends BaseItem {
51242
51243
  path;
51243
51244
  borderWidth = 1;
51244
51245
  backgroundColor = "#FFFFFF";
51246
+ backgroundUrl = "";
51247
+ backgroundImage = null;
51245
51248
  constructor(board, id = "", ownerId = "") {
51246
51249
  super(board, id, defaultScreenData, true);
51247
51250
  this.ownerId = ownerId;
@@ -51267,6 +51270,9 @@ class Screen extends BaseItem {
51267
51270
  case "setBorderColor":
51268
51271
  this.applyBorderColor(op.newData.borderColor);
51269
51272
  break;
51273
+ case "setBackgroundUrl":
51274
+ this.applyBackgroundUrl(op.newData.backgroundUrl);
51275
+ break;
51270
51276
  }
51271
51277
  break;
51272
51278
  }
@@ -51290,7 +51296,7 @@ class Screen extends BaseItem {
51290
51296
  }
51291
51297
  setBackgroundColor(backgroundColor) {
51292
51298
  this.emit({
51293
- class: "Dice",
51299
+ class: "Screen",
51294
51300
  method: "setBackgroundColor",
51295
51301
  item: [this.getId()],
51296
51302
  newData: { backgroundColor },
@@ -51303,7 +51309,7 @@ class Screen extends BaseItem {
51303
51309
  }
51304
51310
  setBorderWidth(borderWidth) {
51305
51311
  this.emit({
51306
- class: "Dice",
51312
+ class: "Screen",
51307
51313
  method: "setBorderWidth",
51308
51314
  item: [this.getId()],
51309
51315
  newData: { borderWidth },
@@ -51316,18 +51322,37 @@ class Screen extends BaseItem {
51316
51322
  }
51317
51323
  setBorderColor(borderColor) {
51318
51324
  this.emit({
51319
- class: "Dice",
51325
+ class: "Screen",
51320
51326
  method: "setBorderColor",
51321
51327
  item: [this.getId()],
51322
51328
  newData: { borderColor },
51323
51329
  prevData: { borderColor: this.borderColor }
51324
51330
  });
51325
51331
  }
51332
+ applyBackgroundUrl(url) {
51333
+ this.backgroundUrl = url || "";
51334
+ if (url) {
51335
+ this.backgroundImage = new Image;
51336
+ this.backgroundImage.src = url;
51337
+ this.applyBackgroundColor("none");
51338
+ } else {
51339
+ this.backgroundImage = null;
51340
+ }
51341
+ }
51342
+ setBackgroundUrl(url) {
51343
+ this.emit({
51344
+ class: "Screen",
51345
+ method: "setBackgroundUrl",
51346
+ item: [this.getId()],
51347
+ newData: { backgroundUrl: url },
51348
+ prevData: { backgroundUrl: this.backgroundUrl }
51349
+ });
51350
+ }
51326
51351
  applyOwnerId(ownerId) {
51327
51352
  this.ownerId = ownerId;
51328
51353
  }
51329
51354
  transformPath() {
51330
- this.path = handPath.copy();
51355
+ this.path = screenPath.copy();
51331
51356
  this.path.transform(this.transformation.matrix);
51332
51357
  this.path.setBackgroundColor(this.backgroundColor);
51333
51358
  this.path.setBorderColor(this.borderColor);
@@ -51350,6 +51375,13 @@ class Screen extends BaseItem {
51350
51375
  if (this.transformationRenderBlock) {
51351
51376
  return;
51352
51377
  }
51378
+ if (this.backgroundImage && this.backgroundImage.complete) {
51379
+ const ctx = context.ctx;
51380
+ ctx.save();
51381
+ this.transformation.matrix.applyToContext(ctx);
51382
+ ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
51383
+ ctx.restore();
51384
+ }
51353
51385
  this.path.render(context);
51354
51386
  if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
51355
51387
  super.render(context);
@@ -12,6 +12,8 @@ export declare class Screen extends BaseItem {
12
12
  private path;
13
13
  private borderWidth;
14
14
  backgroundColor: string;
15
+ backgroundUrl: string;
16
+ backgroundImage: HTMLImageElement | null;
15
17
  constructor(board: Board, id?: string, ownerId?: string);
16
18
  apply(op: ScreenOperation): void;
17
19
  getBackgroundColor(): string;
@@ -24,6 +26,8 @@ export declare class Screen extends BaseItem {
24
26
  setBorderWidth(borderWidth: BorderWidth): void;
25
27
  private applyBorderColor;
26
28
  setBorderColor(borderColor: string): void;
29
+ private applyBackgroundUrl;
30
+ setBackgroundUrl(url?: string): void;
27
31
  applyOwnerId(ownerId: string): void;
28
32
  private transformPath;
29
33
  updateMbr(): void;
@@ -1,5 +1,5 @@
1
1
  import { BaseOperation } from "../../../../Events/EventsOperations";
2
- export type ScreenOperation = SetBackgroundColor | SetBorderColor | SetBorderWidth;
2
+ export type ScreenOperation = SetBackgroundColor | SetBorderColor | SetBorderWidth | SetBackgroundUrl;
3
3
  interface SetBackgroundColor extends BaseOperation<{
4
4
  backgroundColor: string;
5
5
  }> {
@@ -18,4 +18,10 @@ export interface SetBorderWidth extends BaseOperation<{
18
18
  class: "Screen";
19
19
  method: "setBorderWidth";
20
20
  }
21
+ export interface SetBackgroundUrl extends BaseOperation<{
22
+ backgroundUrl?: string;
23
+ }> {
24
+ class: "Screen";
25
+ method: "setBackgroundUrl";
26
+ }
21
27
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.56",
3
+ "version": "0.5.58",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",