summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Mönig <jens@moenig.org>2015-04-26 22:47:37 -0400
committerJens Mönig <jens@moenig.org>2015-04-26 22:47:37 -0400
commit9385e4b57c88c382c1758e54c258ac237d238679 (patch)
tree1a858593b6bc1c0fb88c4486fbc185c63fe0b100
parent834b3918adc35792eae7d6cf59a17f48f0d88cb9 (diff)
downloadsnap-9385e4b57c88c382c1758e54c258ac237d238679.tar.gz
snap-9385e4b57c88c382c1758e54c258ac237d238679.zip
fixed #784
-rwxr-xr-xhistory.txt4
-rw-r--r--store.js78
2 files changed, 47 insertions, 35 deletions
diff --git a/history.txt b/history.txt
index 0efef9b..6c1a637 100755
--- a/history.txt
+++ b/history.txt
@@ -2485,3 +2485,7 @@ ______
------
* Threads: flush Stage>>keysPressed when prompting the user
* Objects: fixed #770
+
+150426
+------
+* Store: fixed #784
diff --git a/store.js b/store.js
index d4a2b64..5cba3c3 100644
--- a/store.js
+++ b/store.js
@@ -61,7 +61,7 @@ SyntaxElementMorph, Variable*/
// Global stuff ////////////////////////////////////////////////////////
-modules.store = '2015-March-15';
+modules.store = '2015-April-26';
// XML_Serializer ///////////////////////////////////////////////////////
@@ -491,7 +491,7 @@ SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
/* Watchers */
model.sprites.childrenNamed('watcher').forEach(function (model) {
- var watcher, color, target, hidden, extX, extY;
+ var watcher, color, target, hidden, extX, extY, vFrame;
color = myself.loadColor(model.attributes.color);
target = Object.prototype.hasOwnProperty.call(
@@ -512,14 +512,20 @@ SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
model.attributes,
'var'
)) {
- watcher = new WatcherMorph(
- model.attributes['var'],
- color,
- isNil(target) ? project.globalVariables
- : target.variables,
- model.attributes['var'],
- hidden
- );
+ vFrame = isNil(target) ? project.globalVariables
+ : target.variables;
+ if (Object.prototype.hasOwnProperty.call(
+ vFrame.vars,
+ model.attributes['var']
+ )) {
+ watcher = new WatcherMorph(
+ model.attributes['var'],
+ color,
+ vFrame,
+ model.attributes['var'],
+ hidden
+ );
+ }
} else {
watcher = new WatcherMorph(
localize(myself.watcherLabels[model.attributes.s]),
@@ -529,33 +535,35 @@ SnapSerializer.prototype.rawLoadProjectModel = function (xmlNode) {
hidden
);
}
- watcher.setStyle(model.attributes.style || 'normal');
- if (watcher.style === 'slider') {
- watcher.setSliderMin(model.attributes.min || '1');
- watcher.setSliderMax(model.attributes.max || '100');
- }
- watcher.setPosition(
- project.stage.topLeft().add(new Point(
- +model.attributes.x || 0,
- +model.attributes.y || 0
- ))
- );
- project.stage.add(watcher);
- watcher.onNextStep = function () {this.currentValue = null; };
-
- // set watcher's contentsMorph's extent if it is showing a list and
- // its monitor dimensions are given
- if (watcher.currentValue instanceof List) {
- extX = model.attributes.extX;
- if (extX) {
- watcher.cellMorph.contentsMorph.setWidth(+extX);
+ if (watcher) {
+ watcher.setStyle(model.attributes.style || 'normal');
+ if (watcher.style === 'slider') {
+ watcher.setSliderMin(model.attributes.min || '1');
+ watcher.setSliderMax(model.attributes.max || '100');
}
- extY = model.attributes.extY;
- if (extY) {
- watcher.cellMorph.contentsMorph.setHeight(+extY);
+ watcher.setPosition(
+ project.stage.topLeft().add(new Point(
+ +model.attributes.x || 0,
+ +model.attributes.y || 0
+ ))
+ );
+ project.stage.add(watcher);
+ watcher.onNextStep = function () {this.currentValue = null; };
+
+ // set watcher's contentsMorph's extent if it is showing a list
+ // and if its monitor dimensions are given
+ if (watcher.currentValue instanceof List) {
+ extX = model.attributes.extX;
+ if (extX) {
+ watcher.cellMorph.contentsMorph.setWidth(+extX);
+ }
+ extY = model.attributes.extY;
+ if (extY) {
+ watcher.cellMorph.contentsMorph.setHeight(+extY);
+ }
+ // adjust my contentsMorph's handle position
+ watcher.cellMorph.contentsMorph.handle.drawNew();
}
- // adjust my contentsMorph's handle position
- watcher.cellMorph.contentsMorph.handle.drawNew();
}
});
this.objects = {};