deepsea há 1 ano atrás
pai
commit
1ca65103bb
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      src/uwb-sample.js

+ 2 - 2
src/uwb-sample.js

@@ -801,8 +801,8 @@ export function uwbMain(domId, modelWidth, modelHeight, finalMode, callback) {
             let allWidth = parseFloat(housePlayer.style.width) + Math.abs(marginLeft);
             let allHeight = parseFloat(housePlayer.style.height) + Math.abs(marginTop);
 
-            mouse.x = ((event.clientX + Math.abs(marginLeft))  / width) * 2 - 1;
-            mouse.y = -((event.clientY + Math.abs(marginTop)) / height) * 2 + 1;
+            mouse.x = ((event.clientX + Math.abs(marginLeft))  / parseFloat(housePlayer.style.width)) * 2 - 1;
+            mouse.y = -((event.clientY + Math.abs(marginTop)) / parseFloat(housePlayer.style.height)) * 2 + 1;
           }