diff options
Diffstat (limited to 'js/panels/PanelContainer.reel/PanelContainer.js')
-rwxr-xr-x | js/panels/PanelContainer.reel/PanelContainer.js | 22 |
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 | }, |