Try to precalculate the zoom from width and height props

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-04-26 13:48:14 +02:00 committed by J. Ryan Stinnett
parent ebe3b36528
commit 3716ec4a25
1 changed files with 2 additions and 0 deletions

View File

@ -108,6 +108,8 @@ export default class ImageView extends React.Component<IProps, IState> {
window.addEventListener("resize", this.calculateZoom);
// After the image loads for the first time we want to calculate the zoom
this.image.current.addEventListener("load", this.calculateZoom);
// Try to precalculate the zoom from width and height props
this.calculateZoom();
}
componentWillUnmount() {