Skip to content

Commit fa65a20

Browse files
committed
PR comments
1 parent c4492d2 commit fa65a20

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/feedback/src/screenshot/components/ScreenshotEditor.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,26 @@ export function ScreenshotEditorFactory({
8787
const [isAnnotating, setIsAnnotating] = hooks.useState(false);
8888

8989
hooks.useEffect(() => {
90-
WINDOW.addEventListener('resize', resize, false);
90+
WINDOW.addEventListener('resize', resize);
9191

9292
return () => {
93-
WINDOW.removeEventListener('resize', resize, false);
93+
WINDOW.removeEventListener('resize', resize);
9494
};
9595
}, []);
9696

9797
function resizeCanvas(canvasRef: Hooks.Ref<HTMLCanvasElement>, imageDimensions: Rect): void {
9898
const canvas = canvasRef.current;
99-
if (canvas) {
100-
canvas.width = imageDimensions.width * DPI;
101-
canvas.height = imageDimensions.height * DPI;
102-
canvas.style.width = `${imageDimensions.width}px`;
103-
canvas.style.height = `${imageDimensions.height}px`;
104-
const ctx = canvas.getContext('2d');
105-
if (ctx) {
106-
ctx.scale(DPI, DPI);
107-
}
99+
if (!canvas) {
100+
return;
101+
}
102+
103+
canvas.width = imageDimensions.width * DPI;
104+
canvas.height = imageDimensions.height * DPI;
105+
canvas.style.width = `${imageDimensions.width}px`;
106+
canvas.style.height = `${imageDimensions.height}px`;
107+
const ctx = canvas.getContext('2d');
108+
if (ctx) {
109+
ctx.scale(DPI, DPI);
108110
}
109111
}
110112

0 commit comments

Comments
 (0)