aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js24
-rwxr-xr-xjs/stage/stage.reel/stage.js20
2 files changed, 37 insertions, 7 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js
index b207cc3d..5ad2d364 100755
--- a/js/stage/binding-view.reel/binding-view.js
+++ b/js/stage/binding-view.reel/binding-view.js
@@ -207,22 +207,36 @@ exports.BindingView = Montage.create(Component, {
207 } 207 }
208 }, 208 },
209 209
210 _currentDocument : { value: null }, 210 _currentDocument: {
211 currentDocument : { 211 value: null
212 get : function() { return this._currentDocument; }, 212 },
213 set : function(value) {
214 if(value === this._currentDocument) { return; }
215 213
214 currentDocument: {
215 get: function() {
216 return this._currentDocument;
217 },
218 set: function(value) {
219 if(value === this._currentDocument) {
220 return;
221 }
216 222
217 this._currentDocument = value; 223 this._currentDocument = value;
224
218 if(value) { 225 if(value) {
219 this.hide = (value.currentView === 'code'); 226 this.hide = (value.currentView === 'code');
227 this.currentDocument.addPropertyChangeListener("model.currentView", this, false);
220 } 228 }
221 229
222 this.needsDraw = true; 230 this.needsDraw = true;
223 } 231 }
224 }, 232 },
225 233
234 handleChange: {
235 value: function() {
236 this.hide = this.currentDocument.model.currentView.identifier === "design-code";
237 }
238 },
239
226 _hide : { value: true }, 240 _hide : { value: true },
227 hide : { 241 hide : {
228 get : function() { return this._hide; }, 242 get : function() { return this._hide; },
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 817220d4..39336b57 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -368,6 +368,8 @@ exports.Stage = Montage.create(Component, {
368 368
369 this.clearAllCanvas(); 369 this.clearAllCanvas();
370 this.initWithDocument(); 370 this.initWithDocument();
371
372 this._currentDocument.addPropertyChangeListener("model.currentView", this, false);
371 } else { 373 } else {
372 this.collapseAllPanels(); 374 this.collapseAllPanels();
373 this.hideCanvas(true); 375 this.hideCanvas(true);
@@ -376,6 +378,20 @@ exports.Stage = Montage.create(Component, {
376 } 378 }
377 }, 379 },
378 380
381 handleDocumentViewChange: {
382 value: function() {
383 if(this.currentDocument.model.currentView.identifier === "design-code") {
384 this.collapseAllPanels();
385 this.hideRulers();
386 this.hideCanvas(true);
387 } else {
388 this.restoreAllPanels(true);
389 this.hideCanvas(false);
390 this.showRulers();
391 }
392 }
393 },
394
379 _userPaddingLeft: { value: 0 }, 395 _userPaddingLeft: { value: 0 },
380 _userPaddingTop: { value: 0 }, 396 _userPaddingTop: { value: 0 },
381 397
@@ -492,8 +508,6 @@ exports.Stage = Montage.create(Component, {
492 this.eventManager.addEventListener( "elementChange", this, false); 508 this.eventManager.addEventListener( "elementChange", this, false);
493 509
494 this.addPropertyChangeListener("currentDocument.model.domContainer", this, true); 510 this.addPropertyChangeListener("currentDocument.model.domContainer", this, true);
495// this.addPropertyChangeListener("currentDocument.model.domContainer", this);
496
497 } 511 }
498 }, 512 },
499 513
@@ -586,6 +600,8 @@ exports.Stage = Montage.create(Component, {
586 drawUtils.drawXZ = false; 600 drawUtils.drawXZ = false;
587 this.updatedStage = true; 601 this.updatedStage = true;
588 } 602 }
603 } else if(notification.currentPropertyPath === "model.currentView") {
604 this.handleDocumentViewChange();
589 } 605 }
590 /* 606 /*
591 else if(notification.currentPropertyPath === "currentDocument.model.domContainer") { 607 else if(notification.currentPropertyPath === "currentDocument.model.domContainer") {