From d1243d98d2f517055437cc67e963528771aa4c4b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 16 Mar 2012 15:41:26 -0700 Subject: fixing the components drag and drop. Signed-off-by: Valerio Virgillito --- js/mediators/drag-drop-mediator.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/mediators/drag-drop-mediator.js') 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, { var i, files = e.dataTransfer.files, position = {x: e.offsetX, y: e.offsetY}, rootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), rootUri = this.application.ninja.documentController.documentHackReference.root; + + var xferString = e.dataTransfer.getData("text/plain"); + if(xferString) { + // If the drop is a component, call the delegate with the top,left coordinates + if(xferString.indexOf("componentDrop") > -1) { + if(this.dropDelegate && typeof this.dropDelegate === 'object') { + this.dropDelegate.handleComponentDrop(e.offsetX - this.application.ninja.stage.userContentLeft, e.offsetY - this.application.ninja.stage.userContentTop); + return; + } + } + } // for (i=0; files[i]; i++) { if (files[i].type.indexOf('image') !== -1) { -- cgit v1.2.3