Merge pull request #472 from gfrenoy/master

Support for arrow keys when display medias
This commit is contained in:
AkiraFukushima 2018-08-07 00:07:58 +09:00 committed by GitHub
commit 3211c79c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@
<el-button type="text" icon="el-icon-close" @click="close" class="close-button"></el-button> <el-button type="text" icon="el-icon-close" @click="close" class="close-button"></el-button>
</div> </div>
<div class="image-content"> <div class="image-content">
<span class="button-area"><el-button type="text" v-show="showLeft"><i class="el-icon-arrow-left" @click.stop="decrementIndex"></i></el-button></span> <span class="button-area"><el-button type="text" v-show="showLeft" v-shortkey="['arrowleft']" @shortkey.native="decrementIndex()"><i class="el-icon-arrow-left" @click.stop="decrementIndex"></i></el-button></span>
<Media :src="imageURL"></Media> <Media :src="imageURL"></Media>
<span class="button-area"><el-button type="text" v-show="showRight"><i class="el-icon-arrow-right" @click.stop="incrementIndex"></i></el-button></span> <span class="button-area"><el-button type="text" v-show="showRight" v-shortkey="['arrowright']" @shortkey.native="incrementIndex()"><i class="el-icon-arrow-right" @click.stop="incrementIndex"></i></el-button></span>
</div> </div>
</div> </div>
</div> </div>
@ -48,10 +48,10 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/ImageViewer/closeModal') this.$store.dispatch('TimelineSpace/Modals/ImageViewer/closeModal')
}, },
decrementIndex () { decrementIndex () {
this.$store.dispatch('TimelineSpace/Modals/ImageViewer/decrementIndex') if (this.showLeft) this.$store.dispatch('TimelineSpace/Modals/ImageViewer/decrementIndex')
}, },
incrementIndex () { incrementIndex () {
this.$store.dispatch('TimelineSpace/Modals/ImageViewer/incrementIndex') if (this.showRight) this.$store.dispatch('TimelineSpace/Modals/ImageViewer/incrementIndex')
} }
} }
} }