Merge pull request #5872 from SimonBrandner/new-image-view-fixes

New Image View fixes/improvements
pull/21833/head
J. Ryan Stinnett 2021-04-19 17:37:42 +01:00 committed by GitHub
commit 2d1615e433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,7 @@ const MAX_ZOOM = 300;
// This is used for the buttons
const ZOOM_STEP = 10;
// This is used for mouse wheel events
const ZOOM_COEFFICIENT = 10;
const ZOOM_COEFFICIENT = 7.5;
// If we have moved only this much we can zoom
const ZOOM_DISTANCE = 10;
@ -209,6 +209,10 @@ export default class ImageView extends React.Component<IProps, IState> {
ev.stopPropagation();
ev.preventDefault();
// Don't do anything if we pressed any
// other button than the left one
if (ev.button !== 0) return;
// Zoom in if we are completely zoomed out
if (this.state.zoom === MIN_ZOOM) {
this.setState({zoom: MAX_ZOOM});