Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing drag issues caused when running in Chrome touch emulator #46

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions app/components/Caption.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions app/components/Edge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions app/components/Node.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -72,4 +72,4 @@
"<rootDir>/node_modules/"
]
}
}
}