From 8c57a575424a9524024704660cfc36002511ab42 Mon Sep 17 00:00:00 2001 From: Reinder Nijhoff Date: Thu, 21 Dec 2023 14:17:41 +0100 Subject: [PATCH] Remove DOM references from default values to support server side imports --- src/lib/ImageEffectRenderer.ts | 2 +- src/lib/RendererBuffer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ImageEffectRenderer.ts b/src/lib/ImageEffectRenderer.ts index 65515d4..e5eb2c2 100644 --- a/src/lib/ImageEffectRenderer.ts +++ b/src/lib/ImageEffectRenderer.ts @@ -21,7 +21,7 @@ export default class ImageEffectRenderer { public static defaultOptions: ImageEffectRendererOptions = { loop: false, autoResize: true, - pixelRatio: window.devicePixelRatio, + pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio : 1, useSharedContext: true, asyncCompile: true, }; diff --git a/src/lib/RendererBuffer.ts b/src/lib/RendererBuffer.ts index bf2e22c..90b2d7e 100644 --- a/src/lib/RendererBuffer.ts +++ b/src/lib/RendererBuffer.ts @@ -11,7 +11,7 @@ export class RendererBuffer extends Renderer { ...Renderer.defaultImageOptions, useMipmap: false, useCache: false, - type: WebGLRenderingContext.UNSIGNED_BYTE, + type: 5121, // WebGLRenderingContext.UNSIGNED_BYTE, }; public options: BufferOptions;