Fix object detection under mouse.

This commit is contained in:
Viktor Kovacs 2021-05-05 08:09:08 +02:00
parent 00c2f14dfa
commit 7b7a989b1e

View File

@ -347,7 +347,13 @@ OV.Viewer = class
GetMeshUserDataUnderMouse (mouseCoords)
{
let mesh = this.geometry.GetModelMeshUnderMouse (mouseCoords, this.camera, this.canvas.width, this.canvas.height);
let width = this.canvas.width;
let height = this.canvas.height;
if (window.devicePixelRatio) {
width /= window.devicePixelRatio;
height /= window.devicePixelRatio;
}
let mesh = this.geometry.GetModelMeshUnderMouse (mouseCoords, this.camera, width, height);
if (mesh === null) {
return null;
}