aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorJonathan Duran2012-03-15 13:46:53 -0700
committerJonathan Duran2012-03-15 13:46:53 -0700
commitcc57a3dff8f504526bbf41a8b01c412c4788424a (patch)
tree9127331e952ef1da6faa331ec0bb49ea3acfb980 /js/stage
parent0893ba7f5d1f03099c7b5f8c53ce750e412023cd (diff)
parente6bfd7fb3d3324bea5dbc05350832a9e25c6c00d (diff)
downloadninja-cc57a3dff8f504526bbf41a8b01c412c4788424a.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Conflicts: js/controllers/selection-controller.js js/helper-classes/RDGE/src/tools/rdge-compiled.js js/helper-classes/backup-delete/GLBrushStroke.js js/helper-classes/backup-delete/GLCircle.js js/helper-classes/backup-delete/GLGeomObj.js js/helper-classes/backup-delete/GLRectangle.js js/helper-classes/backup-delete/GLSubpath.js js/helper-classes/backup-delete/GLWorld.js js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js js/helper-classes/backup-delete/Materials/DeformMaterial.js js/helper-classes/backup-delete/Materials/FlatMaterial.js js/helper-classes/backup-delete/Materials/FlyMaterial.js js/helper-classes/backup-delete/Materials/JuliaMaterial.js js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js js/helper-classes/backup-delete/Materials/LinearGradientMaterial.js js/helper-classes/backup-delete/Materials/MandelMaterial.js js/helper-classes/backup-delete/Materials/PlasmaMaterial.js js/helper-classes/backup-delete/Materials/PulseMaterial.js js/helper-classes/backup-delete/Materials/RadialBlurMaterial.js js/helper-classes/backup-delete/Materials/RadialGradientMaterial.js js/helper-classes/backup-delete/Materials/ReliefTunnelMaterial.js js/helper-classes/backup-delete/Materials/SquareTunnelMaterial.js js/helper-classes/backup-delete/Materials/StarMaterial.js js/helper-classes/backup-delete/Materials/TaperMaterial.js js/helper-classes/backup-delete/Materials/TunnelMaterial.js js/helper-classes/backup-delete/Materials/TwistMaterial.js js/helper-classes/backup-delete/Materials/TwistVertMaterial.js js/helper-classes/backup-delete/Materials/UberMaterial.js js/helper-classes/backup-delete/Materials/WaterMaterial.js js/helper-classes/backup-delete/Materials/ZInvertMaterial.js js/lib/drawing/world.js js/preloader/Preloader.js js/stage/layout.js Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js41
1 files changed, 19 insertions, 22 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 8a53a08b..6be2df1d 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -64,31 +64,17 @@ exports.Layout = Montage.create(Component, {
64 64
65 handleOpenDocument: { 65 handleOpenDocument: {
66 value: function() { 66 value: function() {
67 // Initial elements to draw is the entire node list 67 // Initial elements to draw are the childrens of the root element
68 if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view 68 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
69 this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; 69 this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes;
70 } 70 }
71
71 // Draw the elements and the 3d info 72 // Draw the elements and the 3d info
72 this.draw(); 73 this.draw();
73 this.draw3DInfo(false); 74 this.draw3DInfo(false);
74 } 75 }
75 }, 76 },
76 77
77 // No need to keep track of the added elements. We now have a live node list of the dom
78 handleElementAdded: {
79 value: function(event) {
80 // this.domTree.push(event.detail);
81 // this.draw();
82 // this.draw3DInfo(false);
83 }
84 },
85
86 handleElementDeleted: {
87 value: function(event) {
88 //this.domTree.splice(this.domTree.indexOf(event.detail), 1);
89 }
90 },
91
92 // Redraw stage only once after all deletion is completed 78 // Redraw stage only once after all deletion is completed
93 handleDeleteSelection: { 79 handleDeleteSelection: {
94 value: function(event) { 80 value: function(event) {
@@ -99,14 +85,25 @@ exports.Layout = Montage.create(Component, {
99 85
100 handleSelectionChange: { 86 handleSelectionChange: {
101 value: function(event) { 87 value: function(event) {
88 var containerIndex;
102 89
103 if(this.application.ninja.documentController.activeDocument === null){ 90 if(this.application.ninja.documentController.activeDocument === null){
104 return; 91 return;
105 } 92 }
106 93
107 // Make an array copy of the line node list which is not an array like object 94 if(this.application.ninja.documentController.activeDocument.currentView === "design"){
108 if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view 95 // Make an array copy of the line node list which is not an array like object
109 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); 96 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0);
97 // Index of the current container
98 containerIndex = this.domTree.indexOf(this.application.ninja.currentSelectedContainer);
99
100 if(containerIndex < 0) {
101 // Stage is the container.
102 this.domTree = Array.prototype.slice.call(this.application.ninja.currentSelectedContainer.childNodes, 0);
103 } else {
104 // Child nodes of the container
105 this.domTree = Array.prototype.slice.call(this.domTree[containerIndex].childNodes, 0);
106 }
110 } 107 }
111 // Clear the elements to draw 108 // Clear the elements to draw
112 this.elementsToDraw.length = 0; 109 this.elementsToDraw.length = 0;
@@ -119,10 +116,10 @@ exports.Layout = Montage.create(Component, {
119 return (tmp.indexOf(value) === -1); 116 return (tmp.indexOf(value) === -1);
120 }); 117 });
121 } else { 118 } else {
122 this.elementsToDraw = this.domTree; 119 this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0);
123 } 120 }
124 121
125 this.draw(); // Not a reel yet :) 122 this.draw(); // Not a reel yet
126 this.draw3DInfo(false); 123 this.draw3DInfo(false);
127 124
128 // Clear the domTree copy 125 // Clear the domTree copy