diff --git a/res/threejs/SolveSpaceControls.js b/res/threejs/SolveSpaceControls.js index cde7eb24..fbee7da2 100644 --- a/res/threejs/SolveSpaceControls.js +++ b/res/threejs/SolveSpaceControls.js @@ -155,8 +155,8 @@ SolvespaceControls = function(object, domElement) { switch (event.button) { case 0: - _rotateCur.set(event.screenX / window.devicePixelRatio, - event.screenY / window.devicePixelRatio); + _rotateCur.set(event.screenX, + event.screenY); _rotatePrev.copy(_rotateCur); document.addEventListener('mousemove', mousemove_rotate, false); document.addEventListener('mouseup', mouseup, false); @@ -184,8 +184,8 @@ SolvespaceControls = function(object, domElement) { } function mousemove_rotate(event) { - _rotateCur.set(event.screenX / window.devicePixelRatio, - event.screenY / window.devicePixelRatio); + _rotateCur.set(event.screenX, + event.screenY); var diff = new THREE.Vector2().subVectors(_rotateCur, _rotatePrev) .multiplyScalar(1 / object.zoomScale); object.rotate(-0.3 * Math.PI / 180 * diff.x * object.zoomScale, @@ -199,7 +199,7 @@ SolvespaceControls = function(object, domElement) { _offsetCur.set(event.screenX / window.devicePixelRatio, event.screenY / window.devicePixelRatio); var diff = new THREE.Vector2().subVectors(_offsetCur, _offsetPrev) - .multiplyScalar(1 / object.zoomScale); + .multiplyScalar(window.devicePixelRatio / object.zoomScale); object.offsetProj(diff.x, -diff.y); _changed = true; _offsetPrev.copy(_offsetCur); @@ -507,3 +507,4 @@ solvespace = function(obj, params) { return new THREE.LineSegments(geometry, material); } }; +