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
calculateZoomAndRotate -> setZoomAndRotation
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -104,18 +104,18 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
// needs to be passive in order to work with Chromium
|
// needs to be passive in order to work with Chromium
|
||||||
this.focusLock.current.addEventListener('wheel', this.onWheel, { passive: false });
|
this.focusLock.current.addEventListener('wheel', this.onWheel, { passive: false });
|
||||||
// We want to recalculate zoom whenever the window's size changes
|
// We want to recalculate zoom whenever the window's size changes
|
||||||
window.addEventListener("resize", this.calculateZoomAndRotate);
|
window.addEventListener("resize", this.setZoomAndRotation);
|
||||||
// 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.calculateZoomAndRotate);
|
this.image.current.addEventListener("load", this.setZoomAndRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.focusLock.current.removeEventListener('wheel', this.onWheel);
|
this.focusLock.current.removeEventListener('wheel', this.onWheel);
|
||||||
window.removeEventListener("resize", this.calculateZoomAndRotate);
|
window.removeEventListener("resize", this.setZoomAndRotation);
|
||||||
this.image.current.removeEventListener("load", this.calculateZoomAndRotate);
|
this.image.current.removeEventListener("load", this.setZoomAndRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateZoomAndRotate = () => {
|
private setZoomAndRotation = () => {
|
||||||
const image = this.image.current;
|
const image = this.image.current;
|
||||||
const imageWrapper = this.imageWrapper.current;
|
const imageWrapper = this.imageWrapper.current;
|
||||||
|
|
||||||
@@ -203,13 +203,13 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
private onRotateCounterClockwiseClick = () => {
|
private onRotateCounterClockwiseClick = () => {
|
||||||
const cur = this.state.rotation;
|
const cur = this.state.rotation;
|
||||||
this.rotation = cur - 90;
|
this.rotation = cur - 90;
|
||||||
this.calculateZoomAndRotate();
|
this.setZoomAndRotation();
|
||||||
};
|
};
|
||||||
|
|
||||||
private onRotateClockwiseClick = () => {
|
private onRotateClockwiseClick = () => {
|
||||||
const cur = this.state.rotation;
|
const cur = this.state.rotation;
|
||||||
this.rotation = cur + 90;
|
this.rotation = cur + 90;
|
||||||
this.calculateZoomAndRotate();
|
this.setZoomAndRotation();
|
||||||
};
|
};
|
||||||
|
|
||||||
private onDownloadClick = () => {
|
private onDownloadClick = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user