소스 검색

guard against zero window.devicePixelRatio

Alexander Rose 3 년 전
부모
커밋
6ae2121391
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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);
         },