summaryrefslogtreecommitdiff
path: root/src/client/scripts
diff options
context:
space:
mode:
authorXeltica <7106976+Xeltica@users.noreply.github.com>2020-07-12 00:39:45 +0900
committerGitHub <noreply@github.com>2020-07-12 00:39:45 +0900
commita0ea5776abfac250ff6d9aab6cb78ef5e361df5a (patch)
tree0b4b8b6e5377ee2d588c38288dc400f4848ae008 /src/client/scripts
parentPlugin system (#6479) (diff)
downloadsharkey-a0ea5776abfac250ff6d9aab6cb78ef5e361df5a.tar.gz
sharkey-a0ea5776abfac250ff6d9aab6cb78ef5e361df5a.tar.bz2
sharkey-a0ea5776abfac250ff6d9aab6cb78ef5e361df5a.zip
fix #6335 (#6507)
Diffstat (limited to 'src/client/scripts')
-rw-r--r--src/client/scripts/room/room.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/scripts/room/room.ts b/src/client/scripts/room/room.ts
index e73a951342..45ccd59b70 100644
--- a/src/client/scripts/room/room.ts
+++ b/src/client/scripts/room/room.ts
@@ -516,8 +516,8 @@ export class Room {
if (this.isTransformMode) return;
const rect = (ev.target as HTMLElement).getBoundingClientRect();
- const x = (((ev.clientX * window.devicePixelRatio) - rect.left) / this.canvas.width) * 2 - 1;
- const y = -(((ev.clientY * window.devicePixelRatio) - rect.top) / this.canvas.height) * 2 + 1;
+ const x = ((ev.clientX - rect.left) / rect.width) * 2 - 1;
+ const y = -((ev.clientY - rect.top) / rect.height) * 2 + 1;
const pos = new THREE.Vector2(x, y);
this.camera.updateMatrixWorld();
@@ -553,8 +553,8 @@ export class Room {
if (ev.target !== this.canvas || ev.button !== 0) return;
const rect = (ev.target as HTMLElement).getBoundingClientRect();
- const x = (((ev.clientX * window.devicePixelRatio) - rect.left) / this.canvas.width) * 2 - 1;
- const y = -(((ev.clientY * window.devicePixelRatio) - rect.top) / this.canvas.height) * 2 + 1;
+ const x = ((ev.clientX - rect.left) / rect.width) * 2 - 1;
+ const y = -((ev.clientY - rect.top) / rect.height) * 2 + 1;
const pos = new THREE.Vector2(x, y);
this.camera.updateMatrixWorld();