Skip to content

Commit

Permalink
enforce max size, not just default max size
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Apr 18, 2024
1 parent d439404 commit 77c675d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/replay-canvas/src/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,22 @@ const CANVAS_QUALITY = {
};

const INTEGRATION_NAME = 'ReplayCanvas';
const DEFAULT_MAX_CANVAS_SIZE = 1280;

/** Exported only for type safe tests. */
export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions> = {}) => {
const [maxCanvasWidth, maxCanvasHeight] = options.maxCanvasSize || [];
const _canvasOptions = {
quality: options.quality || 'medium',
enableManualSnapshot: options.enableManualSnapshot,
maxCanvasSize: options.maxCanvasSize || [1280, 1280],
maxCanvasSize: [
maxCanvasWidth ?
Math.max(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE)
: DEFAULT_MAX_CANVAS_SIZE,
maxCanvasHeight ?
Math.max(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE)
: DEFAULT_MAX_CANVAS_SIZE
],
};

let canvasManagerResolve: (value: CanvasManager) => void;
Expand Down

0 comments on commit 77c675d

Please sign in to comment.