Support metaKey and ctrlKey for selection.

MetaKey is the windows key on Windows/Linux. Using only that for
selecting items is really confusing, because AFAIK no existing
application does that. With this commit, ctrl can be used for selecting
items as well.
pull/611/head
Nils Asmussen 8 years ago
parent 425749eb85
commit a765b5ee06

@ -3,6 +3,12 @@
* @copyright 2015 by Tobias Reich
*/
const isSelectKeyPressed = function(e) {
return e.metaKey || e.ctrlKey
}
multiselect = {
ids: []
@ -71,8 +77,8 @@ multiselect.albumClick = function(e, albumObj) {
let id = albumObj.attr('data-id')
if (e.metaKey===true) multiselect.toggleItem(albumObj, id)
else lychee.goto(id)
if (isSelectKeyPressed(e)) multiselect.toggleItem(albumObj, id)
else lychee.goto(id)
}
@ -80,8 +86,8 @@ multiselect.photoClick = function(e, photoObj) {
let id = photoObj.attr('data-id')
if (e.metaKey===true) multiselect.toggleItem(photoObj, id)
else lychee.goto(album.getID() + '/' + id)
if (isSelectKeyPressed(e)) multiselect.toggleItem(photoObj, id)
else lychee.goto(album.getID() + '/' + id)
}
@ -251,7 +257,7 @@ multiselect.getSelection = function(e) {
if (visible.contextMenu()) return false
if (!visible.multiselect()) return false
if (e.metaKey===false && (size.width==0 || size.height==0)) {
if (!isSelectKeyPressed(e) && (size.width==0 || size.height==0)) {
multiselect.close()
return false
}

Loading…
Cancel
Save