Try to precalculate the zoom from width and height props
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
b741b3112a
commit
dbca370497
|
@ -108,6 +108,8 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
window.addEventListener("resize", this.calculateZoom);
|
window.addEventListener("resize", this.calculateZoom);
|
||||||
// After the image loads for the first time we want to calculate the zoom
|
// After the image loads for the first time we want to calculate the zoom
|
||||||
this.image.current.addEventListener("load", this.calculateZoom);
|
this.image.current.addEventListener("load", this.calculateZoom);
|
||||||
|
// Try to precalculate the zoom from width and height props
|
||||||
|
this.calculateZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
Loading…
Reference in New Issue