renamed "embeddedCode" property of costumes to "embeddedData"

snap8
Jens Mönig 2022-04-25 14:19:31 +02:00
rodzic 73fd4b995a
commit 7d021ad252
6 zmienionych plików z 38 dodań i 33 usunięć

Wyświetl plik

@ -43,6 +43,9 @@
* **Translation Updates:**
* German
### 2022-04-25
* morphic, gui, objects, extensions: renamed "embeddedCode" property of costumes to "embeddedData"
### 2022-04-24
* morphic: fixed an encoding bug for embedding blocks in PNG metadata

Wyświetl plik

@ -13,14 +13,14 @@
<meta name="apple-mobile-web-app-title" content="Snap!">
<meta name="msapplication-TileImage" content="img/snap-icon-144.png">
<meta name="msapplication-TileColor" content="#FFFFFF">
<script src="src/morphic.js?version=2022-04-24"></script>
<script src="src/morphic.js?version=2022-04-25"></script>
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2022-04-22"></script>
<script src="src/threads.js?version=2022-04-20"></script>
<script src="src/objects.js?version=2022-04-22"></script>
<script src="src/objects.js?version=2022-04-25"></script>
<script src="src/scenes.js?version=2022-03-03"></script>
<script src="src/gui.js?version=2022-04-22"></script>
<script src="src/gui.js?version=2022-04-25"></script>
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2022-02-07"></script>
<script src="src/byob.js?version=2022-04-20"></script>
@ -28,7 +28,7 @@
<script src="src/sketch.js?version=2021-11-03"></script>
<script src="src/video.js?version=2019-06-27"></script>
<script src="src/maps.js?version=2021-06-15"></script>
<script src="src/extensions.js?version=2022-04-07"></script>
<script src="src/extensions.js?version=2022-04-25"></script>
<script src="src/xml.js?version=2021-07-05"></script>
<script src="src/store.js?version=2022-04-05"></script>
<script src="src/locale.js?version=2022-08-08"></script>

Wyświetl plik

