diff --git a/lib/Draggable.js b/lib/Draggable.js index 74e68539..a7c01bba 100644 --- a/lib/Draggable.js +++ b/lib/Draggable.js @@ -179,14 +179,14 @@ class Draggable extends React.Component { // Set x/y if a new position is provided in props that is different than the previous. if ( position && - (!prevPropsPosition || + (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y ) ) { log('Draggable: getDerivedStateFromProps %j', {position, prevPropsPosition}); return { - x: position.x, - y: position.y, + x: position.x, + y: position.y, prevPropsPosition: {...position} }; } @@ -373,7 +373,7 @@ class Draggable extends React.Component { // Reuse the child provided // This makes it flexible to use whatever element is wanted (div, ul, etc) return ( - + {React.cloneElement(React.Children.only(children), { className: className, style: {...children.props.style, ...style}, diff --git a/lib/DraggableCore.js b/lib/DraggableCore.js index 62da91f3..e1ee7b34 100644 --- a/lib/DraggableCore.js +++ b/lib/DraggableCore.js @@ -110,7 +110,7 @@ export default class DraggableCore extends React.Component's events export function createDraggableData(draggable: Draggable, coreData: DraggableData): DraggableData { - const scale = draggable.props.scale; return { node: coreData.node, - x: draggable.state.x + (coreData.deltaX / scale), - y: draggable.state.y + (coreData.deltaY / scale), - deltaX: (coreData.deltaX / scale), - deltaY: (coreData.deltaY / scale), + x: draggable.state.x + coreData.deltaX, + y: draggable.state.y + coreData.deltaY, + deltaX: coreData.deltaX, + deltaY: coreData.deltaY, lastX: draggable.state.x, lastY: draggable.state.y };