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