From 498235bf9b39a6b0cbde9f1d3931087883b8af3b Mon Sep 17 00:00:00 2001 From: Catherine Lee <55311782+c298lee@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:02:44 -0500 Subject: [PATCH 1/2] rename isManualSnapshot to enableManualSnapshot --- .../rrweb/src/record/observers/canvas/canvas-manager.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts index 9af8c3b2f9..2318023fb6 100644 --- a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts +++ b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts @@ -40,7 +40,7 @@ export interface CanvasManagerInterface { export interface CanvasManagerConstructorOptions { recordCanvas: boolean; - isManualSnapshot?: boolean; + enableManualSnapshot?: boolean; mutationCb: canvasMutationCallback; win: IWindow; blockClass: blockClass; @@ -118,7 +118,7 @@ export class CanvasManager implements CanvasManagerInterface { this.mirror = options.mirror; this.options = options; - if (options.isManualSnapshot) { + if (options.enableManualSnapshot) { return; } @@ -235,6 +235,7 @@ export class CanvasManager implements CanvasManagerInterface { } public snapshot(canvasElement?: HTMLCanvasElement) { + console.log('manual snapshot'); const { options } = this; const rafId = this.takeSnapshot( true, @@ -253,7 +254,7 @@ export class CanvasManager implements CanvasManagerInterface { } private takeSnapshot( - isManualSnapshot: boolean, + enableManualSnapshot: boolean, fps: number, win: IWindow, blockClass: blockClass, @@ -338,7 +339,7 @@ export class CanvasManager implements CanvasManagerInterface { if (snapshotInProgressMap.get(id)) return; snapshotInProgressMap.set(id, true); if ( - !isManualSnapshot && + !enableManualSnapshot && ['webgl', 'webgl2'].includes((canvas as ICanvas).__context) ) { // if the canvas hasn't been modified recently, From cdc7ceb2b09aa03c3e1652e8b46ad17652bd4394 Mon Sep 17 00:00:00 2001 From: Catherine Lee <55311782+c298lee@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:14:25 -0500 Subject: [PATCH 2/2] comments --- packages/rrweb/src/record/observers/canvas/canvas-manager.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts index 2318023fb6..276b1e9c00 100644 --- a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts +++ b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts @@ -235,7 +235,6 @@ export class CanvasManager implements CanvasManagerInterface { } public snapshot(canvasElement?: HTMLCanvasElement) { - console.log('manual snapshot'); const { options } = this; const rafId = this.takeSnapshot( true, @@ -254,7 +253,7 @@ export class CanvasManager implements CanvasManagerInterface { } private takeSnapshot( - enableManualSnapshot: boolean, + isManualSnapshot: boolean, fps: number, win: IWindow, blockClass: blockClass, @@ -339,7 +338,7 @@ export class CanvasManager implements CanvasManagerInterface { if (snapshotInProgressMap.get(id)) return; snapshotInProgressMap.set(id, true); if ( - !enableManualSnapshot && + !isManualSnapshot && ['webgl', 'webgl2'].includes((canvas as ICanvas).__context) ) { // if the canvas hasn't been modified recently,