From eda07f5122cc552737fa6f647ef7f6721c4001b8 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 15 Mar 2012 20:16:25 -0700 Subject: Fixing offset bug for drag-and-drop --- js/mediators/drag-drop-mediator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index cc384704..c8e781a6 100755 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -112,8 +112,8 @@ exports.DragDropMediator = Montage.create(Component, { // rules = { 'position': 'absolute', - 'top' : e.currentTarget.filePosition.y + 'px', - 'left' : e.currentTarget.filePosition.x + 'px' + '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' }; // NJevent("elementAdding", {el: element, data: rules}); -- cgit v1.2.3 From a295375178659345e03517f7eb20c22364f4ca4a Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 15 Mar 2012 21:06:40 -0700 Subject: Temp fix for element dimensions (SVG) Added a temp fix to allow for a redraw of an SVG on load. --- js/mediators/drag-drop-mediator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index c8e781a6..9d5dd256 100755 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -105,6 +105,10 @@ exports.DragDropMediator = Montage.create(Component, { element = NJUtils.makeNJElement('embed', 'SVG', 'block');//TODO: Verify this is proper element.src = url+'/'+fileName; element.type = 'image/svg+xml'; + //TODO: Remove temp fix for SVG redraw on drop + element.onload = function () { + NJevent("elementAdding", {el: element, data: rules}); + } } else { element = NJUtils.makeNJElement('image', 'image', 'image'); element.src = url+'/'+fileName; @@ -114,9 +118,9 @@ exports.DragDropMediator = Montage.create(Component, { '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' - }; - // - NJevent("elementAdding", {el: element, data: rules}); + }; + // + NJevent("elementAdding", {el: element, data: rules}); } else { //TODO: HANDLE ERROR ON SAVING FILE TO BE ADDED AS ELEMENT } -- cgit v1.2.3