diff options
author | Jon Reid | 2012-05-18 15:05:50 -0700 |
---|---|---|
committer | Jon Reid | 2012-05-18 15:05:50 -0700 |
commit | 6c4f58ab9dd2f60d509d3e1c1ba0c94a6995691d (patch) | |
tree | b555c40a0276052e6109d98a5ec23358759985f2 /js/controllers | |
parent | ef499e92341c9bd6edbee70f86dc5a6fe8b461eb (diff) | |
download | ninja-6c4f58ab9dd2f60d509d3e1c1ba0c94a6995691d.tar.gz |
Timeline: Fix element insertion to use new TimelinePanel properties and
multiselect. Fix Property Panel so changing an ID there will actually change
an ID on the element (broken by switch from id to data-montage-id change).
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index eecf319e..925fc959 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -11,6 +11,33 @@ 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 | console.log("elementcontroller.addElement, insertionIndex = ", insertionIndex); | ||
17 | //debugger; | ||
18 | if (insertionIndex === false) { | ||
19 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
20 | } else { | ||
21 | if (insertionIndex === 0) { | ||
22 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
23 | } else { | ||
24 | /* | ||
25 | if (insertionIndex === this.application.ninja.timeline.arrLayers.length-1) { | ||
26 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
27 | } else { | ||
28 | */ | ||
29 | var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement; | ||
30 | element.parentNode.insertBefore(el, element.nextSibling); | ||
31 | //} | ||
32 | } | ||
33 | } | ||
34 | |||
35 | if(styles) { | ||
36 | this.application.ninja.stylesController.setElementStyles(el, styles); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | // Old methods. Kept for reference. Delete if not needed. JR. | ||
14 | if(this.application.ninja.timeline.currentLayerSelected) { | 41 | if(this.application.ninja.timeline.currentLayerSelected) { |
15 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); | 42 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); |
16 | 43 | ||
@@ -27,6 +54,7 @@ exports.ElementController = Montage.create(Component, { | |||
27 | if(styles) { | 54 | if(styles) { |
28 | this.application.ninja.stylesController.setElementStyles(el, styles); | 55 | this.application.ninja.stylesController.setElementStyles(el, styles); |
29 | } | 56 | } |
57 | */ | ||
30 | } | 58 | } |
31 | }, | 59 | }, |
32 | 60 | ||