import smart pic as costume via "Import..." item in the project menu

snap8
Jens Mönig 2022-07-04 22:44:09 +02:00
rodzic 34fb182ce3
commit e0ac034638
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -58,6 +58,7 @@
### 2022-07-04
* blocks, gui: directly import embedded blocks from a smart pic if the pic is dragged and dropped onto a scripting area or palette - otherwise import the pic as costume (with embedded blocks)
* gui: import smart pic as costume via "Import..." item in the project menu
### 2022-07-01
* extensions: added a slash-suffix to the EDC url allow-list entry

Wyświetl plik

@ -297,6 +297,7 @@ IDE_Morph.prototype.init = function (isAutoFill) {
this.bulkDropInProgress = false; // for handling multiple file-drops
this.cachedSceneFlag = null; // for importing multiple scenes at once
this.isImportingLocalFile = false; // for handling imports of smart pics
// initialize inherited properties:
IDE_Morph.uber.init.call(this);
@ -2465,6 +2466,7 @@ IDE_Morph.prototype.reactToWorldResize = function (rect) {
if (this.filePicker) {
document.body.removeChild(this.filePicker);
this.filePicker = null;
this.isImportingLocalFile = false;
}
};
@ -2502,15 +2504,18 @@ IDE_Morph.prototype.droppedImage = function (aCanvas, name, embeddedData, src) {
// directly import embedded blocks if the image was dropped on
// a scripting area or the palette, otherwise import as costume
// (with embedded data)
if (isString(embeddedData) &&
if (!this.isImportingLocalFile &&
isString(embeddedData) &&
['scripts', 'palette', 'categories'].includes(src) &&
embeddedData[0] === '<' &&
['blocks', 'block', 'script'].some(tag =>
embeddedData.slice(1).startsWith(tag))
) {
this.isImportingLocalFile = false;
return this.droppedText(embeddedData, name, '');
}
this.isImportingLocalFile = false;
costume.embeddedData = embeddedData || null;
this.currentSprite.addCostume(costume);
this.currentSprite.wearCostume(costume);
@ -4578,6 +4583,7 @@ IDE_Morph.prototype.importLocalFile = function () {
if (addingScenes) {
myself.isAddingNextScene = true;
}
myself.isImportingLocalFile = true;
world.hand.processDrop(inp.files);
},
false