kopia lustrzana https://github.com/backface/turtlestitch
import smart pic as costume via "Import..." item in the project menu
rodzic
34fb182ce3
commit
e0ac034638
|
@ -58,6 +58,7 @@
|
||||||
|
|
||||||
### 2022-07-04
|
### 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)
|
* 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
|
### 2022-07-01
|
||||||
* extensions: added a slash-suffix to the EDC url allow-list entry
|
* extensions: added a slash-suffix to the EDC url allow-list entry
|
||||||
|
|
|
@ -297,6 +297,7 @@ IDE_Morph.prototype.init = function (isAutoFill) {
|
||||||
|
|
||||||
this.bulkDropInProgress = false; // for handling multiple file-drops
|
this.bulkDropInProgress = false; // for handling multiple file-drops
|
||||||
this.cachedSceneFlag = null; // for importing multiple scenes at once
|
this.cachedSceneFlag = null; // for importing multiple scenes at once
|
||||||
|
this.isImportingLocalFile = false; // for handling imports of smart pics
|
||||||
|
|
||||||
// initialize inherited properties:
|
// initialize inherited properties:
|
||||||
IDE_Morph.uber.init.call(this);
|
IDE_Morph.uber.init.call(this);
|
||||||
|
@ -2465,6 +2466,7 @@ IDE_Morph.prototype.reactToWorldResize = function (rect) {
|
||||||
if (this.filePicker) {
|
if (this.filePicker) {
|
||||||
document.body.removeChild(this.filePicker);
|
document.body.removeChild(this.filePicker);
|
||||||
this.filePicker = null;
|
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
|
// directly import embedded blocks if the image was dropped on
|
||||||
// a scripting area or the palette, otherwise import as costume
|
// a scripting area or the palette, otherwise import as costume
|
||||||
// (with embedded data)
|
// (with embedded data)
|
||||||
if (isString(embeddedData) &&
|
if (!this.isImportingLocalFile &&
|
||||||
|
isString(embeddedData) &&
|
||||||
['scripts', 'palette', 'categories'].includes(src) &&
|
['scripts', 'palette', 'categories'].includes(src) &&
|
||||||
embeddedData[0] === '<' &&
|
embeddedData[0] === '<' &&
|
||||||
['blocks', 'block', 'script'].some(tag =>
|
['blocks', 'block', 'script'].some(tag =>
|
||||||
embeddedData.slice(1).startsWith(tag))
|
embeddedData.slice(1).startsWith(tag))
|
||||||
) {
|
) {
|
||||||
|
this.isImportingLocalFile = false;
|
||||||
return this.droppedText(embeddedData, name, '');
|
return this.droppedText(embeddedData, name, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isImportingLocalFile = false;
|
||||||
costume.embeddedData = embeddedData || null;
|
costume.embeddedData = embeddedData || null;
|
||||||
this.currentSprite.addCostume(costume);
|
this.currentSprite.addCostume(costume);
|
||||||
this.currentSprite.wearCostume(costume);
|
this.currentSprite.wearCostume(costume);
|
||||||
|
@ -4578,6 +4583,7 @@ IDE_Morph.prototype.importLocalFile = function () {
|
||||||
if (addingScenes) {
|
if (addingScenes) {
|
||||||
myself.isAddingNextScene = true;
|
myself.isAddingNextScene = true;
|
||||||
}
|
}
|
||||||
|
myself.isImportingLocalFile = true;
|
||||||
world.hand.processDrop(inp.files);
|
world.hand.processDrop(inp.files);
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
|
Ładowanie…
Reference in New Issue