Move to next photo after after moving a picture #437

This commit is contained in:
Tobias Reich 2016-03-06 16:36:22 +01:00
parent 2fb8ace334
commit c7751f0231

View File

@ -335,14 +335,12 @@ photo.setTitle = function(photoIDs) {
photo.setAlbum = function(photoIDs, albumID) { photo.setAlbum = function(photoIDs, albumID) {
let nextPhoto let nextPhoto = null
let previousPhoto let previousPhoto = null
if (!photoIDs) return false if (!photoIDs) return false
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ] if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
if (visible.photo) lychee.goto(album.getID())
photoIDs.forEach(function(id, index, array) { photoIDs.forEach(function(id, index, array) {
// Change reference for the next and previous photo // Change reference for the next and previous photo
@ -363,6 +361,11 @@ photo.setAlbum = function(photoIDs, albumID) {
albums.refresh() albums.refresh()
// Go to next photo if there is a next photo and
// next photo is not the current one. Show album otherwise.
if (visible.photo() && nextPhoto!=null && nextPhoto!==photo.getID()) lychee.goto(album.getID() + '/' + nextPhoto)
else if (!visible.albums()) lychee.goto(album.getID())
let params = { let params = {
photoIDs: photoIDs.join(), photoIDs: photoIDs.join(),
albumID albumID