Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Enable user to zoom beyond image size #5949

Merged
merged 9 commits into from
Nov 3, 2022
6 changes: 4 additions & 2 deletions src/components/views/elements/ImageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export default class ImageView extends React.Component<IProps, IState> {

componentWillUnmount() {
this.focusLock.current.removeEventListener('wheel', this.onWheel);
window.removeEventListener("resize", this.calculateZoom);
this.image.current.removeEventListener("load", this.calculateZoom);
jryans marked this conversation as resolved.
Show resolved Hide resolved
}

private calculateZoom = () => {
Expand Down Expand Up @@ -159,8 +161,8 @@ export default class ImageView extends React.Component<IProps, IState> {
});
return;
}
if (newZoom >= this.state.maxZoom) {
this.setState({zoom: this.state.maxZoom});
if (newZoom >= 2 * this.state.maxZoom) {
this.setState({zoom: 2 * this.state.maxZoom});
jaiwanth-v marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand Down