diff options
author | Valerio Virgillito | 2012-05-03 13:35:37 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-03 13:35:37 -0700 |
commit | 602240c38e0f2c3937d3c7246247e0b59bccab2b (patch) | |
tree | 6e4ed3fc6b3d6ab7aa0500b6b06f05744b8ddbb6 /js | |
parent | a68c52ec84248cc1d8393d277edab6a4d3353c7e (diff) | |
download | ninja-602240c38e0f2c3937d3c7246247e0b59bccab2b.tar.gz |
minor formatting
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 13 | ||||
-rwxr-xr-x | js/mediators/element-mediator.js | 46 |
2 files changed, 26 insertions, 33 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index a7d99466..ea5fe4af 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -11,17 +11,16 @@ exports.ElementController = Montage.create(Component, { | |||
11 | 11 | ||
12 | addElement: { | 12 | addElement: { |
13 | value: function(el, styles) { | 13 | value: function(el, styles) { |
14 | if(this.application.ninja.timeline.currentLayerSelected){ | 14 | if(this.application.ninja.timeline.currentLayerSelected) { |
15 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); | 15 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); |
16 | 16 | ||
17 | if(selectedLayerIndex==0){ | 17 | if(selectedLayerIndex === 0) { |
18 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | 18 | this.application.ninja.currentDocument.documentRoot.appendChild(el); |
19 | }else{ | 19 | } else { |
20 | var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; | 20 | var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; |
21 | element.parentNode.insertBefore(el,element.nextSibling); | 21 | element.parentNode.insertBefore(el, element.nextSibling); |
22 | } | 22 | } |
23 | 23 | } else { | |
24 | }else{ | ||
25 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | 24 | this.application.ninja.currentDocument.documentRoot.appendChild(el); |
26 | } | 25 | } |
27 | // Nested elements - TODO make sure the CSS is correct before nesting elements | 26 | // Nested elements - TODO make sure the CSS is correct before nesting elements |
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 49a8e369..06514076 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -517,36 +517,30 @@ exports.ElementMediator = Montage.create(Component, { | |||
517 | }, | 517 | }, |
518 | 518 | ||
519 | reArrangeDOM:{ | 519 | reArrangeDOM:{ |
520 | value:function(layersDraggedArray , layerDroppedAfter){ | 520 | value: function(layersDraggedArray, layerDroppedAfter) { |
521 | var documentRoot,length; | ||
521 | 522 | ||
522 | var documentRoot,length; | 523 | documentRoot = this.application.ninja.currentDocument.documentRoot; |
524 | length = layersDraggedArray.length; | ||
523 | 525 | ||
524 | documentRoot = this.application.ninja.currentDocument.documentRoot; | 526 | for(var i=0; documentRoot.children[i]; i++) { |
525 | length = layersDraggedArray.length; | 527 | if(documentRoot.children[i] === layerDroppedAfter.layerData.elementsList[0]) { |
526 | 528 | if(length >0){ | |
527 | for(i=0;documentRoot.children[i];i++){ | 529 | documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0], documentRoot.children[i]); |
528 | if(documentRoot.children[i]===layerDroppedAfter.layerData.elementsList[0]){ | ||
529 | if(length >0){ | ||
530 | documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[i]); | ||
531 | } | ||
532 | /* Will require for Multiple Drag n Drop */ | ||
533 | // length = length-1; | ||
534 | // index=i; | ||
535 | // if(length>0){ | ||
536 | // while(layersDraggedArray[length]){ | ||
537 | // documentRoot.children[index].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[k].nextSibling); | ||
538 | // length--; | ||
539 | // index++; | ||
540 | // } | ||
541 | // } | ||
542 | } | 530 | } |
531 | |||
532 | /* Will require for Multiple Drag n Drop */ | ||
533 | //length = length-1; | ||
534 | //index = i; | ||
535 | //if(length>0) { | ||
536 | //while(layersDraggedArray[length]) { | ||
537 | //documentRoot.children[index].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[k].nextSibling); | ||
538 | //length--; | ||
539 | //index++; | ||
540 | //} | ||
541 | //} | ||
543 | } | 542 | } |
544 | } | 543 | } |
545 | } | 544 | } |
546 | 545 | } | |
547 | |||
548 | |||
549 | |||
550 | //-------------------------------------------------------------------------------------------------------- | ||
551 | |||
552 | }); \ No newline at end of file | 546 | }); \ No newline at end of file |