You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Don't try to use the event's metadata to calc the scale
That has lead to https://github.com/vector-im/element-web/issues/17184 Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -108,8 +108,6 @@ 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() {
|
||||||
@@ -122,8 +120,8 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
const image = this.image.current;
|
const image = this.image.current;
|
||||||
const imageWrapper = this.imageWrapper.current;
|
const imageWrapper = this.imageWrapper.current;
|
||||||
|
|
||||||
const width = this.props.width || image.naturalWidth;
|
const width = image.naturalWidth;
|
||||||
const height = this.props.height || image.naturalHeight;
|
const height = image.naturalHeight;
|
||||||
|
|
||||||
const zoomX = imageWrapper.clientWidth / width;
|
const zoomX = imageWrapper.clientWidth / width;
|
||||||
const zoomY = imageWrapper.clientHeight / height;
|
const zoomY = imageWrapper.clientHeight / height;
|
||||||
|
|||||||
Reference in New Issue
Block a user