From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- js/mediators/drag-drop-mediator.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 js/mediators/drag-drop-mediator.js (limited to 'js/mediators/drag-drop-mediator.js') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js old mode 100644 new mode 100755 -- cgit v1.2.3 From 0eb739ab722ea768ab0fa1c5de0ee09ed1a576ea Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 14 Feb 2012 00:25:45 -0800 Subject: Add support for drag and drop for the components. Signed-off-by: Valerio Virgillito --- js/mediators/drag-drop-mediator.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (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 ede71383..bf22aed2 100644 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -24,6 +24,10 @@ exports.DragDropMediator = Montage.create(Component, { writable: true }, + dropDelegate: { + value: null + }, + deserializedFromTemplate: { value: function() { this.eventManager.addEventListener("appLoaded", this, false); @@ -69,13 +73,14 @@ exports.DragDropMediator = Montage.create(Component, { xferString = evt.dataTransfer.getData("text/plain"); if(xferString) { - - if(xferString.lastIndexOf("-Component") !== -1) { - component = xferString.substring(0, xferString.lastIndexOf("-Component")); - NJevent( "executeAddComponent", { "component": component, "dropX": this.baseX, "dropY": this.baseY }); -// ComponentPanelModule.ComponentsPanelBase.addComponentToStage(componentStr.substring(0, compInd), this.baseX, this.baseY); + // 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(this.baseX, this.baseY); + return; + } } - return; + } // Verify that browser supports FileReader API. -- cgit v1.2.3