@ -34,7 +34,7 @@ SVG_Costume*/
/*jshint esversion: 11, bitwise: false*/
modules.extensions = '2022-April-20';
modules.extensions = '2022-April-25';
// Global stuff
@ -673,15 +673,15 @@ SnapExtensions.primitives.set(
SnapExtensions.primitives.set(
// experimental, will probably be taken out again, don't rely on this
'cst_code(cst, code)',
function (cst, code, proc) {
'cst_embed(cst, data)',
function (cst, data, proc) {
var ide = this.parentThatIsA(IDE_Morph);
proc.assertType(cst, 'costume');
proc.assertType(code, 'text');
proc.assertType(data, 'text');
if (cst instanceof SVG_Costume) {
throw new Error('option currently not supported for SVG costumes');
}
cst.code = code || null;
cst.embeddedData = data || null;
cst.version = Date.now();
ide.recordUnsavedChanges();
}

Wyświetl plik

@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2022-April-22';
modules.gui = '2022-April-25';
// Declarations
@ -2471,7 +2471,7 @@ IDE_Morph.prototype.endBulkDrop = function () {
this.bulkDropInProgress = false;
};
IDE_Morph.prototype.droppedImage = function (aCanvas, name, embeddedCode) {
IDE_Morph.prototype.droppedImage = function (aCanvas, name, embeddedData) {
var costume = new Costume(
aCanvas,
this.currentSprite.newCostumeName(
@ -2491,7 +2491,7 @@ IDE_Morph.prototype.droppedImage = function (aCanvas, name, embeddedCode) {
return;
}
costume.code = embeddedCode || null;
costume.embeddedData = embeddedData || null;
this.currentSprite.addCostume(costume);
this.currentSprite.wearCostume(costume);
this.spriteBar.tabBar.tabTo('costumes');
@ -9923,7 +9923,7 @@ CostumeIconMorph.prototype.createThumbnail = function () {
var watermark, txt;
SpriteIconMorph.prototype.createThumbnail.call(this);
watermark = this.object instanceof SVG_Costume ? 'svg'
: (this.object.code ? '</>' : null);
: (this.object.embeddedData ? '</>' : null);
if (watermark) {
txt = new StringMorph(
watermark,
@ -9973,8 +9973,8 @@ CostumeIconMorph.prototype.userMenu = function () {
menu.addItem("duplicate", "duplicateCostume");
menu.addItem("delete", "removeCostume");
menu.addLine();
if (this.object.code) {
menu.addItem("get blocks", "importCode");
if (this.object.embeddedData) {
menu.addItem("get blocks", "importEmbeddedData");
}
menu.addItem("export", "exportCostume");
return menu;
@ -10055,8 +10055,8 @@ CostumeIconMorph.prototype.removeCostume = function () {
}
};
CostumeIconMorph.prototype.importCode = function () {
this.parentThatIsA(IDE_Morph).droppedText(this.object.code);
CostumeIconMorph.prototype.importEmbeddedData = function () {
this.parentThatIsA(IDE_Morph).droppedText(this.object.embeddedData);
};
CostumeIconMorph.prototype.exportCostume = function () {
@ -10064,8 +10064,8 @@ CostumeIconMorph.prototype.exportCostume = function () {
if (this.object instanceof SVG_Costume) {
// don't show SVG costumes in a new tab (shows text)
ide.saveFileAs(this.object.contents.src, 'text/svg', this.object.name);
} else if (this.object.code) {
// embed blocks code inside the PNG image data
} else if (this.object.embeddedData) {
// embed payload data (e.g blocks) inside the PNG image data
ide.saveFileAs(this.object.pngData(), 'image/png', this.object.name);
} else { // rasterized Costume
ide.saveCanvasAs(this.object.contents, this.object.name);

Wyświetl plik

@ -642,7 +642,7 @@
Drops of image elements from outside the world canvas are dispatched as
droppedImage(aCanvas, name, embeddedCode)
droppedImage(aCanvas, name, embeddedData)
droppedSVG(anImage, name)
events to interested Morphs at the mouse pointer. If you want your Morph
@ -664,13 +664,13 @@
SVG.
Note that PNG images provide for embedded text comments, which can be used
to include code inside the image. Such a payload has to be identified by
an agreed-upon marker. The default tag is stored in MorphicPreferences and
can be overriden by apps wishing to make use of this feature. If such an
embedded text-payload is found inside a PNG it is passed as the optional
third "embeddedCode" parameter to the "droppedImage()" event. embedded text
only applies to PNGs. You can embed a string into the PNG metadata of a PNG
by calling
to include code or arbitrary data such as a CSV, JSON or XML file inside
the image. Such a payload has to be identified by an agreed-upon marker.
The default tag is stored in MorphicPreferences and can be overriden by
apps wishing to make use of this feature. If such an embedded text-payload
is found inside a PNG it is passed as the optional third "embeddedData"
parameter to the "droppedImage()" event. embedded text only applies to PNGs.
You can embed a string into the PNG metadata of a PNG by calling
embedMetadataPNG(aCanvas, aString)
@ -1307,7 +1307,7 @@
/*jshint esversion: 11, bitwise: false*/
var morphicVersion = '2022-April-24';
var morphicVersion = '2022-April-25';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = true;
@ -11697,7 +11697,7 @@ HandMorph.prototype.processDrop = function (event) {
onto the world canvas, turn it into an offscreen canvas or audio
element and dispatch the
droppedImage(canvas, name, embeddedCode)
droppedImage(canvas, name, embeddedData)
droppedSVG(image, name)
droppedAudio(audio, name)
droppedText(text, name, type)

Wyświetl plik

@ -94,7 +94,7 @@ embedMetadataPNG*/
/*jshint esversion: 6*/
modules.objects = '2022-April-22';
modules.objects = '2022-April-25';
var SpriteMorph;
var StageMorph;
@ -10404,7 +10404,9 @@ SpriteBubbleMorph.prototype.fixLayout = function () {
/*
I am a picture that's "wearable" by a sprite. My rotationCenter is
relative to my contents position. I can also contain and share code.
relative to my contents position. I can also contain embedded data
(a string), e.g. for sharing a CSV or JSON or serialized blocks,
sprites, scenes in XML format.
*/
// Costume instance creation
@ -10415,7 +10417,7 @@ function Costume(canvas, name, rotationCenter, noFit, maxExtent) {
if (!noFit) {this.shrinkToFit(maxExtent || this.maxExtent()); }
this.name = name || null;
this.rotationCenter = rotationCenter || this.center();
this.code = null; // must be a string or null
this.embeddedData = null; // must be a string or null
this.version = Date.now(); // for observer optimization
this.loaded = null; // for de-serialization only
}
@ -10780,7 +10782,7 @@ Costume.prototype.isTainted = function () {
// Costume storing blocks code in PNG exports
Costume.prototype.pngData = function () {
return embedMetadataPNG(this.contents, this.code);
return embedMetadataPNG(this.contents, this.embeddedData);
};
// SVG_Costume /////////////////////////////////////////////////////////////