kopia lustrzana https://github.com/backface/turtlestitch
Merge branch 'master' of https://github.com/jmoenig/snap into object-body-snapcloud
commit
26f994f100
20
HISTORY.md
20
HISTORY.md
|
@ -12,6 +12,7 @@
|
|||
* export block definitions from inside the block editor
|
||||
* embed blocks into costume metadata to be shared as image file
|
||||
* exported script pics now always include the actual blocks, which can be extracted from the image inside Snap!
|
||||
* exported scripts (!) pics now also always include either the actual blocks (if it's a single script), the block definition (if it's a block editor), or a sprite-representation of the current object (sprite or stage)
|
||||
* added green flag symbol to "when I receive" dropdown menu, support when clicking the green flag button in the IDE
|
||||
* added "combinations" primitive to the palette
|
||||
* new POSITION primitive reporter in the MOTION category
|
||||
|
@ -60,6 +61,25 @@
|
|||
* updated the API documentation for "setTranslation"
|
||||
* **Translation Updates:**
|
||||
* German
|
||||
* Greek, thank you, HM100!
|
||||
|
||||
### 2022-08-01
|
||||
* blocks, objects, store: include a representation of the stage as sprite in the "scripts pic" export if it is more than a single one
|
||||
* removed some "under construction" markers
|
||||
* new release candidate version
|
||||
* threads: fixed an error display glitch
|
||||
* new release candidate version
|
||||
|
||||
### 2022-07-31
|
||||
* threads: fixed #3085 (I hope ^^)
|
||||
* byob: fixed #3088 (I hope ^^)
|
||||
* blocks: include the (whole) current sprite in the "scripts pic" export if it is more than a single one
|
||||
* gui: support directly importing an embedded sprite inside a smart costume
|
||||
|
||||
### 2022-07-30
|
||||
* Greek translation update, thank you, HM100!!
|
||||
* blocks: include custom block definition in the "scripts pic" of the block editor
|
||||
* blocks: include script xml (blocks) in the "scripts pic" export if it is a single one
|
||||
|
||||
### 2022-07-23
|
||||
* throttle framerate to < 67 fps
|
||||
|
|
|
@ -216,7 +216,7 @@ SnapExtensions.primitives.set(
|
|||
// if (aTopic !== topic) { return; }
|
||||
if (!mqttWildcard(aTopic, topic)) {return;}
|
||||
let p = new Process();
|
||||
console.log(payload);
|
||||
|
||||
newPayload = payload.reduce( (res, val) => res+String.fromCharCode( val), "")
|
||||
try {
|
||||
p.initializeFor(callback, new List([newPayload, aTopic]));
|
||||
|
|
|
@ -185,7 +185,7 @@ SnapTranslator.dict.el = {
|
|||
'translator_e-mail':
|
||||
'ino.samaras@berkeley.edu, aprekates@sch.gr' , // optional
|
||||
'last_changed':
|
||||
'2020-10-09', // this, too, will appear in the Translators tab
|
||||
'2022-07-30', // this, too, will appear in the Translators tab
|
||||
|
||||
// GUI
|
||||
// control bar:
|
||||
|
@ -534,6 +534,8 @@ SnapTranslator.dict.el = {
|
|||
'στείλε το %msg %receive και περίμενε',
|
||||
'to':
|
||||
'στο',
|
||||
'with data':
|
||||
'με δεδομένα',
|
||||
'send %msg to %spr':
|
||||
'αποστολή του %msg στο %spr',
|
||||
'Message name':
|
||||
|
@ -566,6 +568,8 @@ SnapTranslator.dict.el = {
|
|||
'σταμάτα %stopChoices',
|
||||
'all':
|
||||
'τα πάντα',
|
||||
'all scenes':
|
||||
'όλες τις σκηνές',
|
||||
'this script':
|
||||
'αυτό το σενάριο',
|
||||
'this block':
|
||||
|
@ -600,6 +604,14 @@ SnapTranslator.dict.el = {
|
|||
'ο εαυτός μου',
|
||||
'delete this clone':
|
||||
'κατάργησε αυτόν τον κλόνο',
|
||||
'switch to scene %scn %send':
|
||||
'αλλαγή στην σκηνή %scn %send',
|
||||
'and send':
|
||||
'και στείλε',
|
||||
'next':
|
||||
'επόμενη',
|
||||
'previous':
|
||||
'προηγούμενη',
|
||||
'tell %spr to %cmdRing %inputs':
|
||||
'πες το %spr να %cmdRing %inputs',
|
||||
'ask %spr for %repRing %inputs':
|
||||
|
@ -618,6 +630,8 @@ SnapTranslator.dict.el = {
|
|||
'Ποιο είναι το όνομά σου;',
|
||||
'answer':
|
||||
'απάντηση',
|
||||
'mouse position':
|
||||
'θέση ποντικιού',
|
||||
'mouse x':
|
||||
'ποντίκι x-θέση',
|
||||
'mouse y':
|
||||
|
@ -708,6 +722,38 @@ SnapTranslator.dict.el = {
|
|||
'κατοπτρισμός βίντεο',
|
||||
'turbo mode':
|
||||
'λειτουργεία τούρμπο',
|
||||
'%block of block %repRing':
|
||||
'%block του μπλοκ %repRing',
|
||||
'label':
|
||||
'ετικέτα',
|
||||
'definition':
|
||||
'ορισμός',
|
||||
'category':
|
||||
'κατηγορία',
|
||||
'custom?':
|
||||
'προσαρμοσμένο?',
|
||||
'global?':
|
||||
'καθολικό?',
|
||||
'type':
|
||||
'τύπος',
|
||||
'scope':
|
||||
'έκταση',
|
||||
'slots':
|
||||
'θέσεις',
|
||||
'defaults':
|
||||
'προεπιλογές',
|
||||
'menus':
|
||||
'μενού',
|
||||
'editables':
|
||||
'επεξεργάσιμα',
|
||||
'set %byob of block %repRing to %s':
|
||||
'θέσε %byob της εντολής %repRing σε %s',
|
||||
'define %upvar %s %repRing':
|
||||
'ορισμός %upvar %s %repRing',
|
||||
'delete block %repRing':
|
||||
'διαγραφή μπλοκ %repRing',
|
||||
'block':
|
||||
'μπλοκ',
|
||||
|
||||
// operators:
|
||||
'%n mod %n':
|
||||
|
@ -782,12 +828,28 @@ SnapTranslator.dict.el = {
|
|||
// lists:
|
||||
'list %exp':
|
||||
'λίστα %exp',
|
||||
'numbers from %n to %n':
|
||||
'νούμερα από το %n εως το %n',
|
||||
'%s in front of %l':
|
||||
'%s μπροστά από το %l',
|
||||
'item %idx of %l':
|
||||
'στοιχείο %idx του %l',
|
||||
'all but first of %l':
|
||||
'όλα εκτός από το πρώτο του %l',
|
||||
'%la of %l':
|
||||
'%la του %l',
|
||||
'rank':
|
||||
'κατάταξη',
|
||||
'dimensions':
|
||||
'διαστάσεις',
|
||||
'flatten':
|
||||
'ισοπέδωση',
|
||||
'columns':
|
||||
'στείλες',
|
||||
'reverse':
|
||||
'αναστροφή',
|
||||
'lines':
|
||||
'γραμμές',
|
||||
'length of %l':
|
||||
'μήκος του %l',
|
||||
'%l contains %s':
|
||||
|
@ -824,6 +886,10 @@ SnapTranslator.dict.el = {
|
|||
'εύρος',
|
||||
'append %lists':
|
||||
'προσάρτηση %lists',
|
||||
'combinations %lists':
|
||||
'συνδιασμοί %lists',
|
||||
'reshape %l to %nums':
|
||||
'ανασχημάτιση του %l σε %nums',
|
||||
'add %s to %l':
|
||||
'πρόσθεσε το %s στο %l',
|
||||
'delete %ida of %l':
|
||||
|
@ -891,6 +957,18 @@ SnapTranslator.dict.el = {
|
|||
'Αχρησιμοποίητα μπλοκ...',
|
||||
'find unused global custom blocks\nand remove their definitions':
|
||||
'βρείτε αχρησιμοποίητα καθολικά μπλοκ\nκαι αφαίρεσε τους ορισμούς τους',
|
||||
'Hide blocks...':
|
||||
'Απόκρυψη μπλοκ...',
|
||||
'New category...':
|
||||
'Νέα κατηγορία...',
|
||||
'Remove a category...':
|
||||
'Διαγραφή κατηγορίας...',
|
||||
'Scenes...':
|
||||
'Σκηνές...',
|
||||
'New scene':
|
||||
'Νέα σκηνή',
|
||||
'Add scene...':
|
||||
'Προσθήκη σκηνής...',
|
||||
'Import tools':
|
||||
'Εισαγωγή εργαλείων',
|
||||
'load the official library of\npowerful blocks':
|
||||
|
@ -948,6 +1026,8 @@ SnapTranslator.dict.el = {
|
|||
'Ύψος σκηνής',
|
||||
'Default':
|
||||
'Προεπιλογή',
|
||||
'JavaScript extensions':
|
||||
'Επεκτάσεις JavaScript',
|
||||
'Blurred shadows':
|
||||
'Θολές σκιές',
|
||||
'uncheck to use solid drop\nshadows and highlights':
|
||||
|
@ -1006,6 +1086,8 @@ SnapTranslator.dict.el = {
|
|||
'ενεργοποιήστε για να βάλετε σε\nπροτεραιότητα την εκτέλεση του κώδικα',
|
||||
'uncheck to run scripts\nat normal speed':
|
||||
'απενεργοποιήστε για να εκτελέσετε τον κώδικα\nμε κανονική ταχύτητα',
|
||||
'Flat design':
|
||||
'Επίπεδη σχεδίαση',
|
||||
'check for alternative\nGUI design':
|
||||
'ενεργοποιήστε για εναλακτική\nσχεδίαση GUI',
|
||||
'uncheck for default\nGUI design':
|
||||
|
@ -1030,6 +1112,26 @@ SnapTranslator.dict.el = {
|
|||
'Γραμμές πίνακα',
|
||||
'Visible stepping':
|
||||
'Ορατός βηματισμός',
|
||||
'Single palette':
|
||||
'Μονή παλέτα',
|
||||
'check to show all blocks in a single palette':
|
||||
'ενεργοποιήστε για να εμφανίσετε όλα τα μπλοκ σε μονή παλέτα',
|
||||
'uncheck to show only the selected category\'s blocks':
|
||||
'απενεργοποιήστε για να εμφανίσετε μόνο τα μπλοκ τις επιλεγμένης κατηγορίας',
|
||||
'Show categories':
|
||||
'Εμφάνιση κατηγοριών',
|
||||
'uncheck to hide\ncategory names\nin the palette':
|
||||
'απενεργοποιήστε για να κρύψετε\nτα ονόματα κατηγοριών\nστην παλέτα',
|
||||
'check to show\ncategory names\nin the palette':
|
||||
'ενεργοποιήστε για να εμφανίσετε\nτα ονόματα κατηγοριών\nστην παλέτα',
|
||||
'Show buttons':
|
||||
'Εμφάνιση κουμιών',
|
||||
'uncheck to hide buttons\nin the palette':
|
||||
'απενεργοποιήστε για να κρύψετε τα κουμιά\nστην παλέτα',
|
||||
'check to show buttons\nin the palette':
|
||||
'ενεργοποιήστε για να εμφανίσετε τα κουμιά\nστην παλέτα',
|
||||
'HSL pen color model':
|
||||
'Χρωματικό μοντέλο στυλού HSL',
|
||||
|
||||
|
||||
// inputs
|
||||
|
@ -1049,6 +1151,28 @@ SnapTranslator.dict.el = {
|
|||
// palette:
|
||||
'find blocks':
|
||||
'εύρεση μπλοκ',
|
||||
'hide blocks...':
|
||||
'απόκρυψη μπλοκ...',
|
||||
'Hide blocks in palette':
|
||||
'Απόκρυψη μπλοκ στην παλέτα',
|
||||
'unused':
|
||||
'αχρησιμοποίητα',
|
||||
'make a category...':
|
||||
'δημιουργία μιας κατηγορίας...',
|
||||
'New Category':
|
||||
'Νέα κατηγορία',
|
||||
'Blocks category name:':
|
||||
'Όνομα κατηγορίας μπλοκ:',
|
||||
'Category color':
|
||||
'Χρώμα κατηγορίας',
|
||||
'red':
|
||||
'κόκκινο',
|
||||
'green':
|
||||
'πράσινο',
|
||||
'blue':
|
||||
'μπλε',
|
||||
'delete a category...':
|
||||
'διαγραφή μιας κατηγορίας...',
|
||||
'hide primitives':
|
||||
'Απόκρυψη αρχέτυπων',
|
||||
'show primitives':
|
||||
|
@ -1059,6 +1183,10 @@ SnapTranslator.dict.el = {
|
|||
'βοήθεια...',
|
||||
'relabel...':
|
||||
'μετονόμαση...',
|
||||
'compile':
|
||||
'μεταγλώτηση',
|
||||
'uncompile':
|
||||
'ξε-μεταγλώτηση',
|
||||
'duplicate':
|
||||
'διπλασίαση',
|
||||
'make a copy\nand pick it up':
|
||||
|
@ -1095,6 +1223,12 @@ SnapTranslator.dict.el = {
|
|||
'εξαγωγή του προσαρμοσμένου μπλοκ',
|
||||
'edit...':
|
||||
'επεξεργασία...',
|
||||
'translations...':
|
||||
'μεταφράσεις...',
|
||||
'block variables...':
|
||||
'μεταβλητές μπλοκ...',
|
||||
'in palette':
|
||||
'στην παλέτα',
|
||||
|
||||
// sprites:
|
||||
'edit':
|
||||
|
@ -1497,6 +1631,8 @@ SnapTranslator.dict.el = {
|
|||
// coments
|
||||
'add comment here...':
|
||||
'πρόσθεσε κάποιο σχόλιο εδώ...',
|
||||
'comment pic...':
|
||||
'εικόνα σχόλιου...',
|
||||
'save a picture\nof this comment':
|
||||
'αππθήκευση εικόνας\nαυτού του σχόλιου',
|
||||
|
||||
|
@ -1510,6 +1646,10 @@ SnapTranslator.dict.el = {
|
|||
'(0) πάνω',
|
||||
'(180) down':
|
||||
'(180) κάτω',
|
||||
'random':
|
||||
'τυχαία',
|
||||
'random position':
|
||||
'τυχαία θέση',
|
||||
|
||||
// collision detection
|
||||
'mouse-pointer':
|
||||
|
@ -1526,6 +1666,8 @@ SnapTranslator.dict.el = {
|
|||
'Χελώνα',
|
||||
'Empty':
|
||||
'Άδειο',
|
||||
'Paint a new costume':
|
||||
'Σχεδίαση νέου κοστουμιού',
|
||||
'Camera':
|
||||
'Κάμερα',
|
||||
|
||||
|
@ -1763,6 +1905,52 @@ SnapTranslator.dict.el = {
|
|||
'top':
|
||||
'επάνω',
|
||||
'bottom':
|
||||
'κάτω'
|
||||
'κάτω',
|
||||
'position':
|
||||
'θέση',
|
||||
'costume name':
|
||||
'όνομα κοστουμιού',
|
||||
'categories':
|
||||
'κατηγορίες',
|
||||
|
||||
// attributes in the SET block's dropdown
|
||||
'my anchor':
|
||||
'δικό μου άγκυρά',
|
||||
'my parent':
|
||||
'δικό μου γονέας',
|
||||
'my name':
|
||||
'δικό μου ονομά',
|
||||
'my temporary?':
|
||||
'δικό μου προσωρινός;',
|
||||
'my dangling?':
|
||||
'δικό μου κουνιέμαι;',
|
||||
'my draggable?':
|
||||
'δικό μου συρόμενο;',
|
||||
'my rotation style':
|
||||
'δικό μου στύλ περιστροφής',
|
||||
'my rotation x':
|
||||
'δικό μου x-περιστροφή',
|
||||
'my rotation y':
|
||||
'δικό μου y περιστροφή',
|
||||
|
||||
// inheritance
|
||||
'inherited':
|
||||
'κληρονομημένο',
|
||||
'check to inherit\nfrom':
|
||||
'επιλογή για κληρονόμηση\naπό',
|
||||
'uncheck to\ndisinherit':
|
||||
'αποεπιλογή για \nκατάργηση κληρονόμησης',
|
||||
|
||||
// editing slots inside variadic inputs
|
||||
'insert a slot':
|
||||
'εισαγωγή μιας θέσης',
|
||||
'delete slot':
|
||||
'διαγραφή θέσης',
|
||||
'insert a variable':
|
||||
'εισαγωγή μιας θέσης',
|
||||
'delete variable':
|
||||
'διαγραφή μεταβλητής',
|
||||
'variable':
|
||||
'μεταβλητή'
|
||||
|
||||
};
|
||||
|
|
16
snap.html
16
snap.html
|
@ -15,23 +15,23 @@
|
|||
<meta name="msapplication-TileColor" content="#FFFFFF">
|
||||
<script src="src/morphic.js?version=2022-04-26"></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-07-19"></script>
|
||||
<script src="src/threads.js?version=2022-07-19"></script>
|
||||
<script src="src/objects.js?version=2022-07-19"></script>
|
||||
<script src="src/widgets.js?version=2022-08-01"></script>
|
||||
<script src="src/blocks.js?version=2022-08-01"></script>
|
||||
<script src="src/threads.js?version=2022-08-01"></script>
|
||||
<script src="src/objects.js?version=2022-08-01"></script>
|
||||
<script src="src/scenes.js?version=2022-03-03"></script>
|
||||
<script src="src/gui.js?version=2022-07-22"></script>
|
||||
<script src="src/gui.js?version=2022-08-01"></script>
|
||||
<script src="src/paint.js?version=2021-07-05"></script>
|
||||
<script src="src/lists.js?version=2022-07-19"></script>
|
||||
<script src="src/byob.js?version=2022-07-19"></script>
|
||||
<script src="src/byob.js?version=2022-08-01"></script>
|
||||
<script src="src/tables.js?version=2022-01-28"></script>
|
||||
<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-07-11"></script>
|
||||
<script src="src/xml.js?version=2021-07-05"></script>
|
||||
<script src="src/store.js?version=2022-04-26"></script>
|
||||
<script src="src/locale.js?version=2022-07-18"></script>
|
||||
<script src="src/store.js?version=2022-08-01"></script>
|
||||
<script src="src/locale.js?version=2022-07-30"></script>
|
||||
<script src="src/cloud.js?version=2021-02-04"></script>
|
||||
<script src="src/api.js?version=2022-07-19"></script>
|
||||
<script src="src/sha512.js?version=2019-06-27"></script>
|
||||
|
|
|
@ -161,7 +161,7 @@ CostumeIconMorph, SoundIconMorph, SVG_Costume, embedMetadataPNG*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2022-July-19';
|
||||
modules.blocks = '2022-August-01';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
@ -8096,13 +8096,23 @@ ScriptsMorph.prototype.cleanUp = function () {
|
|||
|
||||
ScriptsMorph.prototype.exportScriptsPicture = function () {
|
||||
var pic = this.scriptsPicture(),
|
||||
ide = this.world().children[0];
|
||||
ide = this.world().children[0],
|
||||
xml = this.scriptsXML();
|
||||
if (pic) {
|
||||
ide.saveCanvasAs(
|
||||
pic,
|
||||
(ide.getProjectName() || localize('untitled')) + ' ' +
|
||||
localize('script pic')
|
||||
if (xml) {
|
||||
ide.saveFileAs(
|
||||
embedMetadataPNG(pic, xml),
|
||||
'image/png',
|
||||
(ide.getProjectName() || localize('untitled')) + ' ' +
|
||||
localize('script pic')
|
||||
);
|
||||
} else {
|
||||
ide.saveCanvasAs(
|
||||
pic,
|
||||
(ide.getProjectName() || localize('untitled')) + ' ' +
|
||||
localize('script pic')
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8131,6 +8141,35 @@ ScriptsMorph.prototype.scriptsPicture = function () {
|
|||
return pic;
|
||||
};
|
||||
|
||||
ScriptsMorph.prototype.scriptsXML = function () {
|
||||
// private - answer a container (usually sprite) for all scripts
|
||||
var blockEditor = this.parentThatIsA(BlockEditorMorph),
|
||||
ide = this.world().children[0],
|
||||
scripts = this.children.filter(m => m instanceof BlockMorph),
|
||||
target;
|
||||
if (blockEditor) {
|
||||
return ide.blocksLibraryXML(
|
||||
[blockEditor.definition].concat(
|
||||
blockEditor.definition.collectDependencies(
|
||||
[],
|
||||
[],
|
||||
blockEditor.target
|
||||
)
|
||||
),
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
if (scripts.length === 1) {
|
||||
return scripts[0].toXMLString();
|
||||
}
|
||||
target = this.scriptTarget();
|
||||
if (isSnapObject(target)) {
|
||||
return target.toXMLString();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
ScriptsMorph.prototype.addComment = function () {
|
||||
var ide = this.parentThatIsA(IDE_Morph),
|
||||
blockEditor = this.parentThatIsA(BlockEditorMorph),
|
||||
|
|
58
src/byob.js
58
src/byob.js
|
@ -111,7 +111,7 @@ ArgLabelMorph, embedMetadataPNG*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.byob = '2022-July-19';
|
||||
modules.byob = '2022-August-01';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -586,28 +586,23 @@ CustomBlockDefinition.prototype.setBlockLabel = function (abstractSpec) {
|
|||
// private - only to be called from a Process that also does housekeeping
|
||||
// abstract block specs replace the inputs with underscores,
|
||||
// e.g. "move _ steps", "say _", "_ + _"
|
||||
var count = abstractSpec.split(' ').filter(word => word === '_').length,
|
||||
var parts = abstractSpec.split(' ').filter(each => each.length && each !== ' '),
|
||||
count = parts.filter(each => each === '_').length,
|
||||
inputNames = this.inputNames(),
|
||||
parts = [],
|
||||
spec = abstractSpec;
|
||||
spec = '',
|
||||
idx = 0;
|
||||
|
||||
if (count !== inputNames.length) {
|
||||
throw new Error('expecting the number of inputs to match');
|
||||
}
|
||||
if (spec.startsWith('_ ')) {
|
||||
parts.push('');
|
||||
spec = spec.slice(2);
|
||||
}
|
||||
if (spec.endsWith(' _')) {
|
||||
spec = spec.slice(0, -2);
|
||||
}
|
||||
parts = parts.concat(spec.split(' _ '));
|
||||
spec = '';
|
||||
parts.forEach((part, i) =>
|
||||
spec += (part + (
|
||||
inputNames[i] ? ' %\'' + inputNames[i] + '\' ' : '')
|
||||
)
|
||||
);
|
||||
parts.forEach(part => {
|
||||
if (part === '_') {
|
||||
spec += inputNames[idx] ? '%\'' + inputNames[idx] + '\' ' : '';
|
||||
idx += 1;
|
||||
} else {
|
||||
spec += (part + ' ');
|
||||
}
|
||||
});
|
||||
this.spec = spec.trim();
|
||||
};
|
||||
|
||||
|
@ -617,8 +612,8 @@ CustomBlockDefinition.prototype.setBlockDefinition = function (aContext) {
|
|||
newInputs = aContext.inputs,
|
||||
declarations = this.declarations,
|
||||
parts = [],
|
||||
suffix = [],
|
||||
body = aContext,
|
||||
idx = 0,
|
||||
reportBlock,
|
||||
spec;
|
||||
|
||||
|
@ -628,21 +623,16 @@ CustomBlockDefinition.prototype.setBlockDefinition = function (aContext) {
|
|||
oldInputs = this.inputNames();
|
||||
|
||||
// change the input names in the spec to those of the given context
|
||||
while (spec.startsWith('_ ')) {
|
||||
parts.push('');
|
||||
spec = spec.slice(2);
|
||||
}
|
||||
while (spec.endsWith(' _')) {
|
||||
spec = spec.slice(0, -2);
|
||||
suffix.push('');
|
||||
}
|
||||
parts = parts.concat(spec.split(' _ ')).concat(suffix);
|
||||
parts = spec.split(' ').filter(each => each.length && each !== ' ');
|
||||
spec = '';
|
||||
parts.forEach((part, i) =>
|
||||
spec += (part + (
|
||||
newInputs[i] ? ' %\'' + newInputs[i] + '\' ' : '')
|
||||
)
|
||||
);
|
||||
parts.forEach(part => {
|
||||
if (part === '_') {
|
||||
spec += newInputs[idx] ? '%\'' + newInputs[idx] + '\' ' : '';
|
||||
idx += 1;
|
||||
} else {
|
||||
spec += (part + ' ');
|
||||
}
|
||||
});
|
||||
this.spec = spec.trim();
|
||||
|
||||
// change the input names in the slot declarations to those of the context
|
||||
|
@ -1362,7 +1352,7 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
|
|||
if (this.isPrototype) {
|
||||
menu = new MenuMorph(this);
|
||||
menu.addItem(
|
||||
"script pic...", // +++
|
||||
"script pic...",
|
||||
function () {
|
||||
var ide = this.world().children[0],
|
||||
top = this.topBlock(),
|
||||
|
|
|
@ -86,11 +86,11 @@ BlockVisibilityDialogMorph, ThreadManager, isString*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2022-July-22';
|
||||
modules.gui = '2022-August-01';
|
||||
|
||||
// Declarations
|
||||
|
||||
var SnapVersion = '8.0.0-rc-220722';
|
||||
var SnapVersion = '8.0.0-rc-220801-2';
|
||||
|
||||
var IDE_Morph;
|
||||
var ProjectDialogMorph;
|
||||
|
@ -2508,7 +2508,7 @@ IDE_Morph.prototype.droppedImage = function (aCanvas, name, embeddedData, src) {
|
|||
isString(embeddedData) &&
|
||||
['scripts', 'palette', 'categories'].includes(src) &&
|
||||
embeddedData[0] === '<' &&
|
||||
['blocks', 'block', 'script'].some(tag =>
|
||||
['blocks', 'block', 'script', 'sprite'].some(tag =>
|
||||
embeddedData.slice(1).startsWith(tag))
|
||||
) {
|
||||
this.isImportingLocalFile = false;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
// Global stuff
|
||||
|
||||
modules.locale = '2022-July-18';
|
||||
modules.locale = '2022-July-30';
|
||||
|
||||
var Localizer;
|
||||
var SnapTranslator = new Localizer();
|
||||
|
@ -385,7 +385,7 @@ SnapTranslator.dict.el = {
|
|||
'translator_e-mail':
|
||||
'ino.samaras@berkeley.edu, aprekates@sch.gr',
|
||||
'last_changed':
|
||||
'2020-11-23'
|
||||
'2022-07-30'
|
||||
};
|
||||
|
||||
SnapTranslator.dict.ca = {
|
||||
|
|
|
@ -94,7 +94,7 @@ embedMetadataPNG*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.objects = '2022-July-19';
|
||||
modules.objects = '2022-August-01';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -10231,6 +10231,74 @@ StageMorph.prototype.globalBlocksSending = function (message, receiverName) {
|
|||
return all;
|
||||
};
|
||||
|
||||
// StageMorph serialization & exporting utils
|
||||
|
||||
StageMorph.prototype.toXMLString = function () {
|
||||
// answer an xml string representation of this sprite and all parts
|
||||
// attached to it, including all dependencies (global custom blocks).
|
||||
var ide = this.parentThatIsA(IDE_Morph),
|
||||
dependencies = [],
|
||||
categories = [],
|
||||
blocksXML = '',
|
||||
conversion,
|
||||
xml;
|
||||
|
||||
function collect(item, array) {
|
||||
// only once
|
||||
if (!contains(array, item)) {
|
||||
array.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
function collectAll(items, array) {
|
||||
items.forEach(item => collect(item, array));
|
||||
}
|
||||
|
||||
// collect all dependencies and custom categories.
|
||||
// only collect global custom block dependencies, because the locals
|
||||
// will be included in each sprite's serialization code
|
||||
|
||||
// global block definition in scripts
|
||||
this.scripts.children.filter(
|
||||
morph => morph instanceof BlockMorph
|
||||
).forEach(script =>
|
||||
collectAll(
|
||||
script.dependencies(true),
|
||||
dependencies
|
||||
)
|
||||
);
|
||||
|
||||
// global block definitions referenced in local block definitions
|
||||
this.customBlocks.forEach(def => {
|
||||
collect(def.category, categories);
|
||||
collectAll(
|
||||
def.collectDependencies([], [], this)
|
||||
.filter(each => each.isGlobal),
|
||||
dependencies
|
||||
);
|
||||
});
|
||||
|
||||
// encode both parts of the export-file:
|
||||
// the blocks library and the sprites
|
||||
|
||||
if (dependencies.length || categories.length) {
|
||||
blocksXML = ide.blocksLibraryXML(dependencies, categories);
|
||||
}
|
||||
|
||||
conversion = this.toXML;
|
||||
this.toXML = this.toSpriteXML;
|
||||
xml = '<sprites app="' +
|
||||
ide.serializer.app +
|
||||
'" version="' +
|
||||
ide.serializer.version +
|
||||
'">' +
|
||||
blocksXML +
|
||||
ide.serializer.serialize([this]) +
|
||||
'</sprites>';
|
||||
this.toXML = conversion;
|
||||
return xml;
|
||||
};
|
||||
|
||||
// SpriteBubbleMorph ////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
|
44
src/store.js
44
src/store.js
|
@ -63,7 +63,7 @@ Project*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.store = '2022-April-26';
|
||||
modules.store = '2022-August-01';
|
||||
|
||||
// XML_Serializer ///////////////////////////////////////////////////////
|
||||
/*
|
||||
|
@ -1892,6 +1892,48 @@ StageMorph.prototype.toXML = function (serializer) {
|
|||
);
|
||||
};
|
||||
|
||||
StageMorph.prototype.toSpriteXML = function (serializer) {
|
||||
// special case: export the stage as a sprite, so it can be
|
||||
// imported into another project or scene
|
||||
var costumeIdx = this.getCostumeIdx();
|
||||
|
||||
return serializer.format(
|
||||
'<sprite name="@" idx="1" x="0" y="0"' +
|
||||
' heading="90"' +
|
||||
' scale="1"' +
|
||||
' volume="@"' +
|
||||
' pan="@"' +
|
||||
' rotation="0"' +
|
||||
'%' +
|
||||
' draggable="true"' +
|
||||
' costume="@" color="80,80,80,1" pen="tip" ~>' +
|
||||
'%' + // current costume
|
||||
'<costumes>%</costumes>' +
|
||||
'<sounds>%</sounds>' +
|
||||
'<blocks>%</blocks>' +
|
||||
'<variables>%</variables>' +
|
||||
'<scripts>%</scripts>' +
|
||||
'</sprite>',
|
||||
this.name,
|
||||
this.volume,
|
||||
this.pan,
|
||||
this.instrument ?
|
||||
' instrument="' + parseInt(this.instrument) + '" ' : '',
|
||||
costumeIdx,
|
||||
|
||||
// current costume, if it's not in the wardrobe
|
||||
!costumeIdx && this.costume ?
|
||||
'<wear>' + serializer.store(this.costume) + '</wear>'
|
||||
: '',
|
||||
|
||||
serializer.store(this.costumes, this.name + '_cst'),
|
||||
serializer.store(this.sounds, this.name + '_snd'),
|
||||
!this.customBlocks ? '' : serializer.store(this.customBlocks),
|
||||
serializer.store(this.variables),
|
||||
serializer.store(this.scripts)
|
||||
);
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.toXML = function (serializer) {
|
||||
var idx = serializer.scene.sprites.asArray().indexOf(this) + 1,
|
||||
costumeIdx = this.getCostumeIdx(),
|
||||
|
|
|
@ -65,7 +65,7 @@ StagePickerMorph, CustomBlockDefinition*/
|
|||
|
||||
/*jshint esversion: 11, bitwise: false, evil: true*/
|
||||
|
||||
modules.threads = '2022-July-19';
|
||||
modules.threads = '2022-August-01';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -1242,7 +1242,7 @@ Process.prototype.errorBubble = function (error, element) {
|
|||
if (errorIsNested && error.cause !== 'user') {
|
||||
if (blockToShow.selector === 'reportGetVar') {
|
||||
// if I am a single variable, show my caller in the output.
|
||||
blockToShow = blockToShow.parent;
|
||||
blockToShow = blockToShow.parent || blockToShow;
|
||||
}
|
||||
errorMorph.children[0].text += `\n${localize('The question came up at')}`;
|
||||
errorMorph.children[0].fixLayout();
|
||||
|
@ -1646,7 +1646,8 @@ Process.prototype.evaluateCustomBlock = function () {
|
|||
exit,
|
||||
i,
|
||||
value,
|
||||
outer;
|
||||
outer,
|
||||
self;
|
||||
|
||||
if (!context) {return null; }
|
||||
this.procedureCount += 1;
|
||||
|
@ -1677,6 +1678,10 @@ Process.prototype.evaluateCustomBlock = function () {
|
|||
runnable.isCustomBlock = true;
|
||||
this.context.parentContext = runnable;
|
||||
|
||||
// capture the runtime environment in "this script"
|
||||
self = copy(context);
|
||||
self.outerContext = outer;
|
||||
|
||||
// passing parameters if any were passed
|
||||
if (parms.length > 0) {
|
||||
|
||||
|
@ -1733,7 +1738,7 @@ Process.prototype.evaluateCustomBlock = function () {
|
|||
this.readyToYield = true;
|
||||
}
|
||||
}
|
||||
outer.variables.addVar(Symbol.for('self'), method.body || new Context());
|
||||
outer.variables.addVar(Symbol.for('self'), self);
|
||||
runnable.expression = runnable.expression.blockSequence();
|
||||
};
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ ScrollFrameMorph, MenuItemMorph, useBlurredShadows, getDocumentPositionOf*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.widgets = '2021-November-09';
|
||||
modules.widgets = '2022-August-01';
|
||||
|
||||
var PushButtonMorph;
|
||||
var ToggleButtonMorph;
|
||||
|
@ -1909,7 +1909,7 @@ DialogBoxMorph.prototype.promptRGB = function (
|
|||
rInp = new InputFieldMorph(color.r.toString(), true),
|
||||
gInp = new InputFieldMorph(color.g.toString(), true),
|
||||
bInp = new InputFieldMorph(color.b.toString(), true),
|
||||
rCol = new AlignmentMorph('column', 2),// +++
|
||||
rCol = new AlignmentMorph('column', 2),
|
||||
gCol = new AlignmentMorph('column', 2),
|
||||
bCol = new AlignmentMorph('column', 2),
|
||||
inp = new AlignmentMorph('column', 2),
|
||||
|
@ -1956,7 +1956,7 @@ DialogBoxMorph.prototype.promptRGB = function (
|
|||
gCol.add(labelText('green'));
|
||||
gCol.add(gInp);
|
||||
bCol.add(labelText('blue'));
|
||||
bCol.add(bInp); // +++
|
||||
bCol.add(bInp);
|
||||
clr.add(rCol);
|
||||
clr.add(gCol);
|
||||
clr.add(bCol);
|
||||
|
|
2
sw.js
2
sw.js
|
@ -1,4 +1,4 @@
|
|||
var snapVersion = '8.0.0-rc-220724',
|
||||
var snapVersion = '8.0.0-rc-220801-2',
|
||||
cacheName = 'snap-pwa',
|
||||
filesToCache = [
|
||||
'snap.html',
|
||||
|
|
Ładowanie…
Reference in New Issue