deepsea 1 year ago
parent
commit
88a347d54d
1 changed files with 13 additions and 11 deletions
  1. 13 11
      src/store/modules/common/mutations.js

+ 13 - 11
src/store/modules/common/mutations.js

@@ -108,18 +108,20 @@ export default {
       setTimeout(() => {
         
         let mapDom = document.getElementsByClassName("ordinary-map-container")[0];
-          let style = getComputedStyle(mapDom);
-          let width = parseFloat(style.width);
-          let height = parseFloat(style.height);
-        window.renderWidth = width * 1.8;
-        window.renderHeight = height * 1.8;
+        let style = getComputedStyle(mapDom);
+        let width = parseFloat(style.width);
+        let height = parseFloat(style.height);
+
+        let ratio = devicePixelRatio - (devicePixelRatio / 10);
+        window.renderWidth = width * ratio;
+        window.renderHeight = height * ratio;
         window.sdkInstance.sceneRenderer.updateScreenSize(width, height);
-        element.width = (width * 2) * 1.8;
-        element.height = (height * 2) * 1.8;
-        element.style.width = (width * 1.8)+'px';
-        element.style.height = (height * 1.8)+'px';
-        element.style.marginLeft = ((width - (width * 1.8)) / 2) + 'px';
-        element.style.marginTop = ((height - (height * 1.8)) / 2) + 'px';
+        element.width = (width * 2) * ratio;
+        element.height = (height * 2) * ratio;
+        element.style.width = (width * ratio)+'px';
+        element.style.height = (height * ratio)+'px';
+        element.style.marginLeft = ((width - (width * ratio)) / 2) + 'px';
+        element.style.marginTop = ((height - (height * ratio)) / 2) + 'px';
         let playersmall = document.getElementById('playersmall')
         playersmall.appendChild(element)
         setTimeout(() => {