diff options
Diffstat (limited to 'store.js')
| -rw-r--r-- | store.js | 32 |
1 files changed, 27 insertions, 5 deletions
@@ -61,7 +61,7 @@ SyntaxElementMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2014-January-09'; +modules.store = '2014-April-30'; // XML_Serializer /////////////////////////////////////////////////////// @@ -377,7 +377,18 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) { project.pentrails.src = model.pentrails.contents; } project.stage.setTempo(model.stage.attributes.tempo); + StageMorph.prototype.dimensions = new Point(480, 360); + if (model.stage.attributes.width) { + StageMorph.prototype.dimensions.x = + Math.max(+model.stage.attributes.width, 480); + } + if (model.stage.attributes.height) { + StageMorph.prototype.dimensions.y = + Math.max(+model.stage.attributes.height, 180); + } project.stage.setExtent(StageMorph.prototype.dimensions); + SpriteMorph.prototype.useFlatLineEnds = + model.stage.attributes.lines === 'flat'; project.stage.isThreadSafe = model.stage.attributes.threadsafe === 'true'; StageMorph.prototype.enableCodeMapping = @@ -446,8 +457,6 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) { } }); - this.objects = {}; - /* Global Variables */ if (model.globalVariables) { @@ -457,6 +466,8 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) { ); } + this.objects = {}; + /* Watchers */ model.sprites.childrenNamed('watcher').forEach(function (model) { @@ -510,7 +521,7 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) { )) ); project.stage.add(watcher); - watcher.update(); + watcher.onNextStep = function () {this.currentValue = null; }; // set watcher's contentsMorph's extent if it is showing a list and // its monitor dimensions are given @@ -1291,6 +1302,12 @@ SnapSerializer.prototype.openProject = function (project, ide) { ide.createCorral(); ide.selectSprite(sprite); ide.fixLayout(); + + // force watchers to update + //project.stage.watchers().forEach(function (watcher) { + // watcher.onNextStep = function () {this.currentValue = null;}; + //}) + ide.world().keyboardReceiver = project.stage; }; @@ -1339,7 +1356,9 @@ StageMorph.prototype.toXML = function (serializer) { '<project name="@" app="@" version="@">' + '<notes>$</notes>' + '<thumbnail>$</thumbnail>' + - '<stage name="@" costume="@" tempo="@" threadsafe="@" ' + + '<stage name="@" width="@" height="@" ' + + 'costume="@" tempo="@" threadsafe="@" ' + + 'lines="@" ' + 'codify="@" ' + 'scheduled="@" ~>' + '<pentrails>$</pentrails>' + @@ -1361,9 +1380,12 @@ StageMorph.prototype.toXML = function (serializer) { (ide && ide.projectNotes) ? ide.projectNotes : '', thumbdata, this.name, + StageMorph.prototype.dimensions.x, + StageMorph.prototype.dimensions.y, this.getCostumeIdx(), this.getTempo(), this.isThreadSafe, + SpriteMorph.prototype.useFlatLineEnds ? 'flat' : 'round', this.enableCodeMapping, StageMorph.prototype.frameRate !== 0, this.trailsCanvas.toDataURL('image/png'), |
