aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/element-controller.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 941e05ba..308e598b 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -15,13 +15,32 @@ exports.ElementController = Montage.create(Component, {
15 15
16 if (el.getAttribute) el.setAttribute('data-ninja-node', 'true'); 16 if (el.getAttribute) el.setAttribute('data-ninja-node', 'true');
17 17
18 // Updated to use new methods in TimelinePanel. JR.
19 var insertionIndex = this.application.ninja.timeline.getInsertionIndex();
20 if (insertionIndex === false) {
21 this.application.ninja.currentSelectedContainer.appendChild(el);
22 } else {
23 if (insertionIndex === 0) {
24 this.application.ninja.currentSelectedContainer.appendChild(el);
25 } else {
26 var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement;
27 element.parentNode.insertBefore(el, element.nextSibling);
28 }
29 }
30
31 if(styles) {
32 this.application.ninja.stylesController.setElementStyles(el, styles);
33 }
34
35 /*
36 // Old methods. Kept for reference. Delete if not needed. JR.
18 if(this.application.ninja.timeline.currentLayerSelected) { 37 if(this.application.ninja.timeline.currentLayerSelected) {
19 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); 38 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
20 39
21 if(selectedLayerIndex === 0) { 40 if(selectedLayerIndex === 0) {
22 this.application.ninja.currentSelectedContainer.appendChild(el); 41 this.application.ninja.currentSelectedContainer.appendChild(el);
23 } else { 42 } else {
24 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; 43 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.stageElement;
25 element.parentNode.insertBefore(el, element.nextSibling); 44 element.parentNode.insertBefore(el, element.nextSibling);
26 } 45 }
27 } else { 46 } else {
@@ -31,6 +50,7 @@ exports.ElementController = Montage.create(Component, {
31 if(styles) { 50 if(styles) {
32 this.application.ninja.stylesController.setElementStyles(el, styles); 51 this.application.ninja.stylesController.setElementStyles(el, styles);
33 } 52 }
53 */
34 } 54 }
35 }, 55 },
36 56