diff options
author | Eric Guzman | 2012-03-17 00:05:14 -0700 |
---|---|---|
committer | Eric Guzman | 2012-03-17 00:05:14 -0700 |
commit | a3192d8bc0f8c0698265817c14dcd2284fd89d7d (patch) | |
tree | 497ac55f550ed52f9d73b464aafb2aa6cb5f5038 /js/stage/layout.js | |
parent | a6a6f9bcc5ff92f5bb5e9275336dfaec2d8e8f4c (diff) | |
parent | 954f5a13e371febcb1c0fb8015c577ee51c23130 (diff) | |
download | ninja-a3192d8bc0f8c0698265817c14dcd2284fd89d7d.tar.gz |
Merge branch 'refs/heads/master' into AddAnimationsLibrary
Conflicts:
js/panels/presets/default-transition-presets.js
Diffstat (limited to 'js/stage/layout.js')
-rwxr-xr-x | js/stage/layout.js | 41 |
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 |