added toolbar touch + cleanup and tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-08-16 00:36:10 +03:00
parent 18de12dc7e
commit 5db49a0585
3 changed files with 35 additions and 16 deletions

View File

@ -290,8 +290,19 @@ body {
padding-right: calc(var(--padding) / 5); padding-right: calc(var(--padding) / 5);
} }
.gallery .toolbar:not(.shown):not(:hover) { .gallery .toolbar:not(.shown):not(:hover) {
background: transparent;
box-shadow: none; box-shadow: none;
z-index: var(--base-layer);
animation: 0.5s steps(1) tuck-to-backgroud;
}
@keyframes tuck-to-backgroud {
0% {
z-index: calc(var(--base-layer) + 2);
}
100% {
z-index: var(--base-layer);
}
} }
@ -357,6 +368,7 @@ body {
/* button: collapse... */ /* button: collapse... */
.gallery .toolbar button.collapse { .gallery .toolbar button.collapse {
float: right;
opacity: 0.3; opacity: 0.3;
transition: rotate 0.2s; transition: rotate 0.2s;
} }
@ -376,10 +388,10 @@ body {
cursor: pointer; cursor: pointer;
opacity: 0.3; color: var(--gallery-secondary-color);
} }
.gallery .toolbar .drag-handle:hover { .gallery .toolbar .drag-handle:hover {
opacity: 1; color: var(--gallery-text-color);
} }

View File

@ -84,6 +84,10 @@ For more info see: <a href="./README.md">README.md</a>
<button onclick="gallery" title="upload">cloud_upload</button> <button onclick="gallery" title="upload">cloud_upload</button>
<button onclick="gallery" title="save">save</button> <button onclick="gallery" title="save">save</button>
</div> </div>
<div>
<button onclick="gallery.details.show()" title="info">imagesmode<sec>label</sec></button>
<button onclick="gallery.details.show()" title="edit">imagesmode<sec>edit</sec></button>
</div>
<div> <div>
<button onclick="gallery.toggleMark()" title="toggle mark current (space)">select</button> <button onclick="gallery.toggleMark()" title="toggle mark current (space)">select</button>
<button onclick="gallery.markAll()" title="mark all (ctrl-a)">select<sec>select</sec></button> <button onclick="gallery.markAll()" title="mark all (ctrl-a)">select<sec>select</sec></button>

View File

@ -878,20 +878,23 @@ var Gallery = {
evt.stopPropagation() }) evt.stopPropagation() })
// toolbar: collapse: click, hold to make sticky... // toolbar: collapse: click, hold to make sticky...
var hold_timeout var hold_timeout
var handleInterationStart = function(evt){
hold_timeout = setTimeout(
function(){
hold_timeout = undefined
toolbar.classList.toggle('sticky') },
that.toolbar_hold ?? 300) }
var handleInterationEnd = function(evt){
evt.preventDefault()
hold_timeout
&& clearTimeout(hold_timeout)
hold_timeout = undefined
that.toggleToolbar() }
var collapse_button = toolbar.querySelector('.collapse') var collapse_button = toolbar.querySelector('.collapse')
collapse_button collapse_button.addEventListener('touchstart', handleInterationStart)
.addEventListener('mousedown', function(evt){ collapse_button.addEventListener('mousedown', handleInterationStart)
hold_timeout = setTimeout( collapse_button.addEventListener('touchend', handleInterationEnd)
function(){ collapse_button.addEventListener('mouseup', handleInterationEnd)
hold_timeout = undefined
toolbar.classList.toggle('sticky') },
that.toolbar_hold ?? 300) })
collapse_button
.addEventListener('mouseup', function(evt){
hold_timeout
&& clearTimeout(hold_timeout)
hold_timeout = undefined
that.toggleToolbar() })
// toolbar: autohide... // toolbar: autohide...
var hide_timeout var hide_timeout
toolbar toolbar