Merge pull request #603 from hrniels/multiselect-contextmenu
Don't show context menu on finished multiselect.
This commit is contained in:
commit
1bf8f8d2f8
@ -42,6 +42,17 @@ multiselect.toggleItem = function(object, id) {
|
||||
|
||||
}
|
||||
|
||||
multiselect.addItem = function(object, id) {
|
||||
|
||||
let pos = $.inArray(id, multiselect.ids)
|
||||
|
||||
if (pos==-1) {
|
||||
multiselect.ids.push(id)
|
||||
multiselect.select(object)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
multiselect.albumClick = function(e, albumObj) {
|
||||
|
||||
let id = albumObj.attr('data-id')
|
||||
@ -103,8 +114,6 @@ multiselect.show = function(e) {
|
||||
if (visible.search()) return false
|
||||
if (visible.multiselect()) $('#multiselect').remove()
|
||||
|
||||
multiselect.clearSelection()
|
||||
|
||||
sidebar.setSelectable(false)
|
||||
|
||||
multiselect.position.top = e.pageY
|
||||
@ -226,6 +235,11 @@ multiselect.getSelection = function(e) {
|
||||
if (visible.contextMenu()) return false
|
||||
if (!visible.multiselect()) return false
|
||||
|
||||
if (!e.shiftKey && (size.width==0 || size.height==0)) {
|
||||
multiselect.close()
|
||||
return false
|
||||
}
|
||||
|
||||
$('.photo, .album').each(function() {
|
||||
|
||||
let offset = $(this).offset()
|
||||
@ -235,22 +249,15 @@ multiselect.getSelection = function(e) {
|
||||
(offset.top + 206)<=(size.top + size.height + tolerance) &&
|
||||
(offset.left + 206)<=(size.left + size.width + tolerance)) {
|
||||
|
||||
let id = $(this).data('id')
|
||||
|
||||
if (id!=null && id!==0 && album.isSmartID(id)===false) {
|
||||
|
||||
ids.push(id)
|
||||
multiselect.select(this)
|
||||
|
||||
}
|
||||
let id = $(this).attr('data-id')
|
||||
|
||||
multiselect.addItem($(this), id)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (ids.length!==0 && visible.album()) contextMenu.photoMulti(ids, e)
|
||||
else if (ids.length!==0 && visible.albums()) contextMenu.albumMulti(ids, e)
|
||||
else multiselect.close()
|
||||
multiselect.hide()
|
||||
|
||||
}
|
||||
|
||||
@ -272,9 +279,7 @@ multiselect.deselect = function(id) {
|
||||
|
||||
}
|
||||
|
||||
multiselect.close = function() {
|
||||
|
||||
multiselect.clearSelection()
|
||||
multiselect.hide = function() {
|
||||
|
||||
sidebar.setSelectable(true)
|
||||
|
||||
@ -288,4 +293,12 @@ multiselect.close = function() {
|
||||
lychee.animate('#multiselect', 'fadeOut')
|
||||
setTimeout(() => $('#multiselect').remove(), 300)
|
||||
|
||||
}
|
||||
|
||||
multiselect.close = function() {
|
||||
|
||||
multiselect.clearSelection()
|
||||
|
||||
multiselect.hide()
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user