Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Circular filelist
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Mar 14, 2019
commit 073e0e5f3d94bb9e7bd940576d0608253bdaf8e7
12 changes: 10 additions & 2 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ export default {

computed: {
hasPrevious() {
return this.currentIndex > 0
return this.fileList.length > 1
},
hasNext() {
return this.currentIndex < this.fileList.length - 1
return this.fileList.length > 1
},
currentFileName() {
if (this.currentFile && this.currentFile.path) {
Expand Down Expand Up @@ -378,7 +378,11 @@ export default {
previous() {
this.loading = true
this.failed = false

this.currentIndex--
if (this.currentIndex < 0) {
this.currentIndex = this.fileList.length - 1
}

this.openFileFromList(this.fileList[this.currentIndex])
},
Expand All @@ -389,7 +393,11 @@ export default {
next() {
this.loading = true
this.failed = false

this.currentIndex++
if (this.currentIndex > this.fileList.length - 1) {
this.currentIndex = 0
}

this.openFileFromList(this.fileList[this.currentIndex])
},
Expand Down