Take panel height into account

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-07-22 21:52:36 +02:00
parent d421c3203f
commit 7c81526805
No known key found for this signature in database
GPG Key ID: 55C211A1226CB17D
1 changed files with 14 additions and 3 deletions

View File

@ -45,6 +45,8 @@ const ZOOM_COEFFICIENT = 0.0025;
// If we have moved only this much we can zoom
const ZOOM_DISTANCE = 10;
const PANEL_HEIGHT = 68;
interface IProps extends IDialogProps {
src: string; // the source of the image being displayed
name?: string; // the main title ('name') for the image
@ -91,8 +93,17 @@ export default class ImageView extends React.Component<IProps, IState> {
minZoom: MAX_SCALE,
maxZoom: MAX_SCALE,
rotation: 0,
translationX: thumbnailInfo?.positionX + (thumbnailInfo?.width / 2) - (UIStore.instance.windowWidth / 2),
translationY: thumbnailInfo?.positionY + (thumbnailInfo?.height / 2) - (UIStore.instance.windowHeight / 2),
translationX: (
thumbnailInfo?.positionX +
(thumbnailInfo?.width / 2) -
(UIStore.instance.windowWidth / 2)
),
translationY: (
thumbnailInfo?.positionY +
(thumbnailInfo?.height / 2) -
(UIStore.instance.windowHeight / 2) -
(PANEL_HEIGHT / 2)
),
moving: false,
contextMenuDisplayed: false,
};
@ -125,7 +136,7 @@ export default class ImageView extends React.Component<IProps, IState> {
this.image.current.removeEventListener("load", this.imageLoaded);
}
private imageLoaded =() => {
private imageLoaded = () => {
this.setZoomAndRotation();
this.setState({
translationX: 0,