From bb2130a0d6622f54cacd1f3ebd491a6edc5e5da8 Mon Sep 17 00:00:00 2001 From: rustico Date: Mon, 22 Jun 2015 16:29:23 -0300 Subject: [PATCH] Fix ngDragClone when the page scrolls - Fix the position of the ngDragClone element when the page is scrolled. --- ngDraggable.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ngDraggable.js b/ngDraggable.js index 1878aad..dcaaac1 100644 --- a/ngDraggable.js +++ b/ngDraggable.js @@ -197,7 +197,7 @@ angular.module("ngDraggable", []) moveElement(_tx, _ty); - $rootScope.$broadcast('draggable:move', { x: _mx, y: _my, tx: _tx, ty: _ty, event: evt, element: element, data: _data, uid: _myid }); + $rootScope.$broadcast('draggable:move', { x: _mx, y: _my, tx: _tx, ty: _ty, event: evt, element: element, data: _data, uid: _myid, dragOffset: _dragOffset }); }; var onrelease = function(evt) { @@ -421,13 +421,12 @@ angular.module("ngDraggable", []) moveElement(obj.tx, obj.ty); } - _dragOffset = element[0].getBoundingClientRect();//ngDraggable.getPrivOffset(element); }; var onDragMove = function(evt, obj) { if(_allowClone) { - _tx = obj.tx + _dragOffset.left; - _ty = obj.ty + _dragOffset.top; + _tx = obj.tx + obj.dragOffset.left; + _ty = obj.ty + obj.dragOffset.top; moveElement(_tx, _ty); }