summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2015-03-01 09:51:31 +0100
committerGubolin <gubolin@fantasymail.de>2015-03-01 09:51:31 +0100
commit738392ed38f9a068dfda1aaeded07dfbd08ee134 (patch)
tree698778d69fa8079ae5f9825035a069e5132ba182 /blocks.js
parent1585a1664a9bbdb7c8efa5f3da361b4aaf6450e4 (diff)
parentb1d78532557371dfc740c078c76c13e8e0f66896 (diff)
downloadsnap-738392ed38f9a068dfda1aaeded07dfbd08ee134.tar.gz
snap-738392ed38f9a068dfda1aaeded07dfbd08ee134.zip
Merge branch 'master' into mobileapp
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js43
1 files changed, 38 insertions, 5 deletions
diff --git a/blocks.js b/blocks.js
index e56d0ed..5cdcc1c 100644
--- a/blocks.js
+++ b/blocks.js
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2014-November-21';
+modules.blocks = '2015-February-28';
var SyntaxElementMorph;
@@ -340,6 +340,7 @@ SyntaxElementMorph.prototype.setScale = function (num) {
};
SyntaxElementMorph.prototype.setScale(1);
+SyntaxElementMorph.prototype.isCachingInputs = true;
// SyntaxElementMorph instance creation:
@@ -356,6 +357,7 @@ SyntaxElementMorph.prototype.init = function () {
SyntaxElementMorph.uber.init.call(this);
this.defaults = [];
+ this.cachedInputs = null;
};
// SyntaxElementMorph accessing:
@@ -375,10 +377,12 @@ SyntaxElementMorph.prototype.parts = function () {
SyntaxElementMorph.prototype.inputs = function () {
// answer my arguments and nested reporters
- return this.parts().filter(function (part) {
- return part instanceof SyntaxElementMorph;
- });
-
+ if (isNil(this.cachedInputs) || !this.isCachingInputs) {
+ this.cachedInputs = this.parts().filter(function (part) {
+ return part instanceof SyntaxElementMorph;
+ });
+ }
+ return this.cachedInputs;
};
SyntaxElementMorph.prototype.allInputs = function () {
@@ -494,6 +498,7 @@ SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) {
replacement.drawNew();
this.fixLayout();
}
+ this.cachedInputs = null;
this.endLayout();
};
@@ -529,6 +534,7 @@ SyntaxElementMorph.prototype.silentReplaceInput = function (oldArg, newArg) {
replacement.drawNew();
this.fixLayout();
}
+ this.cachedInputs = null;
};
SyntaxElementMorph.prototype.revertToDefaultInput = function (arg, noValues) {
@@ -571,6 +577,7 @@ SyntaxElementMorph.prototype.revertToDefaultInput = function (arg, noValues) {
} else if (deflt instanceof RingMorph) {
deflt.fixBlockColor();
}
+ this.cachedInputs = null;
};
SyntaxElementMorph.prototype.isLocked = function () {
@@ -848,6 +855,20 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
true // read-only
);
break;
+ case '%interaction':
+ part = new InputSlotMorph(
+ null, // text
+ false, // numeric?
+ {
+ 'clicked' : ['clicked'],
+ 'pressed' : ['pressed'],
+ 'dropped' : ['dropped'],
+ 'mouse-entered' : ['mouse-entered'],
+ 'mouse-departed' : ['mouse-departed']
+ },
+ true // read-only
+ );
+ break;
case '%dates':
part = new InputSlotMorph(
null, // text
@@ -1928,6 +1949,7 @@ BlockMorph.prototype.init = function () {
BlockMorph.uber.init.call(this);
this.color = new Color(0, 17, 173);
+ this.cashedInputs = null;
};
BlockMorph.prototype.receiver = function () {
@@ -2033,6 +2055,7 @@ BlockMorph.prototype.setSpec = function (spec) {
});
this.blockSpec = spec;
this.fixLayout();
+ this.cachedInputs = null;
};
BlockMorph.prototype.buildSpec = function () {
@@ -2425,6 +2448,7 @@ BlockMorph.prototype.restoreInputs = function (oldInputs) {
}
i += 1;
});
+ this.cachedInputs = null;
};
BlockMorph.prototype.showHelp = function () {
@@ -3020,6 +3044,7 @@ BlockMorph.prototype.fullCopy = function () {
//block.comment = null;
});
+ ans.cachedInputs = null;
return ans;
};
@@ -9172,6 +9197,10 @@ MultiArgMorph.prototype = new ArgMorph();
MultiArgMorph.prototype.constructor = MultiArgMorph;
MultiArgMorph.uber = ArgMorph.prototype;
+// MultiArgMorph preferences settings
+
+MultiArgMorph.prototype.isCachingInputs = false;
+
// MultiArgMorph instance creation:
function MultiArgMorph(
@@ -9602,6 +9631,10 @@ ArgLabelMorph.prototype = new ArgMorph();
ArgLabelMorph.prototype.constructor = ArgLabelMorph;
ArgLabelMorph.uber = ArgMorph.prototype;
+// ArgLabelMorph preferences settings
+
+ArgLabelMorph.prototype.isCachingInputs = false;
+
// MultiArgMorph instance creation:
function ArgLabelMorph(argMorph, labelTxt) {