diff options
author | ThibG <thib@sitedethib.com> | 2020-11-04 14:52:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 14:52:19 +0100 |
commit | 1f69ad798d9a42d8ec3df69ded7625524c5eb67c (patch) | |
tree | a8e0759e3f13bf13dabbb8a261cd1bdb2f3e1e1a /app/javascript/mastodon/features/ui/components/media_modal.js | |
parent | b8e790c3c22693271a4fd74ce34067c462ebf8a3 (diff) | |
parent | dc86d814d93b9bb564ab35728c6d9fb65d064ca3 (diff) |
Merge pull request #1450 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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} > |