microboard-temp 0.5.115 → 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.
- package/dist/cjs/browser.js +15 -19
- package/dist/cjs/index.js +15 -19
- package/dist/cjs/node.js +15 -19
- package/dist/esm/browser.js +15 -19
- package/dist/esm/index.js +15 -19
- package/dist/esm/node.js +15 -19
- package/dist/types/Items/Image/Image.d.ts +2 -1
- package/dist/types/types/Account.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/browser.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.
|
|
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,12 +42229,16 @@ 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
|
-
|
|
42238
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
42239
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
42241
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
42240
42242
|
this.image.src = this.signedUrl;
|
|
42241
42243
|
}
|
|
42242
42244
|
getStorageId() {
|
|
@@ -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.
|
|
42249
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
42248
42250
|
this.updateMbr();
|
|
42249
42251
|
this.subject.publish(this);
|
|
42250
42252
|
this.shootLoadCallbacks();
|
|
@@ -42255,11 +42257,12 @@ class ImageItem extends BaseItem {
|
|
|
42255
42257
|
this.subject.publish(this);
|
|
42256
42258
|
this.shootLoadCallbacks();
|
|
42257
42259
|
};
|
|
42258
|
-
onError = (
|
|
42259
|
-
this.
|
|
42260
|
+
onError = () => {
|
|
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.
|
|
42338
|
+
this.onLoad();
|
|
42336
42339
|
};
|
|
42337
42340
|
if (data.storageLink) {
|
|
42338
42341
|
this.setStorageLink(data.storageLink);
|
|
@@ -42340,13 +42343,7 @@ class ImageItem extends BaseItem {
|
|
|
42340
42343
|
if (this.image.src) {
|
|
42341
42344
|
return this;
|
|
42342
42345
|
}
|
|
42343
|
-
this.
|
|
42344
|
-
const storageImage = new Image;
|
|
42345
|
-
storageImage.onload = () => {
|
|
42346
|
-
this.image = storageImage;
|
|
42347
|
-
this.onLoad();
|
|
42348
|
-
};
|
|
42349
|
-
storageImage.onerror = this.onError;
|
|
42346
|
+
this.onError();
|
|
42350
42347
|
return this;
|
|
42351
42348
|
}
|
|
42352
42349
|
emit(operation) {
|
|
@@ -42383,7 +42380,6 @@ class ImageItem extends BaseItem {
|
|
|
42383
42380
|
if (this.transformationRenderBlock) {
|
|
42384
42381
|
return;
|
|
42385
42382
|
}
|
|
42386
|
-
console.log(this);
|
|
42387
42383
|
const ctx = context.ctx;
|
|
42388
42384
|
ctx.save();
|
|
42389
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.
|
|
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,12 +42229,16 @@ 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
|
-
|
|
42238
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
42239
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
42241
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
42240
42242
|
this.image.src = this.signedUrl;
|
|
42241
42243
|
}
|
|
42242
42244
|
getStorageId() {
|
|
@@ -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.
|
|
42249
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
42248
42250
|
this.updateMbr();
|
|
42249
42251
|
this.subject.publish(this);
|
|
42250
42252
|
this.shootLoadCallbacks();
|
|
@@ -42255,11 +42257,12 @@ class ImageItem extends BaseItem {
|
|
|
42255
42257
|
this.subject.publish(this);
|
|
42256
42258
|
this.shootLoadCallbacks();
|
|
42257
42259
|
};
|
|
42258
|
-
onError = (
|
|
42259
|
-
this.
|
|
42260
|
+
onError = () => {
|
|
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.
|
|
42338
|
+
this.onLoad();
|
|
42336
42339
|
};
|
|
42337
42340
|
if (data.storageLink) {
|
|
42338
42341
|
this.setStorageLink(data.storageLink);
|
|
@@ -42340,13 +42343,7 @@ class ImageItem extends BaseItem {
|
|
|
42340
42343
|
if (this.image.src) {
|
|
42341
42344
|
return this;
|
|
42342
42345
|
}
|
|
42343
|
-
this.
|
|
42344
|
-
const storageImage = new Image;
|
|
42345
|
-
storageImage.onload = () => {
|
|
42346
|
-
this.image = storageImage;
|
|
42347
|
-
this.onLoad();
|
|
42348
|
-
};
|
|
42349
|
-
storageImage.onerror = this.onError;
|
|
42346
|
+
this.onError();
|
|
42350
42347
|
return this;
|
|
42351
42348
|
}
|
|
42352
42349
|
emit(operation) {
|
|
@@ -42383,7 +42380,6 @@ class ImageItem extends BaseItem {
|
|
|
42383
42380
|
if (this.transformationRenderBlock) {
|
|
42384
42381
|
return;
|
|
42385
42382
|
}
|
|
42386
|
-
console.log(this);
|
|
42387
42383
|
const ctx = context.ctx;
|
|
42388
42384
|
ctx.save();
|
|
42389
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.
|
|
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,12 +44702,16 @@ 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
|
-
|
|
44711
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
44712
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
44714
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
44713
44715
|
this.image.src = this.signedUrl;
|
|
44714
44716
|
}
|
|
44715
44717
|
getStorageId() {
|
|
@@ -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.
|
|
44722
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
44721
44723
|
this.updateMbr();
|
|
44722
44724
|
this.subject.publish(this);
|
|
44723
44725
|
this.shootLoadCallbacks();
|
|
@@ -44728,11 +44730,12 @@ class ImageItem extends BaseItem {
|
|
|
44728
44730
|
this.subject.publish(this);
|
|
44729
44731
|
this.shootLoadCallbacks();
|
|
44730
44732
|
};
|
|
44731
|
-
onError = (
|
|
44732
|
-
this.
|
|
44733
|
+
onError = () => {
|
|
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.
|
|
44811
|
+
this.onLoad();
|
|
44809
44812
|
};
|
|
44810
44813
|
if (data.storageLink) {
|
|
44811
44814
|
this.setStorageLink(data.storageLink);
|
|
@@ -44813,13 +44816,7 @@ class ImageItem extends BaseItem {
|
|
|
44813
44816
|
if (this.image.src) {
|
|
44814
44817
|
return this;
|
|
44815
44818
|
}
|
|
44816
|
-
this.
|
|
44817
|
-
const storageImage = new Image;
|
|
44818
|
-
storageImage.onload = () => {
|
|
44819
|
-
this.image = storageImage;
|
|
44820
|
-
this.onLoad();
|
|
44821
|
-
};
|
|
44822
|
-
storageImage.onerror = this.onError;
|
|
44819
|
+
this.onError();
|
|
44823
44820
|
return this;
|
|
44824
44821
|
}
|
|
44825
44822
|
emit(operation) {
|
|
@@ -44856,7 +44853,6 @@ class ImageItem extends BaseItem {
|
|
|
44856
44853
|
if (this.transformationRenderBlock) {
|
|
44857
44854
|
return;
|
|
44858
44855
|
}
|
|
44859
|
-
console.log(this);
|
|
44860
44856
|
const ctx = context.ctx;
|
|
44861
44857
|
ctx.save();
|
|
44862
44858
|
this.transformation.matrix.applyToContext(ctx);
|
package/dist/esm/browser.js
CHANGED
|
@@ -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.
|
|
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,12 +42073,16 @@ 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
|
-
|
|
42082
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
42083
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
42085
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
42084
42086
|
this.image.src = this.signedUrl;
|
|
42085
42087
|
}
|
|
42086
42088
|
getStorageId() {
|
|
@@ -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.
|
|
42093
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
42092
42094
|
this.updateMbr();
|
|
42093
42095
|
this.subject.publish(this);
|
|
42094
42096
|
this.shootLoadCallbacks();
|
|
@@ -42099,11 +42101,12 @@ class ImageItem extends BaseItem {
|
|
|
42099
42101
|
this.subject.publish(this);
|
|
42100
42102
|
this.shootLoadCallbacks();
|
|
42101
42103
|
};
|
|
42102
|
-
onError = (
|
|
42103
|
-
this.
|
|
42104
|
+
onError = () => {
|
|
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.
|
|
42182
|
+
this.onLoad();
|
|
42180
42183
|
};
|
|
42181
42184
|
if (data.storageLink) {
|
|
42182
42185
|
this.setStorageLink(data.storageLink);
|
|
@@ -42184,13 +42187,7 @@ class ImageItem extends BaseItem {
|
|
|
42184
42187
|
if (this.image.src) {
|
|
42185
42188
|
return this;
|
|
42186
42189
|
}
|
|
42187
|
-
this.
|
|
42188
|
-
const storageImage = new Image;
|
|
42189
|
-
storageImage.onload = () => {
|
|
42190
|
-
this.image = storageImage;
|
|
42191
|
-
this.onLoad();
|
|
42192
|
-
};
|
|
42193
|
-
storageImage.onerror = this.onError;
|
|
42190
|
+
this.onError();
|
|
42194
42191
|
return this;
|
|
42195
42192
|
}
|
|
42196
42193
|
emit(operation) {
|
|
@@ -42227,7 +42224,6 @@ class ImageItem extends BaseItem {
|
|
|
42227
42224
|
if (this.transformationRenderBlock) {
|
|
42228
42225
|
return;
|
|
42229
42226
|
}
|
|
42230
|
-
console.log(this);
|
|
42231
42227
|
const ctx = context.ctx;
|
|
42232
42228
|
ctx.save();
|
|
42233
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.
|
|
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,12 +42066,16 @@ 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
|
-
|
|
42075
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
42076
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
42078
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
42077
42079
|
this.image.src = this.signedUrl;
|
|
42078
42080
|
}
|
|
42079
42081
|
getStorageId() {
|
|
@@ -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.
|
|
42086
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
42085
42087
|
this.updateMbr();
|
|
42086
42088
|
this.subject.publish(this);
|
|
42087
42089
|
this.shootLoadCallbacks();
|
|
@@ -42092,11 +42094,12 @@ class ImageItem extends BaseItem {
|
|
|
42092
42094
|
this.subject.publish(this);
|
|
42093
42095
|
this.shootLoadCallbacks();
|
|
42094
42096
|
};
|
|
42095
|
-
onError = (
|
|
42096
|
-
this.
|
|
42097
|
+
onError = () => {
|
|
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.
|
|
42175
|
+
this.onLoad();
|
|
42173
42176
|
};
|
|
42174
42177
|
if (data.storageLink) {
|
|
42175
42178
|
this.setStorageLink(data.storageLink);
|
|
@@ -42177,13 +42180,7 @@ class ImageItem extends BaseItem {
|
|
|
42177
42180
|
if (this.image.src) {
|
|
42178
42181
|
return this;
|
|
42179
42182
|
}
|
|
42180
|
-
this.
|
|
42181
|
-
const storageImage = new Image;
|
|
42182
|
-
storageImage.onload = () => {
|
|
42183
|
-
this.image = storageImage;
|
|
42184
|
-
this.onLoad();
|
|
42185
|
-
};
|
|
42186
|
-
storageImage.onerror = this.onError;
|
|
42183
|
+
this.onError();
|
|
42187
42184
|
return this;
|
|
42188
42185
|
}
|
|
42189
42186
|
emit(operation) {
|
|
@@ -42220,7 +42217,6 @@ class ImageItem extends BaseItem {
|
|
|
42220
42217
|
if (this.transformationRenderBlock) {
|
|
42221
42218
|
return;
|
|
42222
42219
|
}
|
|
42223
|
-
console.log(this);
|
|
42224
42220
|
const ctx = context.ctx;
|
|
42225
42221
|
ctx.save();
|
|
42226
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.
|
|
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,12 +44534,16 @@ 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
|
-
|
|
44543
|
-
console.log("accessToken", this.board.getAccount()?.accessToken());
|
|
44544
|
-
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
|
|
44546
|
+
this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken || null) || "";
|
|
44545
44547
|
this.image.src = this.signedUrl;
|
|
44546
44548
|
}
|
|
44547
44549
|
getStorageId() {
|
|
@@ -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.
|
|
44554
|
+
this.setImage(getPlaceholderImage(this.board, this.imageDimension));
|
|
44553
44555
|
this.updateMbr();
|
|
44554
44556
|
this.subject.publish(this);
|
|
44555
44557
|
this.shootLoadCallbacks();
|
|
@@ -44560,11 +44562,12 @@ class ImageItem extends BaseItem {
|
|
|
44560
44562
|
this.subject.publish(this);
|
|
44561
44563
|
this.shootLoadCallbacks();
|
|
44562
44564
|
};
|
|
44563
|
-
onError = (
|
|
44564
|
-
this.
|
|
44565
|
+
onError = () => {
|
|
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.
|
|
44643
|
+
this.onLoad();
|
|
44641
44644
|
};
|
|
44642
44645
|
if (data.storageLink) {
|
|
44643
44646
|
this.setStorageLink(data.storageLink);
|
|
@@ -44645,13 +44648,7 @@ class ImageItem extends BaseItem {
|
|
|
44645
44648
|
if (this.image.src) {
|
|
44646
44649
|
return this;
|
|
44647
44650
|
}
|
|
44648
|
-
this.
|
|
44649
|
-
const storageImage = new Image;
|
|
44650
|
-
storageImage.onload = () => {
|
|
44651
|
-
this.image = storageImage;
|
|
44652
|
-
this.onLoad();
|
|
44653
|
-
};
|
|
44654
|
-
storageImage.onerror = this.onError;
|
|
44651
|
+
this.onError();
|
|
44655
44652
|
return this;
|
|
44656
44653
|
}
|
|
44657
44654
|
emit(operation) {
|
|
@@ -44688,7 +44685,6 @@ class ImageItem extends BaseItem {
|
|
|
44688
44685
|
if (this.transformationRenderBlock) {
|
|
44689
44686
|
return;
|
|
44690
44687
|
}
|
|
44691
|
-
console.log(this);
|
|
44692
44688
|
const ctx = context.ctx;
|
|
44693
44689
|
ctx.save();
|
|
44694
44690
|
this.transformation.matrix.applyToContext(ctx);
|
|
@@ -43,11 +43,12 @@ 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;
|
|
49
50
|
onLoad: () => Promise<void>;
|
|
50
|
-
onError: (
|
|
51
|
+
onError: () => void;
|
|
51
52
|
onTransform: () => void;
|
|
52
53
|
updateMbr(): void;
|
|
53
54
|
doOnceBeforeOnLoad: (callback: (image: ImageItem) => void) => void;
|