aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-08-07 13:27:19 -0700
committerNivesh Rajbhandari2012-08-07 13:27:19 -0700
commitda71ec8bf450438a4dc904cb348e548d01dfcb3f (patch)
tree36bae4f77a61c2c6690566c79d07f5b6bc2c3936 /js/stage
parent923e760bf4a16baa82e81da6d38e671620664e8f (diff)
parent91c440a04f0108d05e663d1696027ca5601b25bc (diff)
downloadninja-da71ec8bf450438a4dc904cb348e548d01dfcb3f.tar.gz
Merge branch 'refs/heads/ninja-mqg734-master' into LineInCanvas
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js24
-rwxr-xr-xjs/stage/stage.reel/stage.css6
-rwxr-xr-xjs/stage/stage.reel/stage.js29
3 files changed, 51 insertions, 8 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.css b/js/stage/stage.reel/stage.css
index 56b4c58c..d1277ef1 100755
--- a/js/stage/stage.reel/stage.css
+++ b/js/stage/stage.reel/stage.css
@@ -68,7 +68,11 @@ POSSIBILITY OF SUCH DAMAGE.
68 68
69.codeViewContainer .CodeMirror-scroll { 69.codeViewContainer .CodeMirror-scroll {
70 height: 100%; 70 height: 100%;
71 overflow: auto; 71 overflow-y: hidden;
72}
73
74.codeViewContainer .CodeMirror-scrollbar {
75 display:none;
72} 76}
73 77
74.codeViewContainer>div{ 78.codeViewContainer>div{
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 817220d4..883f1526 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -349,6 +349,9 @@ exports.Stage = Montage.create(Component, {
349 349
350 //call configure false with the old document on the selected tool to tear down down any temp. stuff 350 //call configure false with the old document on the selected tool to tear down down any temp. stuff
351 this.application.ninja.toolsData.selectedToolInstance._configure(false); 351 this.application.ninja.toolsData.selectedToolInstance._configure(false);
352
353 // Remove the change listener
354 this._currentDocument.removePropertyChangeListener("model.currentViewIdentifier", this, false);
352 } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { 355 } else if(this.currentDocument && (this.currentDocument.currentView === "code")) {
353 this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar 356 this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar
354 } 357 }
@@ -368,6 +371,8 @@ exports.Stage = Montage.create(Component, {
368 371
369 this.clearAllCanvas(); 372 this.clearAllCanvas();
370 this.initWithDocument(); 373 this.initWithDocument();
374
375 this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false);
371 } else { 376 } else {
372 this.collapseAllPanels(); 377 this.collapseAllPanels();
373 this.hideCanvas(true); 378 this.hideCanvas(true);
@@ -376,6 +381,26 @@ exports.Stage = Montage.create(Component, {
376 } 381 }
377 }, 382 },
378 383
384 handleDocumentViewChange: {
385 value: function() {
386 if(this.currentDocument.model.currentView.identifier === "design-code") {
387 drawUtils._eltArray.length = 0;
388 drawUtils._planesArray.length = 0;
389
390 this.collapseAllPanels();
391 this.hideRulers();
392 this.hideCanvas(true);
393 } else {
394 this.restoreAllPanels(true);
395 this.hideCanvas(false);
396 this.showRulers();
397
398 this.clearAllCanvas();
399 this.initWithDocument();
400 }
401 }
402 },
403
379 _userPaddingLeft: { value: 0 }, 404 _userPaddingLeft: { value: 0 },
380 _userPaddingTop: { value: 0 }, 405 _userPaddingTop: { value: 0 },
381 406
@@ -492,8 +517,6 @@ exports.Stage = Montage.create(Component, {
492 this.eventManager.addEventListener( "elementChange", this, false); 517 this.eventManager.addEventListener( "elementChange", this, false);
493 518
494 this.addPropertyChangeListener("currentDocument.model.domContainer", this, true); 519 this.addPropertyChangeListener("currentDocument.model.domContainer", this, true);
495// this.addPropertyChangeListener("currentDocument.model.domContainer", this);
496
497 } 520 }
498 }, 521 },
499 522
@@ -586,6 +609,8 @@ exports.Stage = Montage.create(Component, {
586 drawUtils.drawXZ = false; 609 drawUtils.drawXZ = false;
587 this.updatedStage = true; 610 this.updatedStage = true;
588 } 611 }
612 } else if(notification.currentPropertyPath === "model.currentViewIdentifier") {
613 this.handleDocumentViewChange();
589 } 614 }
590 /* 615 /*
591 else if(notification.currentPropertyPath === "currentDocument.model.domContainer") { 616 else if(notification.currentPropertyPath === "currentDocument.model.domContainer") {