Get rid of onWindowResize()
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
							parent
							
								
									f8af9831a9
								
							
						
					
					
						commit
						57b34f8dbc
					
				|  | @ -104,7 +104,7 @@ export default class ImageView extends React.Component<IProps, IState> { | |||
|         // We have to use addEventListener() because the listener
 | ||||
|         // needs to be passive in order to work with Chromium
 | ||||
|         this.focusLock.current.addEventListener('wheel', this.onWheel, { passive: false }); | ||||
|         window.addEventListener("resize", this.onWindowResize); | ||||
|         window.addEventListener("resize", this.calculateZoom); | ||||
|         this.calculateZoom(); | ||||
|     } | ||||
| 
 | ||||
|  | @ -112,11 +112,7 @@ export default class ImageView extends React.Component<IProps, IState> { | |||
|         this.focusLock.current.removeEventListener('wheel', this.onWheel); | ||||
|     } | ||||
| 
 | ||||
|     private onWindowResize = (ev) => { | ||||
|         this.calculateZoom(); | ||||
|     } | ||||
| 
 | ||||
|     private calculateZoom() { | ||||
|     private calculateZoom = () => { | ||||
|         // TODO: What if we don't have width and height props?
 | ||||
| 
 | ||||
|         const imageWrapper = document.getElementsByClassName(IMAGE_WRAPPER_CLASS)[0]; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Šimon Brandner
						Šimon Brandner