Skip to content
Snippets Groups Projects
Commit 05f95f17 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Scale drag position using renderers native size

parent 6f842d35
No related branches found
No related tags found
No related merge requests found
......@@ -69,9 +69,10 @@ class Stage extends React.Component {
this.rect = this.canvas.getBoundingClientRect();
}
getScratchCoords (x, y) {
const nativeSize = this.renderer.getNativeSize();
return [
x - (this.rect.width / 2),
y - (this.rect.height / 2)
(nativeSize[0] / this.rect.width) * (x - (this.rect.width / 2)),
(nativeSize[1] / this.rect.height) * (y - (this.rect.height / 2))
];
}
handleDoubleClick (e) {
......@@ -127,6 +128,7 @@ class Stage extends React.Component {
}
}
onMouseDown (e) {
this.updateRect();
const mousePosition = [e.clientX - this.rect.left, e.clientY - this.rect.top];
this.setState({
mouseDown: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment