summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-06-06 11:45:41 +0200
committerjmoenig <jens@moenig.org>2014-06-06 11:45:41 +0200
commit9bbe9b2e0af9afd5d94d65d0f7399126c235384b (patch)
treeeb7935a232135d60d67d37c36194a4d7be3c29ec
parent3f04b5b474d5b189182b90246280d25c4e858693 (diff)
downloadsnap-byow-9bbe9b2e0af9afd5d94d65d0f7399126c235384b.tar.gz
snap-byow-9bbe9b2e0af9afd5d94d65d0f7399126c235384b.zip
enable relabelling blocks with C-Slots
-rw-r--r--blocks.js12
-rwxr-xr-xhistory.txt1
-rw-r--r--objects.js4
3 files changed, 15 insertions, 2 deletions
diff --git a/blocks.js b/blocks.js
index b2955e9..4890fa1 100644
--- a/blocks.js
+++ b/blocks.js
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2014-June-04';
+modules.blocks = '2014-June-06';
var SyntaxElementMorph;
@@ -2295,6 +2295,7 @@ BlockMorph.prototype.restoreInputs = function (oldInputs) {
// try to restore my previous inputs when my spec has been changed
var i = 0,
old,
+ nb,
myself = this;
this.inputs().forEach(function (inp) {
@@ -2305,7 +2306,14 @@ BlockMorph.prototype.restoreInputs = function (oldInputs) {
// original - turns empty numberslots to 0:
// inp.setContents(old.evaluate());
// "fix" may be wrong b/c constants
- inp.setContents(old.contents().text);
+ if (old.contents) {
+ inp.setContents(old.contents().text);
+ }
+ } else if (old instanceof CSlotMorph && inp instanceof CSlotMorph) {
+ nb = old.nestedBlock();
+ if (nb) {
+ inp.nestedBlock(nb.fullCopy());
+ }
}
i += 1;
});
diff --git a/history.txt b/history.txt
index 127e01b..9a1ec59 100755
--- a/history.txt
+++ b/history.txt
@@ -2162,3 +2162,4 @@ ______
* Objects: gracefully hide & show the stage, fixed #281
* Objects: add hide and show blocks to the stage’s “looks” category
* Objects: added more relabelling options to SAY and THINK variants
+* Blocks, objects: enable relabelling blocks with C-Slots
diff --git a/objects.js b/objects.js
index 1d027c2..5aac197 100644
--- a/objects.js
+++ b/objects.js
@@ -1233,6 +1233,10 @@ SpriteMorph.prototype.blockAlternatives = {
receiveClick: ['receiveGo'],
doBroadcast: ['doBroadcastAndWait'],
doBroadcastAndWait: ['doBroadcast'],
+ doIf: ['doIfElse', 'doUntil'],
+ doIfElse: ['doIf', 'doUntil'],
+ doRepeat: ['doUntil'],
+ doUntil: ['doRepeat', 'doIf'],
// sensing:
getLastAnswer: ['getTimer'],