mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 17:11:31 +03:00
Take panel height into account
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
d421c3203f
commit
7c81526805
1 changed files with 14 additions and 3 deletions
|
@ -45,6 +45,8 @@ const ZOOM_COEFFICIENT = 0.0025;
|
||||||
// If we have moved only this much we can zoom
|
// If we have moved only this much we can zoom
|
||||||
const ZOOM_DISTANCE = 10;
|
const ZOOM_DISTANCE = 10;
|
||||||
|
|
||||||
|
const PANEL_HEIGHT = 68;
|
||||||
|
|
||||||
interface IProps extends IDialogProps {
|
interface IProps extends IDialogProps {
|
||||||
src: string; // the source of the image being displayed
|
src: string; // the source of the image being displayed
|
||||||
name?: string; // the main title ('name') for the image
|
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,
|
minZoom: MAX_SCALE,
|
||||||
maxZoom: MAX_SCALE,
|
maxZoom: MAX_SCALE,
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
translationX: thumbnailInfo?.positionX + (thumbnailInfo?.width / 2) - (UIStore.instance.windowWidth / 2),
|
translationX: (
|
||||||
translationY: thumbnailInfo?.positionY + (thumbnailInfo?.height / 2) - (UIStore.instance.windowHeight / 2),
|
thumbnailInfo?.positionX +
|
||||||
|
(thumbnailInfo?.width / 2) -
|
||||||
|
(UIStore.instance.windowWidth / 2)
|
||||||
|
),
|
||||||
|
translationY: (
|
||||||
|
thumbnailInfo?.positionY +
|
||||||
|
(thumbnailInfo?.height / 2) -
|
||||||
|
(UIStore.instance.windowHeight / 2) -
|
||||||
|
(PANEL_HEIGHT / 2)
|
||||||
|
),
|
||||||
moving: false,
|
moving: false,
|
||||||
contextMenuDisplayed: false,
|
contextMenuDisplayed: false,
|
||||||
};
|
};
|
||||||
|
@ -125,7 +136,7 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
this.image.current.removeEventListener("load", this.imageLoaded);
|
this.image.current.removeEventListener("load", this.imageLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private imageLoaded =() => {
|
private imageLoaded = () => {
|
||||||
this.setZoomAndRotation();
|
this.setZoomAndRotation();
|
||||||
this.setState({
|
this.setState({
|
||||||
translationX: 0,
|
translationX: 0,
|
||||||
|
|
Loading…
Reference in a new issue