diff --git a/src/components/big_picture.tsx b/src/components/big_picture.tsx index 715b84e..1c546a2 100644 --- a/src/components/big_picture.tsx +++ b/src/components/big_picture.tsx @@ -12,12 +12,12 @@ export interface Props { } interface TouchStart { - x: number; - y: number; + x: number; + y: number; } export interface State { - touchStart?: TouchStart | null; + touchStart?: TouchStart | null; } export class BigPicture extends React.PureComponent { @@ -85,24 +85,24 @@ export class BigPicture extends React.PureComponent { }; private _onTouchStart = (e: React.TouchEvent) => { - const touch = e.touches[0]; - this.setState({ touchStart: { x: touch.screenX, y: touch.screenY }}); - } + const touch = e.touches[0]; + this.setState({ touchStart: { x: touch.screenX, y: touch.screenY } }); + }; private _onTouchEnd = (e: React.TouchEvent) => { - const touch = e.changedTouches[0]; - const touchStart = this.state.touchStart as TouchStart; + const touch = e.changedTouches[0]; + const touchStart = this.state.touchStart as TouchStart; - const dx = touch.screenX - touchStart.x; + const dx = touch.screenX - touchStart.x; - if (Math.abs(dx) / window.innerWidth > 0.05) { - if (dx < 0) { - this.props.showNext(); - } else { - this.props.showPrevious(); - } + if (Math.abs(dx) / window.innerWidth > 0.05) { + if (dx < 0) { + this.props.showNext(); + } else { + this.props.showPrevious(); } + } - this.setState({ touchStart: null }); - } + this.setState({ touchStart: null }); + }; } diff --git a/src/components/root.tsx b/src/components/root.tsx index 6ea1624..5e090df 100644 --- a/src/components/root.tsx +++ b/src/components/root.tsx @@ -192,18 +192,20 @@ export class Root extends React.PureComponent { }; private _showNextBigPicture = () => { - const images: Model.Image[] = this.state.selectedSet?.images as Model.Image[]; + const images: Model.Image[] = this.state.selectedSet + ?.images as Model.Image[]; const current = images.indexOf(this.state.selectedImage as Model.Image); const next = current + 1 >= images.length ? 0 : current + 1; this._onImageSelected(images[next]); - } + }; private _showPreviousBigPicture = () => { - const images: Model.Image[] = this.state.selectedSet?.images as Model.Image[]; + const images: Model.Image[] = this.state.selectedSet + ?.images as Model.Image[]; const current = images.indexOf(this.state.selectedImage as Model.Image); const previous = current - 1 < 0 ? images.length - 1 : current - 1; this._onImageSelected(images[previous]); - } + }; private _setGridHeight = (grid: number) => (height: number) => { if (this.state.gridHeights[grid] === height) {