Keep the gallery open on touch and remove rows that leave a List filter
This commit is contained in:
committed by
Alexander Rozhenko
parent
beeace231d
commit
f4ebd33329
@@ -881,19 +881,20 @@ function closeDetail(){ const d=$('detail'); d.style.transition=''; d.style.tran
|
|||||||
$('dclose').onclick=closeDetail;
|
$('dclose').onclick=closeDetail;
|
||||||
$('dclose').addEventListener('pointerdown',e=>e.stopPropagation());
|
$('dclose').addEventListener('pointerdown',e=>e.stopPropagation());
|
||||||
/* pull-down-to-close (grabber bar + photo) */
|
/* pull-down-to-close (grabber bar + photo) */
|
||||||
let dDragY=null;
|
let dDragY=null, heroTapped=false;
|
||||||
function dStart(e){ dDragY=e.clientY; $('detail').style.transition='none'; try{e.currentTarget.setPointerCapture(e.pointerId)}catch(_){} }
|
function dStart(e){ heroTapped=false; dDragY=e.clientY; $('detail').style.transition='none'; try{e.currentTarget.setPointerCapture(e.pointerId)}catch(_){} }
|
||||||
function dMoveH(e){ if(dDragY===null) return; const dy=Math.max(0,e.clientY-dDragY); $('detail').style.transform=`translateY(${dy}px)`; }
|
function dMoveH(e){ if(dDragY===null) return; const dy=Math.max(0,e.clientY-dDragY); $('detail').style.transform=`translateY(${dy}px)`; }
|
||||||
function dEndH(e){ if(dDragY===null) return; const dy=Math.max(0,e.clientY-dDragY); dDragY=null;
|
function dEndH(e){ if(dDragY===null) return; const dy=Math.max(0,e.clientY-dDragY); dDragY=null;
|
||||||
if(dy>110){ closeDetail(); }
|
if(dy>110){ closeDetail(); }
|
||||||
else { const d=$('detail'); d.style.transition='transform .25s cubic-bezier(.2,.8,.3,1)'; d.style.transform='';
|
else { const d=$('detail'); d.style.transition='transform .25s cubic-bezier(.2,.8,.3,1)'; d.style.transform='';
|
||||||
/* B1 §11.3: a tap on the dossier HERO opens the fullscreen viewer at
|
heroTapped=e.type==='pointerup' && dy<=6 && e.currentTarget.classList.contains('dhero');
|
||||||
photo 0. When the dossier sits over the deck, the viewer back-chain
|
} }
|
||||||
walks Esc back to the dossier (item 2), then to the deck. */
|
/* Open on the completed click. Opening on touch pointerup puts the new
|
||||||
if(e.type==='pointerup' && dy<=6 && e.currentTarget&&e.currentTarget.classList
|
backdrop under the finger just in time to receive the same tap's click. */
|
||||||
&& e.currentTarget.classList.contains('dhero') && dData&&dData.img){
|
document.querySelector('.dhero').addEventListener('click',()=>{
|
||||||
openViewer(dData,0,{type:'dossier', backToDetail:dEntry});
|
if(heroTapped && dData && dData.img) openViewer(dData,0,{type:'dossier', backToDetail:dEntry});
|
||||||
} } }
|
heroTapped=false;
|
||||||
|
});
|
||||||
[document.querySelector('.dgrab'),document.querySelector('.dhero')].forEach(el=>{ if(!el) return; el.addEventListener('pointerdown',dStart); el.addEventListener('pointermove',dMoveH); el.addEventListener('pointerup',dEndH); el.addEventListener('pointercancel',dEndH); });
|
[document.querySelector('.dgrab'),document.querySelector('.dhero')].forEach(el=>{ if(!el) return; el.addEventListener('pointerdown',dStart); el.addEventListener('pointermove',dMoveH); el.addEventListener('pointerup',dEndH); el.addEventListener('pointercancel',dEndH); });
|
||||||
function dAction(a){
|
function dAction(a){
|
||||||
const ctx=dCtx; closeDetail();
|
const ctx=dCtx; closeDetail();
|
||||||
@@ -1084,10 +1085,14 @@ function renderList(){
|
|||||||
}
|
}
|
||||||
/* optimistic decision updates for whichever screens show this listing */
|
/* optimistic decision updates for whichever screens show this listing */
|
||||||
function updateRowDecision(id, act){
|
function updateRowDecision(id, act){
|
||||||
const find=[listItems];
|
const it=listItems.find(x=>x.id===id);
|
||||||
for(const arr of find){
|
if(it){
|
||||||
const it=arr.find(x=>x.id===id);
|
it.decision=act;
|
||||||
if(it) it.decision=act;
|
if(listCtl.decision!=='all' && listCtl.decision!==(act||'undecided')){
|
||||||
|
listItems=listItems.filter(x=>x!==it);
|
||||||
|
$('lrows').querySelector(`.row[data-i="${id}"]`)?.remove();
|
||||||
|
if(!listItems.length) renderList(); // existing empty state
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const el=$('lrows').querySelector(`.rc[data-i="${id}"]`);
|
const el=$('lrows').querySelector(`.rc[data-i="${id}"]`);
|
||||||
if(el) el.querySelectorAll('.rbtn').forEach(b=>b.classList.toggle('on',b.dataset.s===act));
|
if(el) el.querySelectorAll('.rbtn').forEach(b=>b.classList.toggle('on',b.dataset.s===act));
|
||||||
@@ -1114,7 +1119,6 @@ $('lrows').addEventListener('click',e=>{
|
|||||||
if(!it) return;
|
if(!it) return;
|
||||||
const next= it.decision===s?null:s; // tapping the lit button clears
|
const next= it.decision===s?null:s; // tapping the lit button clears
|
||||||
setDecision(id,next);
|
setDecision(id,next);
|
||||||
if(next===null && (listCtl.decision===s)) renderList(); // row leaves a filtered view
|
|
||||||
});
|
});
|
||||||
$('fdec').addEventListener('click',e=>{
|
$('fdec').addEventListener('click',e=>{
|
||||||
const chip=e.target.closest('.fchip'); if(!chip) return;
|
const chip=e.target.closest('.fchip'); if(!chip) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user