diff options
author | Armen Kesablyan | 2012-02-22 16:26:41 -0800 |
---|---|---|
committer | Armen Kesablyan | 2012-02-22 16:26:41 -0800 |
commit | 0bd1cefea2ab350fad1a891bdc926053b799aafc (patch) | |
tree | 962f559fcc02a3dfeb297d59907e40fa153453f3 /js/mediators/drag-drop-mediator.js | |
parent | 695bc5082f48dddf66ce31480a4faefc067b38bd (diff) | |
parent | 2d2b1af8b5c0d506fe6a1cf65614101fec145970 (diff) | |
download | ninja-0bd1cefea2ab350fad1a891bdc926053b799aafc.tar.gz |
Merge branch 'refs/heads/master' into new-tool-icons
Diffstat (limited to 'js/mediators/drag-drop-mediator.js')
-rwxr-xr-x[-rw-r--r--] | js/mediators/drag-drop-mediator.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index ede71383..bf22aed2 100644..100755 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js | |||
@@ -24,6 +24,10 @@ exports.DragDropMediator = Montage.create(Component, { | |||
24 | writable: true | 24 | writable: true |
25 | }, | 25 | }, |
26 | 26 | ||
27 | dropDelegate: { | ||
28 | value: null | ||
29 | }, | ||
30 | |||
27 | deserializedFromTemplate: { | 31 | deserializedFromTemplate: { |
28 | value: function() { | 32 | value: function() { |
29 | this.eventManager.addEventListener("appLoaded", this, false); | 33 | this.eventManager.addEventListener("appLoaded", this, false); |
@@ -69,13 +73,14 @@ exports.DragDropMediator = Montage.create(Component, { | |||
69 | 73 | ||
70 | xferString = evt.dataTransfer.getData("text/plain"); | 74 | xferString = evt.dataTransfer.getData("text/plain"); |
71 | if(xferString) { | 75 | if(xferString) { |
72 | 76 | // If the drop is a component, call the delegate with the top,left coordinates | |
73 | if(xferString.lastIndexOf("-Component") !== -1) { | 77 | if(xferString.indexOf("componentDrop") > -1) { |
74 | component = xferString.substring(0, xferString.lastIndexOf("-Component")); | 78 | if(this.dropDelegate && typeof this.dropDelegate === 'object') { |
75 | NJevent( "executeAddComponent", { "component": component, "dropX": this.baseX, "dropY": this.baseY }); | 79 | this.dropDelegate.handleComponentDrop(this.baseX, this.baseY); |
76 | // ComponentPanelModule.ComponentsPanelBase.addComponentToStage(componentStr.substring(0, compInd), this.baseX, this.baseY); | 80 | return; |
81 | } | ||
77 | } | 82 | } |
78 | return; | 83 | |
79 | } | 84 | } |
80 | 85 | ||
81 | // Verify that browser supports FileReader API. | 86 | // Verify that browser supports FileReader API. |