revert: remove single-click-to-open-lightbox on card images
User feedback: still triggers accidentally during panning. Reverts the click-to-open feature added in8790f97(with timer-based fix in4672116). REVISE button remains the only way to open the modal. In-modal keyboard navigation (arrow keys, spacebar, 1-9 favorite, ESC) added in8790f97stays intact — that part of the lightbox feature is useful and uncontroversial. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
1f5adeb799
commit
4a318e68d6
+1
-25
@@ -1267,30 +1267,6 @@ function copyConfigsAsComfyNodes(id) {
|
||||
}
|
||||
|
||||
|
||||
// Click-delay helper: distinguishes single-click (open lightbox) from double-click
|
||||
// (toggle favorite) on card <img> elements. Browsers fire two click events before
|
||||
// dblclick, so a plain onclick+ondblclick causes the modal to open twice and the
|
||||
// favorite to flip on every double-click. On mobile, tap-to-scroll also fired the
|
||||
// onclick accidentally. Solution: first click arms a 250ms timer; a second click
|
||||
// within that window cancels the timer and calls toggleFavorite instead.
|
||||
const _imgClickTimers = new WeakMap();
|
||||
window._cardImgClick = function(imgEl, itemId) {
|
||||
const pending = _imgClickTimers.get(imgEl);
|
||||
if (pending) {
|
||||
// Second click arrived within 250ms → treat as double-click → favorite
|
||||
clearTimeout(pending);
|
||||
_imgClickTimers.delete(imgEl);
|
||||
if (typeof toggleFavorite === 'function') toggleFavorite(imgEl);
|
||||
return;
|
||||
}
|
||||
// First click → schedule lightbox open after 250ms
|
||||
const t = setTimeout(() => {
|
||||
_imgClickTimers.delete(imgEl);
|
||||
if (typeof openM === 'function') openM(itemId);
|
||||
}, 250);
|
||||
_imgClickTimers.set(imgEl, t);
|
||||
};
|
||||
|
||||
// Create card - FIXED UI LAYOUT WITH FAVORITE BUTTON
|
||||
function createCard(d) {
|
||||
const totalIndex = idToIndexMap.get(d.id) || 0;
|
||||
@@ -1338,7 +1314,7 @@ function createCard(d) {
|
||||
const isVideo = d.media_type === 'video';
|
||||
const mediaElement = isVideo
|
||||
? `<video ondblclick="toggleFavorite(this)" data-src="${d.file}" muted loop playsinline preload="metadata" draggable="false"></video>`
|
||||
: `<img onclick="event.stopPropagation(); _cardImgClick(this, ${d.id})" data-src="${d.file}" alt="Image ${d.id}" draggable="false" style="cursor:pointer;" title="Click to open lightbox · Double-click to favorite">`;
|
||||
: `<img data-src="${d.file}" alt="Image ${d.id}" draggable="false">`;
|
||||
const reviseBtn = isVideo ? '' : `<button class="revise-btn" onclick="event.stopPropagation(); openM(${d.id})">REVISE</button>`;
|
||||
const upscaleBtn = isVideo ? '' : `<button class="upscale-btn" onclick="openUpscaleModal(${d.id})" title="Upscale this image">\u2B06</button>`;
|
||||
const videoBadge = isVideo ? '<div class="video-badge">\u25B6 VIDEO</div>' : '';
|
||||
|
||||
Reference in New Issue
Block a user