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 20225c61..675176e9 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -11,13 +11,32 @@ exports.ElementController = Montage.create(Component, {
11 11
12 addElement: { 12 addElement: {
13 value: function(el, styles) { 13 value: function(el, styles) {
14 // Updated to use new methods in TimelinePanel. JR.
15 var insertionIndex = this.application.ninja.timeline.getInsertionIndex();
16 if (insertionIndex === false) {
17 this.application.ninja.currentSelectedContainer.appendChild(el);
18 } else {
19 if (insertionIndex === 0) {
20 this.application.ninja.currentSelectedContainer.appendChild(el);
21 } else {
22 var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement;
23 element.parentNode.insertBefore(el, element.nextSibling);
24 }
25 }
26
27 if(styles) {
28 this.application.ninja.stylesController.setElementStyles(el, styles);
29 }
30
31 /*
32 // Old methods. Kept for reference. Delete if not needed. JR.
14 if(this.application.ninja.timeline.currentLayerSelected) { 33 if(this.application.ninja.timeline.currentLayerSelected) {
15 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); 34 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
16 35
17 if(selectedLayerIndex === 0) { 36 if(selectedLayerIndex === 0) {
18 this.application.ninja.currentSelectedContainer.appendChild(el); 37 this.application.ninja.currentSelectedContainer.appendChild(el);
19 } else { 38 } else {
20 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; 39 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.stageElement;
21 element.parentNode.insertBefore(el, element.nextSibling); 40 element.parentNode.insertBefore(el, element.nextSibling);
22 } 41 }
23 } else { 42 } else {
@@ -27,6 +46,7 @@ exports.ElementController = Montage.create(Component, {
27 if(styles) { 46 if(styles) {
28 this.application.ninja.stylesController.setElementStyles(el, styles); 47 this.application.ninja.stylesController.setElementStyles(el, styles);
29 } 48 }
49 */
30 } 50 }
31 }, 51 },
32 52