aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-16 15:41:26 -0700
committerValerio Virgillito2012-03-16 15:41:26 -0700
commitd1243d98d2f517055437cc67e963528771aa4c4b (patch)
tree1903375db7b84c4fe80170c0653d8d2181f38dda
parent8b6dc6097fbd974df5363a72756de649794363b6 (diff)
downloadninja-d1243d98d2f517055437cc67e963528771aa4c4b.tar.gz
fixing the components drag and drop.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-xjs/mediators/drag-drop-mediator.js11
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js2
2 files changed, 12 insertions, 1 deletions
diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js
index 3a965be5..8663b06e 100755
--- a/js/mediators/drag-drop-mediator.js
+++ b/js/mediators/drag-drop-mediator.js
@@ -60,6 +60,17 @@ exports.DragDropMediator = Montage.create(Component, {
60 var i, files = e.dataTransfer.files, position = {x: e.offsetX, y: e.offsetY}, 60 var i, files = e.dataTransfer.files, position = {x: e.offsetX, y: e.offsetY},
61 rootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), 61 rootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])),
62 rootUri = this.application.ninja.documentController.documentHackReference.root; 62 rootUri = this.application.ninja.documentController.documentHackReference.root;
63
64 var xferString = e.dataTransfer.getData("text/plain");
65 if(xferString) {
66 // If the drop is a component, call the delegate with the top,left coordinates
67 if(xferString.indexOf("componentDrop") > -1) {
68 if(this.dropDelegate && typeof this.dropDelegate === 'object') {
69 this.dropDelegate.handleComponentDrop(e.offsetX - this.application.ninja.stage.userContentLeft, e.offsetY - this.application.ninja.stage.userContentTop);
70 return;
71 }
72 }
73 }
63 // 74 //
64 for (i=0; files[i]; i++) { 75 for (i=0; files[i]; i++) {
65 if (files[i].type.indexOf('image') !== -1) { 76 if (files[i].type.indexOf('image') !== -1) {
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index b6bee37d..b4eec771 100755
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -118,7 +118,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
118 didCreate: { 118 didCreate: {
119 value: function() { 119 value: function() {
120 // Setup the drop delegate 120 // Setup the drop delegate
121// this.application.ninja.dragDropMediator.dropDelegate = this; 121 this.application.ninja.dragDropMediator.dropDelegate = this;
122 // Loop through the component and load the JSON data for them 122 // Loop through the component and load the JSON data for them
123 this._loadComponents(); 123 this._loadComponents();
124 } 124 }