Browse Source

Move to next photo after after moving a picture #437

Tobias Reich 8 years ago
parent
commit
c7751f0231
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/scripts/photo.js

+ 7 - 4
src/scripts/photo.js

@@ -335,14 +335,12 @@ photo.setTitle = function(photoIDs) {
 
 photo.setAlbum = function(photoIDs, albumID) {
 
-	let nextPhoto
-	let previousPhoto
+	let nextPhoto = null
+	let previousPhoto = null
 
 	if (!photoIDs) return false
 	if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
 
-	if (visible.photo) lychee.goto(album.getID())
-
 	photoIDs.forEach(function(id, index, array) {
 
 		// Change reference for the next and previous photo
@@ -363,6 +361,11 @@ photo.setAlbum = function(photoIDs, albumID) {
 
 	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 = {
 		photoIDs: photoIDs.join(),
 		albumID