aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorArmen Kesablyan2012-03-07 14:33:09 -0800
committerArmen Kesablyan2012-03-07 14:33:09 -0800
commitd18d91946627c53c646a6f167855551a1891f8f4 (patch)
tree6c3329546e083ed4fc30145eca4e5121d04efa0b /js/panels
parente3a5626b21ac8b906638bed9eb96aca5fadd26d8 (diff)
downloadninja-d18d91946627c53c646a6f167855551a1891f8f4.tar.gz
Reordering and resizing now works
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/panels')
-rwxr-xr-xjs/panels/PanelContainer.reel/PanelContainer.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js
index 3da9b44c..b285b49d 100755
--- a/js/panels/PanelContainer.reel/PanelContainer.js
+++ b/js/panels/PanelContainer.reel/PanelContainer.js
@@ -47,6 +47,7 @@ exports.PanelContainer = Montage.create(Component, {
47 this['panel_'+i].flexible = p.flexible; 47 this['panel_'+i].flexible = p.flexible;
48 this['panel_'+i].modulePath = p.modulePath; 48 this['panel_'+i].modulePath = p.modulePath;
49 this['panel_'+i].moduleName = p.moduleName; 49 this['panel_'+i].moduleName = p.moduleName;
50 this['panel_'+i].index = i;
50 51
51 this.currentPanelState[p.name] = {}; 52 this.currentPanelState[p.name] = {};
52 this.currentPanelState.version = "1.0"; 53 this.currentPanelState.version = "1.0";
@@ -102,8 +103,21 @@ exports.PanelContainer = Montage.create(Component, {
102 103
103 if(draggedIndex !== droppedIndex) { 104 if(draggedIndex !== droppedIndex) {
104 // switch panels 105 // switch panels
105 this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element); 106 if (droppedIndex === draggedIndex +1) {
107 if(this.panels[droppedIndex].element.nextSibling) {
108 this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element.nextSibling);
109 } else {
110 return this.appendChild(this.panels[draggedIndex].element);
111 }
112 } else {
113
114 this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element);
115 }
116 var panelRemoved = this.panels.splice(draggedIndex, 1);
117 this.panels.splice(droppedIndex, 0, panelRemoved[0]);
118
106 } 119 }
120
107 } 121 }
108 }, 122 },
109 123
@@ -112,12 +126,12 @@ exports.PanelContainer = Montage.create(Component, {
112 var len = this.panels.length, setLocked = true; 126 var len = this.panels.length, setLocked = true;
113 127
114 for(var i = 0; i < len; i++) { 128 for(var i = 0; i < len; i++) {
115 if(this['panel_'+i] === panelActivated || panelActivated === null) { 129 if(this.panels[i] === panelActivated || panelActivated === null) {
116 setLocked = false; 130 setLocked = false;
117 } 131 }
118 132
119 this['panel_'+i].locked = setLocked; 133 this.panels[i].locked = setLocked;
120 this['panel_'+i].needsDraw = true; 134 this.panels[i].needsDraw = true;
121 } 135 }
122 } 136 }
123 }, 137 },