microboard-temp 0.5.116 → 0.5.117

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.
@@ -42219,9 +42219,7 @@ class ImageItem extends BaseItem {
42219
42219
  this.imageDimension = imageDimension;
42220
42220
  this.transformation = new Transformation(id, events);
42221
42221
  this.image = new Image;
42222
- this.image.crossOrigin = "anonymous";
42223
- this.image.onload = this.onLoad;
42224
- this.image.onerror = this.onError;
42222
+ this.setImage(new Image);
42225
42223
  if (typeof base64 === "string") {
42226
42224
  this.image.src = base64;
42227
42225
  }
@@ -42231,11 +42229,15 @@ class ImageItem extends BaseItem {
42231
42229
  });
42232
42230
  this.transformation.subject.subscribe(this.onTransform);
42233
42231
  }
42232
+ setImage(image2) {
42233
+ this.image = image2;
42234
+ this.image.crossOrigin = "anonymous";
42235
+ this.image.onload = this.onLoad;
42236
+ this.image.onerror = this.onError;
42237
+ this.updateMbr();
42238
+ }
42234
42239
  async setStorageLink(link2) {
42235
- console.log("setStorageLink", link2);
42236
42240
  this.storageLink = link2;
42237
- console.log("board", this.board);
42238
- console.log("accessToken", this.board.getAccount()?.accessToken);
42239
42241
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
42240
42242
  this.image.src = this.signedUrl;
42241
42243
  }
@@ -42244,7 +42246,7 @@ class ImageItem extends BaseItem {
42244
42246
  }
