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').addEventListener('pointerdown',e=>e.stopPropagation());
|
||||
/* pull-down-to-close (grabber bar + photo) */
|
||||
let dDragY=null;
|
||||
function dStart(e){ dDragY=e.clientY; $('detail').style.transition='none'; try{e.currentTarget.setPointerCapture(e.pointerId)}catch(_){} }
|
||||
let dDragY=null, heroTapped=false;
|
||||
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 dEndH(e){ if(dDragY===null) return; const dy=Math.max(0,e.clientY-dDragY); dDragY=null;
|
||||
if(dy>110){ closeDetail(); }
|
||||
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
|
||||
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. */
|
||||
if(e.type==='pointerup' && dy<=6 && e.currentTarget&&e.currentTarget.classList
|
||||
&& e.currentTarget.classList.contains('dhero') && dData&&dData.img){
|
||||
openViewer(dData,0,{type:'dossier', backToDetail:dEntry});
|
||||
} } }
|
||||
heroTapped=e.type==='pointerup' && dy<=6 && e.currentTarget.classList.contains('dhero');
|
||||
} }
|
||||
/* Open on the completed click. Opening on touch pointerup puts the new
|
||||
backdrop under the finger just in time to receive the same tap's click. */
|
||||
document.querySelector('.dhero').addEventListener('click',()=>{
|
||||
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); });
|
||||
function dAction(a){
|
||||
const ctx=dCtx; closeDetail();
|
||||
@@ -1084,10 +1085,14 @@ function renderList(){
|
||||
}
|
||||
/* optimistic decision updates for whichever screens show this listing */
|
||||
function updateRowDecision(id, act){
|
||||
const find=[listItems];
|
||||
for(const arr of find){
|
||||
const it=arr.find(x=>x.id===id);
|
||||
if(it) it.decision=act;
|
||||
const it=listItems.find(x=>x.id===id);
|
||||
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}"]`);
|
||||
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;
|
||||
const next= it.decision===s?null:s; // tapping the lit button clears
|
||||
setDecision(id,next);
|
||||
if(next===null && (listCtl.decision===s)) renderList(); // row leaves a filtered view
|
||||
});
|
||||
$('fdec').addEventListener('click',e=>{
|
||||
const chip=e.target.closest('.fchip'); if(!chip) return;
|
||||
|
||||
Reference in New Issue
Block a user