Skip to content

Commit c7c8e3c

Browse files
committed
enforce max size, not just default max size
1 parent d439404 commit c7c8e3c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/replay-canvas/src/canvas.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,22 @@ const CANVAS_QUALITY = {
5555
};
5656

5757
const INTEGRATION_NAME = 'ReplayCanvas';
58+
const DEFAULT_MAX_CANVAS_SIZE = 1280;
5859

5960
/** Exported only for type safe tests. */
6061
export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions> = {}) => {
62+
const [maxCanvasWidth, maxCanvasHeight] = options.maxCanvasSize || [];
6163
const _canvasOptions = {
6264
quality: options.quality || 'medium',
6365
enableManualSnapshot: options.enableManualSnapshot,
64-
maxCanvasSize: options.maxCanvasSize || [1280, 1280],
66+
maxCanvasSize: [
67+
maxCanvasWidth ?
68+
Math.min(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE)
69+
: DEFAULT_MAX_CANVAS_SIZE,
70+
maxCanvasHeight ?
71+
Math.min(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE)
72+
: DEFAULT_MAX_CANVAS_SIZE
73+
],
6574
};
6675

6776
let canvasManagerResolve: (value: CanvasManager) => void;

0 commit comments

Comments
 (0)