diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-11-03 17:28:54 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-11-03 17:28:54 +0100 |
commit | cd675fbe18bbd9e8c6c0fe9ffb6b3037282cd6c9 (patch) | |
tree | 763163999f72fccbd0440f57d50cf3dca248422c /app/javascript/mastodon/features/ui/components/media_modal.js | |
parent | b8e790c3c22693271a4fd74ce34067c462ebf8a3 (diff) | |
parent | f645dad661ba033efdcdd6ca7597e7b8bc7f4f51 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/media_modal.js')
-rw-r--r-- | app/javascript/mastodon/features/ui/components/media_modal.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/ui/components/media_modal.js b/app/javascript/mastodon/features/ui/components/media_modal.js index 54ec51fcf..d18f26b4e 100644 --- a/app/javascript/mastodon/features/ui/components/media_modal.js +++ b/app/javascript/mastodon/features/ui/components/media_modal.js @@ -38,23 +38,39 @@ class MediaModal extends ImmutablePureComponent { state = { index: null, navigationHidden: false, + zoomButtonHidden: false, }; handleSwipe = (index) => { this.setState({ index: index % this.props.media.size }); } + handleTransitionEnd = () => { + this.setState({ + zoomButtonHidden: false, + }); + } + handleNextClick = () => { - this.setState({ index: (this.getIndex() + 1) % this.props.media.size }); + this.setState({ + index: (this.getIndex() + 1) % this.props.media.size, + zoomButtonHidden: true, + }); } handlePrevClick = () => { - this.setState({ index: (this.props.media.size + this.getIndex() - 1) % this.props.media.size }); + this.setState({ + index: (this.props.media.size + this.getIndex() - 1) % this.props.media.size, + zoomButtonHidden: true, + }); } handleChangeIndex = (e) => { const index = Number(e.currentTarget.getAttribute('data-index')); - this.setState({ index: index % this.props.media.size }); + this.setState({ + index: index % this.props.media.size, + zoomButtonHidden: true, + }); } handleKeyDown = (e) => { @@ -149,6 +165,7 @@ class MediaModal extends ImmutablePureComponent { alt={image.get('description')} key={image.get('url')} onClick={this.toggleNavigation} + zoomButtonHidden={this.state.zoomButtonHidden} /> ); } else if (image.get('type') === 'video') { @@ -212,6 +229,7 @@ class MediaModal extends ImmutablePureComponent { style={swipeableViewsStyle} containerStyle={containerStyle} onChangeIndex={this.handleSwipe} + onTransitionEnd={this.handleTransitionEnd} index={index} disabled={disableSwiping} > |