42245
42247
  handleError = () => {
42246
42248
  console.error("Invalid dataUrl or image failed to load.");
42247
- this.image = getPlaceholderImage(this.board);
42249
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42248
42250
  this.updateMbr();
42249
42251
  this.subject.publish(this);
42250
42252
  this.shootLoadCallbacks();
@@ -42256,10 +42258,11 @@ class ImageItem extends BaseItem {
42256
42258
  this.shootLoadCallbacks();
42257
42259
  };
42258
42260
  onError = () => {
42259
- this.image = getPlaceholderImage(this.board, this.imageDimension);
42261
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42260
42262
  this.updateMbr();
42261
42263
  this.subject.publish(this);
42262
42264
  this.shootLoadCallbacks();
42265
+ this.image.onload = this.onLoad;
42263
42266
  };
42264
42267
  onTransform = () => {
42265
42268
  this.updateMbr();
@@ -42332,7 +42335,7 @@ class ImageItem extends BaseItem {
42332
42335
  this.linkTo.deserialize(data.linkTo);
42333
42336
  this.image.onload = () => {
42334
42337
  this.setCoordinates();
42335
- this.shootLoadCallbacks();
42338
+ this.onLoad();
42336
42339
  };
42337
42340
  if (data.storageLink) {
42338
42341
  this.setStorageLink(data.storageLink);
@@ -42377,7 +42380,6 @@ class ImageItem extends BaseItem {
42377
42380
  if (this.transformationRenderBlock) {
42378
42381
  return;
42379
42382
  }
42380
- console.log(this);
42381
42383
  const ctx = context.ctx;
42382
42384
  ctx.save();
42383
42385
  this.transformation.matrix.applyToContext(ctx);
package/dist/cjs/index.js CHANGED
@@ -42219,9 +42219,7 @@ class ImageItem extends BaseItem {
42219
42219
  this.imageDimension = imageDimension;
42220
42220
  this.transformation = new Transformation(id, events);
42221
42221
  this.image = new Image;
42222
- this.image.crossOrigin = "anonymous";
42223
- this.image.onload = this.onLoad;
42224
- this.image.onerror = this.onError;
42222
+ this.setImage(new Image);
42225
42223
  if (typeof base64 === "string") {
42226
42224
  this.image.src = base64;
42227
42225
  }
@@ -42231,11 +42229,15 @@ class ImageItem extends BaseItem {
42231
42229
  });
42232
42230
  this.transformation.subject.subscribe(this.onTransform);
42233
42231
  }
42232
+ setImage(image2) {
42233
+ this.image = image2;
42234
+ this.image.crossOrigin = "anonymous";
42235
+ this.image.onload = this.onLoad;
42236
+ this.image.onerror = this.onError;
42237
+ this.updateMbr();
42238
+ }
42234
42239
  async setStorageLink(link2) {
42235
- console.log("setStorageLink", link2);
42236
42240
  this.storageLink = link2;
42237
- console.log("board", this.board);
42238
- console.log("accessToken", this.board.getAccount()?.accessToken);
42239
42241
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
42240
42242
  this.image.src = this.signedUrl;
42241
42243
  }
@@ -42244,7 +42246,7 @@ class ImageItem extends BaseItem {
42244
42246
  }
42245
42247
  handleError = () => {
42246
42248
  console.error("Invalid dataUrl or image failed to load.");
42247
- this.image = getPlaceholderImage(this.board);
42249
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42248
42250
  this.updateMbr();
42249
42251
  this.subject.publish(this);
42250
42252
  this.shootLoadCallbacks();
@@ -42256,10 +42258,11 @@ class ImageItem extends BaseItem {
42256
42258
  this.shootLoadCallbacks();
42257
42259
  };
42258
42260
  onError = () => {
42259
- this.image = getPlaceholderImage(this.board, this.imageDimension);
42261
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42260
42262
  this.updateMbr();
42261
42263
  this.subject.publish(this);
42262
42264
  this.shootLoadCallbacks();
42265
+ this.image.onload = this.onLoad;
42263
42266
  };
42264
42267
  onTransform = () => {
42265
42268
  this.updateMbr();
@@ -42332,7 +42335,7 @@ class ImageItem extends BaseItem {
42332
42335
  this.linkTo.deserialize(data.linkTo);
42333
42336
  this.image.onload = () => {
42334
42337
  this.setCoordinates();
42335
- this.shootLoadCallbacks();
42338
+ this.onLoad();
42336
42339
  };
42337
42340
  if (data.storageLink) {
42338
42341
  this.setStorageLink(data.storageLink);
@@ -42377,7 +42380,6 @@ class ImageItem extends BaseItem {
42377
42380
  if (this.transformationRenderBlock) {
42378
42381
  return;
42379
42382
  }
42380
- console.log(this);
42381
42383
  const ctx = context.ctx;
42382
42384
  ctx.save();
42383
42385
  this.transformation.matrix.applyToContext(ctx);
package/dist/cjs/node.js CHANGED
@@ -44692,9 +44692,7 @@ class ImageItem extends BaseItem {
44692
44692
  this.imageDimension = imageDimension;
44693
44693
  this.transformation = new Transformation(id, events);
44694
44694
  this.image = new Image;
44695
- this.image.crossOrigin = "anonymous";
44696
- this.image.onload = this.onLoad;
44697
- this.image.onerror = this.onError;
44695
+ this.setImage(new Image);
44698
44696
  if (typeof base64 === "string") {
44699
44697
  this.image.src = base64;
44700
44698
  }
@@ -44704,11 +44702,15 @@ class ImageItem extends BaseItem {
44704
44702
  });
44705
44703
  this.transformation.subject.subscribe(this.onTransform);
44706
44704
  }
44705
+ setImage(image2) {
44706
+ this.image = image2;
44707
+ this.image.crossOrigin = "anonymous";
44708
+ this.image.onload = this.onLoad;
44709
+ this.image.onerror = this.onError;
44710
+ this.updateMbr();
44711
+ }
44707
44712
  async setStorageLink(link2) {
44708
- console.log("setStorageLink", link2);
44709
44713
  this.storageLink = link2;
44710
- console.log("board", this.board);
44711
- console.log("accessToken", this.board.getAccount()?.accessToken);
44712
44714
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
44713
44715
  this.image.src = this.signedUrl;
44714
44716
  }
@@ -44717,7 +44719,7 @@ class ImageItem extends BaseItem {
44717
44719
  }
44718
44720
  handleError = () => {
44719
44721
  console.error("Invalid dataUrl or image failed to load.");
44720
- this.image = getPlaceholderImage(this.board);
44722
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
44721
44723
  this.updateMbr();
44722
44724
  this.subject.publish(this);
44723
44725
  this.shootLoadCallbacks();
@@ -44729,10 +44731,11 @@ class ImageItem extends BaseItem {
44729
44731
  this.shootLoadCallbacks();
44730
44732
  };
44731
44733
  onError = () => {
44732
- this.image = getPlaceholderImage(this.board, this.imageDimension);
44734
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
44733
44735
  this.updateMbr();
44734
44736
  this.subject.publish(this);
44735
44737
  this.shootLoadCallbacks();
44738
+ this.image.onload = this.onLoad;
44736
44739
  };
44737
44740
  onTransform = () => {
44738
44741
  this.updateMbr();
@@ -44805,7 +44808,7 @@ class ImageItem extends BaseItem {
44805
44808
  this.linkTo.deserialize(data.linkTo);
44806
44809
  this.image.onload = () => {
44807
44810
  this.setCoordinates();
44808
- this.shootLoadCallbacks();
44811
+ this.onLoad();
44809
44812
  };
44810
44813
  if (data.storageLink) {
44811
44814
  this.setStorageLink(data.storageLink);
@@ -44850,7 +44853,6 @@ class ImageItem extends BaseItem {
44850
44853
  if (this.transformationRenderBlock) {
44851
44854
  return;
44852
44855
  }
44853
- console.log(this);
44854
44856
  const ctx = context.ctx;
44855
44857
  ctx.save();
44856
44858
  this.transformation.matrix.applyToContext(ctx);
@@ -42063,9 +42063,7 @@ class ImageItem extends BaseItem {
42063
42063
  this.imageDimension = imageDimension;
42064
42064
  this.transformation = new Transformation(id, events);
42065
42065
  this.image = new Image;
42066
- this.image.crossOrigin = "anonymous";
42067
- this.image.onload = this.onLoad;
42068
- this.image.onerror = this.onError;
42066
+ this.setImage(new Image);
42069
42067
  if (typeof base64 === "string") {
42070
42068
  this.image.src = base64;
42071
42069
  }
@@ -42075,11 +42073,15 @@ class ImageItem extends BaseItem {
42075
42073
  });
42076
42074
  this.transformation.subject.subscribe(this.onTransform);
42077
42075
  }
42076
+ setImage(image2) {
42077
+ this.image = image2;
42078
+ this.image.crossOrigin = "anonymous";
42079
+ this.image.onload = this.onLoad;
42080
+ this.image.onerror = this.onError;
42081
+ this.updateMbr();
42082
+ }
42078
42083
  async setStorageLink(link2) {
42079
- console.log("setStorageLink", link2);
42080
42084
  this.storageLink = link2;
42081
- console.log("board", this.board);
42082
- console.log("accessToken", this.board.getAccount()?.accessToken);
42083
42085
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
42084
42086
  this.image.src = this.signedUrl;
42085
42087
  }
@@ -42088,7 +42090,7 @@ class ImageItem extends BaseItem {
42088
42090
  }
42089
42091
  handleError = () => {
42090
42092
  console.error("Invalid dataUrl or image failed to load.");
42091
- this.image = getPlaceholderImage(this.board);
42093
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42092
42094
  this.updateMbr();
42093
42095
  this.subject.publish(this);
42094
42096
  this.shootLoadCallbacks();
@@ -42100,10 +42102,11 @@ class ImageItem extends BaseItem {
42100
42102
  this.shootLoadCallbacks();
42101
42103
  };
42102
42104
  onError = () => {
42103
- this.image = getPlaceholderImage(this.board, this.imageDimension);
42105
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42104
42106
  this.updateMbr();
42105
42107
  this.subject.publish(this);
42106
42108
  this.shootLoadCallbacks();
42109
+ this.image.onload = this.onLoad;
42107
42110
  };
42108
42111
  onTransform = () => {
42109
42112
  this.updateMbr();
@@ -42176,7 +42179,7 @@ class ImageItem extends BaseItem {
42176
42179
  this.linkTo.deserialize(data.linkTo);
42177
42180
  this.image.onload = () => {
42178
42181
  this.setCoordinates();
42179
- this.shootLoadCallbacks();
42182
+ this.onLoad();
42180
42183
  };
42181
42184
  if (data.storageLink) {
42182
42185
  this.setStorageLink(data.storageLink);
@@ -42221,7 +42224,6 @@ class ImageItem extends BaseItem {
42221
42224
  if (this.transformationRenderBlock) {
42222
42225
  return;
42223
42226
  }
42224
- console.log(this);
42225
42227
  const ctx = context.ctx;
42226
42228
  ctx.save();
42227
42229
  this.transformation.matrix.applyToContext(ctx);
package/dist/esm/index.js CHANGED
@@ -42056,9 +42056,7 @@ class ImageItem extends BaseItem {
42056
42056
  this.imageDimension = imageDimension;
42057
42057
  this.transformation = new Transformation(id, events);
42058
42058
  this.image = new Image;
42059
- this.image.crossOrigin = "anonymous";
42060
- this.image.onload = this.onLoad;
42061
- this.image.onerror = this.onError;
42059
+ this.setImage(new Image);
42062
42060
  if (typeof base64 === "string") {
42063
42061
  this.image.src = base64;
42064
42062
  }
@@ -42068,11 +42066,15 @@ class ImageItem extends BaseItem {
42068
42066
  });
42069
42067
  this.transformation.subject.subscribe(this.onTransform);
42070
42068
  }
42069
+ setImage(image2) {
42070
+ this.image = image2;
42071
+ this.image.crossOrigin = "anonymous";
42072
+ this.image.onload = this.onLoad;
42073
+ this.image.onerror = this.onError;
42074
+ this.updateMbr();
42075
+ }
42071
42076
  async setStorageLink(link2) {
42072
- console.log("setStorageLink", link2);
42073
42077
  this.storageLink = link2;
42074
- console.log("board", this.board);
42075
- console.log("accessToken", this.board.getAccount()?.accessToken);
42076
42078
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
42077
42079
  this.image.src = this.signedUrl;
42078
42080
  }
@@ -42081,7 +42083,7 @@ class ImageItem extends BaseItem {
42081
42083
  }
42082
42084
  handleError = () => {
42083
42085
  console.error("Invalid dataUrl or image failed to load.");
42084
- this.image = getPlaceholderImage(this.board);
42086
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42085
42087
  this.updateMbr();
42086
42088
  this.subject.publish(this);
42087
42089
  this.shootLoadCallbacks();
@@ -42093,10 +42095,11 @@ class ImageItem extends BaseItem {
42093
42095
  this.shootLoadCallbacks();
42094
42096
  };
42095
42097
  onError = () => {
42096
- this.image = getPlaceholderImage(this.board, this.imageDimension);
42098
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
42097
42099
  this.updateMbr();
42098
42100
  this.subject.publish(this);
42099
42101
  this.shootLoadCallbacks();
42102
+ this.image.onload = this.onLoad;
42100
42103
  };
42101
42104
  onTransform = () => {
42102
42105
  this.updateMbr();
@@ -42169,7 +42172,7 @@ class ImageItem extends BaseItem {
42169
42172
  this.linkTo.deserialize(data.linkTo);
42170
42173
  this.image.onload = () => {
42171
42174
  this.setCoordinates();
42172
- this.shootLoadCallbacks();
42175
+ this.onLoad();
42173
42176
  };
42174
42177
  if (data.storageLink) {
42175
42178
  this.setStorageLink(data.storageLink);
@@ -42214,7 +42217,6 @@ class ImageItem extends BaseItem {
42214
42217
  if (this.transformationRenderBlock) {
42215
42218
  return;
42216
42219
  }
42217
- console.log(this);
42218
42220
  const ctx = context.ctx;
42219
42221
  ctx.save();
42220
42222
  this.transformation.matrix.applyToContext(ctx);
package/dist/esm/node.js CHANGED
@@ -44524,9 +44524,7 @@ class ImageItem extends BaseItem {
44524
44524
  this.imageDimension = imageDimension;
44525
44525
  this.transformation = new Transformation(id, events);
44526
44526
  this.image = new Image;
44527
- this.image.crossOrigin = "anonymous";
44528
- this.image.onload = this.onLoad;
44529
- this.image.onerror = this.onError;
44527
+ this.setImage(new Image);
44530
44528
  if (typeof base64 === "string") {
44531
44529
  this.image.src = base64;
44532
44530
  }
@@ -44536,11 +44534,15 @@ class ImageItem extends BaseItem {
44536
44534
  });
44537
44535
  this.transformation.subject.subscribe(this.onTransform);
44538
44536
  }
44537
+ setImage(image2) {
44538
+ this.image = image2;
44539
+ this.image.crossOrigin = "anonymous";
44540
+ this.image.onload = this.onLoad;
44541
+ this.image.onerror = this.onError;
44542
+ this.updateMbr();
44543
+ }
44539
44544
  async setStorageLink(link2) {
44540
- console.log("setStorageLink", link2);
44541
44545
  this.storageLink = link2;
44542
- console.log("board", this.board);
44543
- console.log("accessToken", this.board.getAccount()?.accessToken);
44544
44546
  this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
44545
44547
  this.image.src = this.signedUrl;
44546
44548
  }
@@ -44549,7 +44551,7 @@ class ImageItem extends BaseItem {
44549
44551
  }
44550
44552
  handleError = () => {
44551
44553
  console.error("Invalid dataUrl or image failed to load.");
44552
- this.image = getPlaceholderImage(this.board);
44554
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
44553
44555
  this.updateMbr();
44554
44556
  this.subject.publish(this);
44555
44557
  this.shootLoadCallbacks();
@@ -44561,10 +44563,11 @@ class ImageItem extends BaseItem {
44561
44563
  this.shootLoadCallbacks();
44562
44564
  };
44563
44565
  onError = () => {
44564
- this.image = getPlaceholderImage(this.board, this.imageDimension);
44566
+ this.setImage(getPlaceholderImage(this.board, this.imageDimension));
44565
44567
  this.updateMbr();
44566
44568
  this.subject.publish(this);
44567
44569
  this.shootLoadCallbacks();
44570
+ this.image.onload = this.onLoad;
44568
44571
  };
44569
44572
  onTransform = () => {
44570
44573
  this.updateMbr();
@@ -44637,7 +44640,7 @@ class ImageItem extends BaseItem {
44637
44640
  this.linkTo.deserialize(data.linkTo);
44638
44641
  this.image.onload = () => {
44639
44642
  this.setCoordinates();
44640
- this.shootLoadCallbacks();
44643
+ this.onLoad();
44641
44644
  };
44642
44645
  if (data.storageLink) {
44643
44646
  this.setStorageLink(data.storageLink);
@@ -44682,7 +44685,6 @@ class ImageItem extends BaseItem {
44682
44685
  if (this.transformationRenderBlock) {
44683
44686
  return;
44684
44687
  }
44685
- console.log(this);
44686
44688
  const ctx = context.ctx;
44687
44689
  ctx.save();
44688
44690
  this.transformation.matrix.applyToContext(ctx);
@@ -43,6 +43,7 @@ export declare class ImageItem extends BaseItem {
43
43
  imageDimension: Dimension;
44
44
  board: Board;
45
45
  constructor({ base64, storageLink, imageDimension }: ImageConstructorData, board: Board, events?: Events | undefined, id?: string);
46
+ private setImage;
46
47
  setStorageLink(link: string): Promise<void>;
47
48
  getStorageId(): string | undefined;
48
49
  handleError: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.116",
3
+ "version": "0.5.117",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",