aboutsummaryrefslogtreecommitdiff
path: root/js/stage/layout.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 16:28:39 -0700
committerJohn Mayhew2012-04-02 16:28:39 -0700
commitb4155fb4c33675a8a7cd37473513718043fdf0ba (patch)
tree3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/stage/layout.js
parent5ba9aeac94c86049423fd5d4b37b277263939c13 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/runtime/GLRuntime.js js/helper-classes/RDGE/src/core/script/MeshManager.js js/helper-classes/RDGE/src/core/script/engine.js js/helper-classes/RDGE/src/core/script/fx/ssao.js js/helper-classes/RDGE/src/core/script/init_state.js js/helper-classes/RDGE/src/core/script/run_state.js js/helper-classes/RDGE/src/core/script/scenegraphNodes.js js/helper-classes/RDGE/src/core/script/utilities.js js/helper-classes/RDGE/src/tools/compile-rdge-core.bat js/helper-classes/RDGE/src/tools/compile-rdge-core.sh js/helper-classes/RDGE/src/tools/rdge-compiled.js js/lib/drawing/world.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/linear-gradient-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-blur-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js js/preloader/Preloader.js
Diffstat (limited to 'js/stage/layout.js')
-rwxr-xr-xjs/stage/layout.js41
1 files changed, 20 insertions, 21 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index de4c67c1..6be2df1d 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -64,8 +64,10 @@ 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 this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; 68 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
69 this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes;
70 }
69 71
70 // Draw the elements and the 3d info 72 // Draw the elements and the 3d info
71 this.draw(); 73 this.draw();
@@ -73,21 +75,6 @@ exports.Layout = Montage.create(Component, {
73 } 75 }
74 }, 76 },
75 77
76 // No need to keep track of the added elements. We now have a live node list of the dom
77 handleElementAdded: {
78 value: function(event) {
79 // this.domTree.push(event.detail);
80 // this.draw();
81 // this.draw3DInfo(false);
82 }
83 },
84
85 handleElementDeleted: {
86 value: function(event) {
87 //this.domTree.splice(this.domTree.indexOf(event.detail), 1);
88 }
89 },
90
91 // Redraw stage only once after all deletion is completed 78 // Redraw stage only once after all deletion is completed
92 handleDeleteSelection: { 79 handleDeleteSelection: {
93 value: function(event) { 80 value: function(event) {
@@ -98,14 +85,26 @@ exports.Layout = Montage.create(Component, {
98 85
99 handleSelectionChange: { 86 handleSelectionChange: {
100 value: function(event) { 87 value: function(event) {
88 var containerIndex;
101 89
102 if(this.application.ninja.documentController.activeDocument === null){ 90 if(this.application.ninja.documentController.activeDocument === null){
103 return; 91 return;
104 } 92 }
105 93
106 // 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"){
107 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); 95 // Make an array copy of the line node list which is not an array like object
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);
108 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 }
107 }
109 // Clear the elements to draw 108 // Clear the elements to draw
110 this.elementsToDraw.length = 0; 109 this.elementsToDraw.length = 0;
111 110
@@ -117,10 +116,10 @@ exports.Layout = Montage.create(Component, {
117 return (tmp.indexOf(value) === -1); 116 return (tmp.indexOf(value) === -1);
118 }); 117 });
119 } else { 118 } else {
120 this.elementsToDraw = this.domTree; 119 this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0);
121 } 120 }
122 121
123 this.draw(); // Not a reel yet :) 122 this.draw(); // Not a reel yet
124 this.draw3DInfo(false); 123 this.draw3DInfo(false);
125 124
126 // Clear the domTree copy 125 // Clear the domTree copy