pxt-core 9.3.7 → 9.3.8
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/built/pxtblockly.js +29 -4
- package/built/pxtblocks.d.ts +1 -0
- package/built/pxtblocks.js +29 -4
- package/built/target.js +1 -1
- package/built/web/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtembed.js +1 -1
- package/package.json +1 -1
package/built/pxtblockly.js
CHANGED
|
@@ -16327,12 +16327,21 @@ var pxtblockly;
|
|
|
16327
16327
|
return project.lookupAsset("image" /* pxt.AssetType.Image */, this.getBlockData());
|
|
16328
16328
|
}
|
|
16329
16329
|
const bmp = text ? pxt.sprite.imageLiteralToBitmap(text) : new pxt.sprite.Bitmap(this.params.initWidth, this.params.initHeight);
|
|
16330
|
+
let data;
|
|
16330
16331
|
if (!bmp) {
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16332
|
+
// check for qualified name
|
|
16333
|
+
data = qNameToBitmapData(text);
|
|
16334
|
+
if (!data) {
|
|
16335
|
+
this.isGreyBlock = true;
|
|
16336
|
+
this.valueText = text;
|
|
16337
|
+
return undefined;
|
|
16338
|
+
}
|
|
16339
|
+
else {
|
|
16340
|
+
this.qName = text;
|
|
16341
|
+
}
|
|
16334
16342
|
}
|
|
16335
|
-
|
|
16343
|
+
if (!data)
|
|
16344
|
+
data = bmp.data();
|
|
16336
16345
|
const newAsset = {
|
|
16337
16346
|
internalID: -1,
|
|
16338
16347
|
id: this.sourceBlock_.id,
|
|
@@ -16347,6 +16356,13 @@ var pxtblockly;
|
|
|
16347
16356
|
if (this.asset && !this.isTemporaryAsset()) {
|
|
16348
16357
|
return pxt.getTSReferenceForAsset(this.asset);
|
|
16349
16358
|
}
|
|
16359
|
+
else if (this.qName) {
|
|
16360
|
+
// check if image has been edited
|
|
16361
|
+
const data = qNameToBitmapData(this.qName);
|
|
16362
|
+
if (data && pxt.sprite.bitmapEquals(data, this.asset.bitmap)) {
|
|
16363
|
+
return this.qName;
|
|
16364
|
+
}
|
|
16365
|
+
}
|
|
16350
16366
|
return pxt.sprite.bitmapToImageLiteral(this.asset && pxt.sprite.Bitmap.fromData(this.asset.bitmap), "typescript" /* pxt.editor.FileType.TypeScript */);
|
|
16351
16367
|
}
|
|
16352
16368
|
parseFieldOptions(opts) {
|
|
@@ -16411,6 +16427,15 @@ var pxtblockly;
|
|
|
16411
16427
|
return res;
|
|
16412
16428
|
}
|
|
16413
16429
|
}
|
|
16430
|
+
function qNameToBitmapData(qName) {
|
|
16431
|
+
const project = pxt.react.getTilemapProject();
|
|
16432
|
+
const images = project.getGalleryAssets("image" /* pxt.AssetType.Image */).filter(asset => asset.id === qName);
|
|
16433
|
+
const img = images.length && images[0];
|
|
16434
|
+
if (img) {
|
|
16435
|
+
return img.bitmap;
|
|
16436
|
+
}
|
|
16437
|
+
return undefined;
|
|
16438
|
+
}
|
|
16414
16439
|
})(pxtblockly || (pxtblockly = {}));
|
|
16415
16440
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
16416
16441
|
var pxtblockly;
|
package/built/pxtblocks.d.ts
CHANGED
|
@@ -448,6 +448,7 @@ declare namespace pxtblockly {
|
|
|
448
448
|
protected undoRedoState: any;
|
|
449
449
|
protected pendingEdit: boolean;
|
|
450
450
|
protected isEmpty: boolean;
|
|
451
|
+
protected qName?: string;
|
|
451
452
|
isGreyBlock: boolean;
|
|
452
453
|
constructor(text: string, params: any, validator?: Function);
|
|
453
454
|
protected abstract getAssetType(): pxt.AssetType;
|
package/built/pxtblocks.js
CHANGED
|
@@ -12765,12 +12765,21 @@ var pxtblockly;
|
|
|
12765
12765
|
return project.lookupAsset("image" /* pxt.AssetType.Image */, this.getBlockData());
|
|
12766
12766
|
}
|
|
12767
12767
|
const bmp = text ? pxt.sprite.imageLiteralToBitmap(text) : new pxt.sprite.Bitmap(this.params.initWidth, this.params.initHeight);
|
|
12768
|
+
let data;
|
|
12768
12769
|
if (!bmp) {
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12770
|
+
// check for qualified name
|
|
12771
|
+
data = qNameToBitmapData(text);
|
|
12772
|
+
if (!data) {
|
|
12773
|
+
this.isGreyBlock = true;
|
|
12774
|
+
this.valueText = text;
|
|
12775
|
+
return undefined;
|
|
12776
|
+
}
|
|
12777
|
+
else {
|
|
12778
|
+
this.qName = text;
|
|
12779
|
+
}
|
|
12772
12780
|
}
|
|
12773
|
-
|
|
12781
|
+
if (!data)
|
|
12782
|
+
data = bmp.data();
|
|
12774
12783
|
const newAsset = {
|
|
12775
12784
|
internalID: -1,
|
|
12776
12785
|
id: this.sourceBlock_.id,
|
|
@@ -12785,6 +12794,13 @@ var pxtblockly;
|
|
|
12785
12794
|
if (this.asset && !this.isTemporaryAsset()) {
|
|
12786
12795
|
return pxt.getTSReferenceForAsset(this.asset);
|
|
12787
12796
|
}
|
|
12797
|
+
else if (this.qName) {
|
|
12798
|
+
// check if image has been edited
|
|
12799
|
+
const data = qNameToBitmapData(this.qName);
|
|
12800
|
+
if (data && pxt.sprite.bitmapEquals(data, this.asset.bitmap)) {
|
|
12801
|
+
return this.qName;
|
|
12802
|
+
}
|
|
12803
|
+
}
|
|
12788
12804
|
return pxt.sprite.bitmapToImageLiteral(this.asset && pxt.sprite.Bitmap.fromData(this.asset.bitmap), "typescript" /* pxt.editor.FileType.TypeScript */);
|
|
12789
12805
|
}
|
|
12790
12806
|
parseFieldOptions(opts) {
|
|
@@ -12849,6 +12865,15 @@ var pxtblockly;
|
|
|
12849
12865
|
return res;
|
|
12850
12866
|
}
|
|
12851
12867
|
}
|
|
12868
|
+
function qNameToBitmapData(qName) {
|
|
12869
|
+
const project = pxt.react.getTilemapProject();
|
|
12870
|
+
const images = project.getGalleryAssets("image" /* pxt.AssetType.Image */).filter(asset => asset.id === qName);
|
|
12871
|
+
const img = images.length && images[0];
|
|
12872
|
+
if (img) {
|
|
12873
|
+
return img.bitmap;
|
|
12874
|
+
}
|
|
12875
|
+
return undefined;
|
|
12876
|
+
}
|
|
12852
12877
|
})(pxtblockly || (pxtblockly = {}));
|
|
12853
12878
|
/// <reference path="../../localtypings/pxtblockly.d.ts" />
|
|
12854
12879
|
var pxtblockly;
|