From 6c61c52bd86c90ce16107a6381ff242de9032211 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 26 Apr 2012 10:12:58 -0700 Subject: Fixing duplicate layer bug --- js/mediators/drag-drop-mediator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/mediators') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index eedab8fc..12f8dc70 100755 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -133,7 +133,7 @@ exports.DragDropMediator = Montage.create(Component, { 'left' : (parseInt(e.currentTarget.filePosition.x) - parseInt(this.application.ninja.stage.userContentLeft)) + 'px' }; // - self.application.ninja.elementMediator.addElements(element, rules); + //self.application.ninja.elementMediator.addElements(element, rules); } else { //TODO: HANDLE ERROR ON SAVING FILE TO BE ADDED AS ELEMENT } -- cgit v1.2.3 From 7f5eb2105c2e5e0970072af88fa90baded7e55d6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 26 Apr 2012 11:05:24 -0700 Subject: Fixing duplicate layer error --- js/mediators/drag-drop-mediator.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index 12f8dc70..b0aba5b6 100755 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -115,25 +115,25 @@ exports.DragDropMediator = Montage.create(Component, { // if (e.currentTarget.fileType.indexOf('svg') !== -1) { element = NJUtils.makeNJElement('embed', 'SVG', 'block');//TODO: Verify this is proper + element.type = 'image/svg+xml'; element.src = url+'/'+fileName; - element.type = 'image/svg+xml'; } else { element = NJUtils.makeNJElement('image', 'image', 'image'); element.src = url+'/'+fileName; } - //TODO: Remove temp fix for elements to redraw on drop - + //Adding element once it is loaded element.onload = function () { - self.application.ninja.elementMediator.addElements(element, rules); + element.onload = null; + self.application.ninja.elementMediator.addElements(element, rules, true); }; - // + //Setting rules of element rules = { 'position': 'absolute', 'top' : (parseInt(e.currentTarget.filePosition.y) - parseInt(this.application.ninja.stage.userContentTop)) + 'px', 'left' : (parseInt(e.currentTarget.filePosition.x) - parseInt(this.application.ninja.stage.userContentLeft)) + 'px' }; - // - //self.application.ninja.elementMediator.addElements(element, rules); + // + self.application.ninja.elementMediator.addElements(element, rules, false); } else { //TODO: HANDLE ERROR ON SAVING FILE TO BE ADDED AS ELEMENT } -- cgit v1.2.3