aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/document-controller.js6
-rwxr-xr-xjs/controllers/elements/element-controller.js6
-rwxr-xr-xjs/controllers/selection-controller.js9
-rwxr-xr-xjs/document/html-document.js53
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js20
-rwxr-xr-xjs/stage/stage-deps.js38
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js19
-rwxr-xr-xjs/stage/stage.reel/stage.js14
8 files changed, 140 insertions, 25 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index d5d0cf42..e221df68 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -339,7 +339,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
339 // Event Detail: Contains the current ActiveDocument 339 // Event Detail: Contains the current ActiveDocument
340 _onOpenDocument: { 340 _onOpenDocument: {
341 value: function(doc){ 341 value: function(doc){
342 //var data = DocumentManager.activeDocument; 342 this.application.ninja.currentDocument = doc;
343 this._hideCurrentDocument(); 343 this._hideCurrentDocument();
344 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); 344 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
345 345
@@ -423,7 +423,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
423 value: function() { 423 value: function() {
424 if(this.activeDocument) { 424 if(this.activeDocument) {
425 if(this.activeDocument.currentView === "design"){ 425 if(this.activeDocument.currentView === "design"){
426 this.application.ninja.stage.saveScroll(); 426 this.activeDocument.saveAppState();
427 this.activeDocument.container.parentNode.style["display"] = "none"; 427 this.activeDocument.container.parentNode.style["display"] = "none";
428 this.application.ninja.stage.hideCanvas(true); 428 this.application.ninja.stage.hideCanvas(true);
429 this.application.ninja.stage.stageView.hideRulers(); 429 this.application.ninja.stage.stageView.hideRulers();
@@ -440,7 +440,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
440 this.activeDocument.container.style["display"] = "block"; 440 this.activeDocument.container.style["display"] = "block";
441 if(this.activeDocument.currentView === "design"){ 441 if(this.activeDocument.currentView === "design"){
442 this.activeDocument.container.parentNode.style["display"] = "block"; 442 this.activeDocument.container.parentNode.style["display"] = "block";
443 this.application.ninja.stage.restoreScroll(); 443 this.activeDocument.restoreAppState();
444 this.application.ninja.stage.hideCanvas(false); 444 this.application.ninja.stage.hideCanvas(false);
445 this.application.ninja.stage.stageView.showRulers(); 445 this.application.ninja.stage.stageView.showRulers();
446 }else{ 446 }else{
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 46e82ace..ec0335b4 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -27,7 +27,11 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
27 27
28 getProperty: { 28 getProperty: {
29 value: function(el, prop, fallbackOnComputed, isStageElement) { 29 value: function(el, prop, fallbackOnComputed, isStageElement) {
30 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement); 30 if(el.nodeType !== 3){
31 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement);
32 }else{
33 return null;
34 }
31 } 35 }
32 }, 36 },
33 37
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index d69b53e0..f50762f3 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -58,6 +58,7 @@ exports.SelectionController = Montage.create(Component, {
58 handleOpenDocument: { 58 handleOpenDocument: {
59 value: function() { 59 value: function() {
60 // Handle initializing the selection array here. 60 // Handle initializing the selection array here.
61 this.initWithDocument([]);
61 } 62 }
62 }, 63 },
63 64
@@ -70,6 +71,14 @@ exports.SelectionController = Montage.create(Component, {
70 if(currentSelectionArray.length >= 1) { 71 if(currentSelectionArray.length >= 1) {
71 this._selectedItems = currentSelectionArray; 72 this._selectedItems = currentSelectionArray;
72 this._isDocument = false; 73 this._isDocument = false;
74
75
76
77 this.application.ninja.selectedElements = currentSelectionArray;
78 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
79
80
81
73 } 82 }
74 } 83 }
75 84
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 6394e3ce..8798b407 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -54,6 +54,11 @@ exports.HTMLDocument = Montage.create(TextDocument, {
54 }, 54 },
55 55
56 56
57 //drawUtils state
58 _gridHorizontalSpacing: {value:0},
59 _gridVerticalSpacing: {value:0},
60 //end - drawUtils state
61
57 62
58 // GETTERS / SETTERS 63 // GETTERS / SETTERS
59 64
@@ -72,6 +77,16 @@ exports.HTMLDocument = Montage.create(TextDocument, {
72 set: function(value) { this._savedTopScroll = value} 77 set: function(value) { this._savedTopScroll = value}
73 }, 78 },
74 79
80 gridHorizontalSpacing:{
81 get: function() { return this._gridHorizontalSpacing; },
82 set: function(value) { this._gridHorizontalSpacing = value}
83 },
84
85 gridVerticalSpacing:{
86 get: function() { return this._gridVerticalSpacing; },
87 set: function(value) { this._gridVerticalSpacing = value}
88 },
89
75 selectionExclude: { 90 selectionExclude: {
76 get: function() { return this._selectionExclude; }, 91 get: function() { return this._selectionExclude; },
77 set: function(value) { this._selectionExclude = value; } 92 set: function(value) { this._selectionExclude = value; }
@@ -593,7 +608,43 @@ exports.HTMLDocument = Montage.create(TextDocument, {
593 //Error 608 //Error
594 } 609 }
595 } 610 }
596 } 611 },
597 //////////////////////////////////////////////////////////////////// 612 ////////////////////////////////////////////////////////////////////
613 saveAppState:{
614 enumerable: false,
615 value: function () {
616
617 this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft;
618 this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop;
619
620 this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
621 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
622
623 if(typeof this.application.ninja.selectedElements !== 'undefined'){
624 this.selectionModel = this.application.ninja.selectedElements;
625 }
626 }
627 },
628
629 ////////////////////////////////////////////////////////////////////
630 restoreAppState:{
631 enumerable: false,
632 value: function () {
633 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
634 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
635
636 if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null) && (this.selectionModel.length > 0)){
637 this.application.ninja.selectionController.initWithDocument(this.selectionModel);
638 }
639
640 if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){
641 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
642 this.application.ninja.stage._scrollLeft = this.savedLeftScroll;
643 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
644 this.application.ninja.stage._scrollLeft = this.savedTopScroll;
645 }
646 this.application.ninja.stage.handleScroll();
647 }
648 }
598 //////////////////////////////////////////////////////////////////// 649 ////////////////////////////////////////////////////////////////////
599}); \ No newline at end of file 650}); \ No newline at end of file
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index c07391db..37fc1cfc 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -115,6 +115,26 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
115 } 115 }
116 }, 116 },
117 117
118 initializeFromDocument:{
119 value:function(){
120 var documentRootChildren = null, i;
121 //initialize with current document
122 this._eltArray = [];
123 this._planesArray = [];
124 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas);
125 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage );
126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) );
127
128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
129 if(this.application.ninja.currentDocument.documentRoot.hasChildNodes()){
130 documentRootChildren = this.application.ninja.currentDocument.documentRoot.childNodes;
131 for(i=0;i<documentRootChildren.length;i++){
132 this.addElement(documentRootChildren[i]);
133 }
134 }
135 }
136 },
137
118 handleElementAdded: { 138 handleElementAdded: {
119 value: function(event) { 139 value: function(event) {
120 this.addElement(event.detail); 140 this.addElement(event.detail);
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index d46e2b81..16f2c652 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -23,6 +23,10 @@ exports.StageDeps = Montage.create(Component, {
23 value: snapManager 23 value: snapManager
24 }, 24 },
25 25
26 drawUtils: {
27 value: drawUtils
28 },
29
26 currentStage: { 30 currentStage: {
27 value: null 31 value: null
28 }, 32 },
@@ -129,19 +133,47 @@ exports.StageDeps = Montage.create(Component, {
129 viewUtils.setRootElement(this.currentStage.parentNode); 133 viewUtils.setRootElement(this.currentStage.parentNode);
130 viewUtils.setStageElement(this.currentStage);