started work on drag-n-drop...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-07-28 14:47:24 +03:00
parent 3a38523432
commit fb2e88cfa0

View File

@ -118,7 +118,7 @@ var keyboard = {
|| gallery.down() },
Enter: function(){
gallery.lightbox.toggle() },
Escape: function(){
Escape: function(evt){
gallery.lightbox.shown ?
gallery.lightbox.hide()
// XXX should we remember which image was current and select
@ -239,7 +239,6 @@ var Gallery = {
img.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
offset: 10,
})
// helpers...
this.__at_top_row = !this.getRow('above')
@ -532,6 +531,16 @@ var Gallery = {
.addEventListener('click', function(evt){
that.deselect_current
&& (that.current = null) })
// drag...
this.dom
.addEventListener('dragover', function(evt){
// XXX
})
this.dom
.addEventListener('drop', function(evt){
evt.preventDefault()
// XXX
})
// handle resizing...
new ResizeObserver(
@ -654,6 +663,14 @@ var Lightbox = {
document.fullscreenElement ?
document.exitFullscreen()
: that.dom.requestFullscreen() })
// drag...
this.dom
.addEventListener('dragover', function(evt){
that.gallery.dom.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
})
that.hide() })
// click...
var deadzone = this.navigation_deadzone ?? 100
this.dom