aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/panels/PanelContainer.reel/PanelContainer.js22
-rw-r--r--js/panels/drag-drop-composer.js2
2 files changed, 14 insertions, 10 deletions
diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js
index 51bd2df9..dd720bd3 100755
--- a/js/panels/PanelContainer.reel/PanelContainer.js
+++ b/js/panels/PanelContainer.reel/PanelContainer.js
@@ -58,7 +58,7 @@ exports.PanelContainer = Montage.create(Component, {
58 this.currentPanelState[p.name].collapsed = this['panel_'+i].collapsed; 58 this.currentPanelState[p.name].collapsed = this['panel_'+i].collapsed;
59 59
60 // Check if current panel is open when feature is enabled 60 // Check if current panel is open when feature is enabled
61 this.panels.push(p); 61 this.panels.push(this['panel_'+i]);
62 } 62 }
63 63
64 this.application.localStorage.setItem("panels", this.currentPanelState); 64 this.application.localStorage.setItem("panels", this.currentPanelState);
@@ -87,20 +87,24 @@ exports.PanelContainer = Montage.create(Component, {
87 87
88 handleDropped: { 88 handleDropped: {
89 value: function(e) { 89 value: function(e) {
90 var draggedIndex, droppedIndex = 0; 90 var draggedIndex, droppedIndex = 0, len = this.panels.length;
91 for(var i = 0; i< this.repeater.childComponents.length; i++ ) { 91
92 if (this.repeater.childComponents[i] === e._event.draggedComponent) { 92// console.log(e._event.draggedComponent);
93 draggedIndex = i; 93 for(var i = 0; i < len; i++) {
94 if(this.panels[i].name === e._event.draggedComponent.name) {
95 draggedIndex = i; // Actual component being dragged
94 } 96 }
95 97
96 if (this.repeater.childComponents[i] === e._event.droppedComponent) { 98 if(this.panels[i].name === e._target.name) {
97 droppedIndex = i; 99 droppedIndex = i;
98 } 100 }
99 } 101 }
100 102
101 var panelRemoved = this.panelController.content.splice(draggedIndex,1); 103 if(draggedIndex !== droppedIndex) {
102 this.panelController.content.splice(droppedIndex,0, panelRemoved[0]); 104 // switch panels
103 //console.log(draggedIndex, droppedIndex); 105 this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element);
106 }
107
104 this._setPanelsSizes(null); 108 this._setPanelsSizes(null);
105 } 109 }
106 }, 110 },
diff --git a/js/panels/drag-drop-composer.js b/js/panels/drag-drop-composer.js
index e09f601d..b36c8334 100644
--- a/js/panels/drag-drop-composer.js
+++ b/js/panels/drag-drop-composer.js
@@ -10,7 +10,7 @@ var Composer = require("montage/ui/composer/composer").Composer;
10exports.DragDropComposer = Montage.create(Composer, { 10exports.DragDropComposer = Montage.create(Composer, {
11 11
12 draggable: { 12 draggable: {
13 value: false // TODO: Turning this off until color Panel bug fixes are in 13 value: true
14 }, 14 },
15 15
16 droppable: { 16 droppable: {