Quit on empty panel click

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-02-24 13:02:25 +01:00
parent 3e408b3fcd
commit 7cd8f1135b
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 17 additions and 8 deletions

View File

@ -123,19 +123,25 @@ export default class ImageView extends React.Component {
}); });
}; };
onRotateCounterClockwiseClick = () => { onRotateCounterClockwiseClick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
const cur = this.state.rotation; const cur = this.state.rotation;
const rotationDegrees = (cur - 90) % 360; const rotationDegrees = (cur - 90) % 360;
this.setState({ rotation: rotationDegrees }); this.setState({ rotation: rotationDegrees });
}; };
onRotateClockwiseClick = () => { onRotateClockwiseClick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
const cur = this.state.rotation; const cur = this.state.rotation;
const rotationDegrees = (cur + 90) % 360; const rotationDegrees = (cur + 90) % 360;
this.setState({ rotation: rotationDegrees }); this.setState({ rotation: rotationDegrees });
}; };
onZoomInClick = () => { onZoomInClick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
if (this.state.zoom >= this.maxZoom) { if (this.state.zoom >= this.maxZoom) {
this.setState({zoom: this.maxZoom}); this.setState({zoom: this.maxZoom});
return; return;
@ -146,7 +152,9 @@ export default class ImageView extends React.Component {
}); });
}; };
onZoomOutClick = () => { onZoomOutClick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
if (this.state.zoom <= this.minZoom) { if (this.state.zoom <= this.minZoom) {
this.setState({ this.setState({
zoom: this.minZoom, zoom: this.minZoom,
@ -160,6 +168,10 @@ export default class ImageView extends React.Component {
}); });
} }
onPanelClick = (ev) => {
this.props.onFinished();
}
onStartMoving = ev => { onStartMoving = ev => {
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();
@ -235,10 +247,7 @@ export default class ImageView extends React.Component {
ref={ref => this.focusLock = ref} ref={ref => this.focusLock = ref}
> >
<div className="mx_ImageView_content"> <div className="mx_ImageView_content">
<div className="mx_ImageView_panel"> <div className="mx_ImageView_panel" onClick={this.onPanelClick}>
<div className="mx_ImageView_label">
{ metadata }
</div>
<div className="mx_ImageView_toolbar"> <div className="mx_ImageView_toolbar">
<div className="mx_ImageView_toolbar_buttons"> <div className="mx_ImageView_toolbar_buttons">