Procházet zdrojové kódy

guard against zero window.devicePixelRatio

Alexander Rose před 3 roky
rodič
revize
6ae2121391
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      src/mol-gl/webgl/context.ts

+ 2 - 2
src/mol-gl/webgl/context.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -281,7 +281,7 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal
         gl,
         isWebGL2: isWebGL2(gl),
         get pixelRatio() {
-            const dpr = (typeof window !== 'undefined') ? window.devicePixelRatio : 1;
+            const dpr = (typeof window !== 'undefined') ? (window.devicePixelRatio || 1) : 1;
             return dpr * (props.pixelScale || 1);
         },