Browse Source

fix browserless image generation by checking for window.matchMedia

for generateImages_browserless and for visual regression tests
sschmid 4 years ago
parent
commit
a567424df2
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Display/WebDisplayInteractionManager.ts

+ 3 - 0
src/Display/WebDisplayInteractionManager.ts

@@ -37,6 +37,9 @@ export class WebDisplayInteractionManager extends AbstractDisplayInteractionMana
         if (("ontouchstart" in window) || (window as any).DocumentTouch) {
             return true;
         }
+        if (!window.matchMedia) {
+            return false; // if running browserless / in nodejs (generateImages / visual regression tests)
+        }
         // include the 'heartz' as a way to have a non matching MQ to help terminate the join
         // https://git.io/vznFH
         const prefixes: string[] = ["-webkit-", "-moz-", "-o-", "-ms-"];