diff --git a/app/components/Caption.jsx b/app/components/Caption.jsx index a8b2ad5..9dc51a7 100644 --- a/app/components/Caption.jsx +++ b/app/components/Caption.jsx @@ -80,7 +80,7 @@ export default class Caption extends BaseComponent { _handleDragStart(e, ui) { e.preventDefault(); - this._startDrag = ui.position; + this._startDrag = ui; this._startPosition = { x: this.state.x, y: this.state.y @@ -92,8 +92,8 @@ export default class Caption extends BaseComponent { this._dragging = true; - let deltaX = (ui.position.clientX - this._startDrag.clientX) / this.graph.state.actualZoom; - let deltaY = (ui.position.clientY - this._startDrag.clientY) / this.graph.state.actualZoom; + let deltaX = (ui.x - this._startDrag.x) / this.graph.state.actualZoom; + let deltaY = (ui.y - this._startDrag.y) / this.graph.state.actualZoom; let x = this._startPosition.x + deltaX; let y = this._startPosition.y + deltaY; diff --git a/app/components/Edge.jsx b/app/components/Edge.jsx index 4b7aecd..3c5b5ab 100644 --- a/app/components/Edge.jsx +++ b/app/components/Edge.jsx @@ -87,7 +87,7 @@ export default class Edge extends BaseComponent { _handleDragStart(event, ui) { event.preventDefault(); - this._startDrag = ui.position; + this._startDrag = ui; this._startPosition = { x: this.state.cx, y: this.state.cy @@ -100,8 +100,8 @@ export default class Edge extends BaseComponent { this._dragging = true; // so that _handleClick knows it's not just a click let e = this.props.edge; - let deltaX = (ui.position.clientX - this._startDrag.clientX) / this.graph.state.actualZoom; - let deltaY = (ui.position.clientY - this._startDrag.clientY) / this.graph.state.actualZoom; + let deltaX = (ui.x - this._startDrag.x) / this.graph.state.actualZoom; + let deltaY = (ui.y - this._startDrag.y) / this.graph.state.actualZoom; let cx = this._startPosition.x + deltaX; let cy = this._startPosition.y + deltaY; diff --git a/app/components/Node.jsx b/app/components/Node.jsx index 711f067..7daa32f 100644 --- a/app/components/Node.jsx +++ b/app/components/Node.jsx @@ -54,7 +54,7 @@ export default class Node extends BaseComponent { // keep initial position for comparison with drag position _handleDragStart(e, ui) { e.preventDefault(); - this._startDrag = ui.position; + this._startDrag = ui; this._startPosition = { x: this.state.x, y: this.state.y @@ -68,8 +68,8 @@ export default class Node extends BaseComponent { this._dragging = true; // so that _handleClick knows it's not just a click let n = this.props.node; - let deltaX = (ui.position.clientX - this._startDrag.clientX) / this.graph.state.actualZoom; - let deltaY = (ui.position.clientY - this._startDrag.clientY) / this.graph.state.actualZoom; + let deltaX = (ui.x - this._startDrag.x) / this.graph.state.actualZoom; + let deltaY = (ui.y - this._startDrag.y) / this.graph.state.actualZoom; let x = this._startPosition.x + deltaX; let y = this._startPosition.y + deltaY; diff --git a/package.json b/package.json index 265fde5..1cc2259 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "react-anything-sortable": "^1.1.0", "react-color": "^2.0.0", "react-dom": "^0.14.8", - "react-draggable": "^1.0.1", + "react-draggable": "^2.0.2", "react-hotkeys": "^0.6.0", "react-medium-editor": "^1.6.1", "react-redux": "^4.0.0", @@ -72,4 +72,4 @@ "/node_modules/" ] } -} +} \ No newline at end of file