File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
packages/feedback/src/screenshot/components Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -87,24 +87,26 @@ export function ScreenshotEditorFactory({
87
87
const [ isAnnotating , setIsAnnotating ] = hooks . useState ( false ) ;
88
88
89
89
hooks . useEffect ( ( ) => {
90
- WINDOW . addEventListener ( 'resize' , resize , false ) ;
90
+ WINDOW . addEventListener ( 'resize' , resize ) ;
91
91
92
92
return ( ) => {
93
- WINDOW . removeEventListener ( 'resize' , resize , false ) ;
93
+ WINDOW . removeEventListener ( 'resize' , resize ) ;
94
94
} ;
95
95
} , [ ] ) ;
96
96
97
97
function resizeCanvas ( canvasRef : Hooks . Ref < HTMLCanvasElement > , imageDimensions : Rect ) : void {
98
98
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 ) ;
108
110
}
109
111
}
110
112
You can’t perform that action at this time.
0 commit comments