feat(out): 生成中给旧图压暗 + 「生成中」角标(不动 data,失败即恢复)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 9s
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 9s
This commit is contained in:
1 parent
6ff6ab6a9f
commit
2cadad7ea7
2 files changed
+11
-2
No files matched your search
@@ -887,6 +887,9 @@
|
||||
try { if (wResolveOutSrc) src = (await wResolveOutSrc(r, true)) || r.url } catch (e) { /* 回退远端 */ }
|
||||
downloadUrl(src, 'image.png')
|
||||
}
|
||||
// 生成中(2026-12-02,用户裁定「方案 1」):某一轮还在跑时,旧图压暗 + 角标「生成中」,
|
||||
// 但不改 data.result —— 失败时旧图原样保留,不会出现「图没了」。
|
||||
const genBusy = !!(displayProgOut && (Number(displayProgOut.total) || 0) > (Number(displayProgOut.done) || 0))
|
||||
const ingSt = (global.IWBImageIngestView && global.IWBImageIngestView.get(r.url)) || null
|
||||
const imgEl = el('img', { key: 'out-img-' + cur + '-' + String(r.url || '').slice(-48), className: 'iwb-out-cell-img', decoding: 'async', fetchPriority: 'low', referrerPolicy: 'no-referrer', src: (ingSt && ingSt.localUrl) || wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(thumbOf(r), Math.max(120, Math.min(360, (node && node.w ? node.w - 40 : 240))))), draggable: true, style: { aspectRatio: (r.width && r.height) ? String(r.width) + ' / ' + String(r.height) : undefined }, title: r.idb && r.data ? '单击选中 · 双击查看原图 · 拖到画布作参考图' : '单击选中 · 双击放大(可左右切换)· 拖到画布作参考图', onError: (e) => { if (e.currentTarget && e.currentTarget.src !== r.url) e.currentTarget.src = r.url }, onPointerDown: (e) => { e.stopPropagation(); props.onSelect && props.onSelect(node.id) }, onDragStart: (e) => { try { const u = r.url || ''; e.dataTransfer.setData('application/x-iwb-output-ref', u); e.dataTransfer.setData('text/plain', u); e.dataTransfer.effectAllowed = 'copy' } catch (err) { /* 浏览器拒写自定义 MIME 时仍保留 text/plain */ } }, onDoubleClick: (e) => { e.stopPropagation(); openPreviewAt(cur) } })
|
||||
// 下载浮层:与图库共用同一组 hover token;组件缺失时退回旧的双小按钮(单文件/旧加载顺序)
|
||||
@@ -894,10 +897,12 @@
|
||||
const actions = DlOv ? null : el('div', { className: 'iwb-out-cell-actions' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '下载', onClick: doDownload, onPointerDown: stop }, I('download')),
|
||||
)
|
||||
const ingBadge = ingSt && (ingSt.status === 'queued' || ingSt.status === 'downloading')
|
||||
const ingBadge = genBusy
|
||||
? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-busy', key: 'ing-flag' }, '生成中')
|
||||
: ingSt && (ingSt.status === 'queued' || ingSt.status === 'downloading')
|
||||
? el('span', { className: 'iwb-out-cell-flag', key: 'ing-flag' }, ingSt.status === 'queued' ? '排队中' : '下载中')
|
||||
: (ingSt && ingSt.status === 'failed' ? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-err', key: 'ing-flag' }, '未落地') : null)
|
||||
return el('div', { key: String(r.url || '') + '|' + ri, className: 'iwb-out-cell' },
|
||||
return el('div', { key: String(r.url || '') + '|' + ri, className: 'iwb-out-cell' + (genBusy ? ' iwb-out-cell-busy' : '') },
|
||||
ingBadge,
|
||||
DlOv ? el(DlOv, { key: 'ov', onDownload: doDownload, icon: I('download'), label: '下载' }, imgEl) : imgEl,
|
||||
el('div', { className: 'iwb-out-cell-meta' }, (r.width || '?') + '×' + (r.height || '?')),
|
||||
|
||||
@@ -2575,3 +2575,7 @@ body .iwb-history-embedded .iwb-history-item.iwb-history-selected:hover img {
|
||||
.iwb-out-cell { position: relative; }
|
||||
.iwb-out-cell-flag { position: absolute; left: var(--iwb-space-4); top: var(--iwb-space-4); z-index: var(--iwb-z-anchor); padding: 0 var(--iwb-space-8); border-radius: var(--iwb-radius-full); font-size: var(--iwb-font-xs); line-height: 16px; color: var(--iwb-text); background: var(--iwb-panel); border: 1px solid var(--iwb-border2); opacity: .92; }
|
||||
.iwb-out-cell-flag-err { color: var(--iwb-err); border-color: var(--iwb-err-bd); background: var(--iwb-err-bg); }
|
||||
|
||||
/* 生成中:旧图压暗 + 「生成中」角标(不动 data,失败即恢复) */
|
||||
.iwb-out-cell-busy .iwb-out-cell-img { opacity: .5; filter: saturate(.75); }
|
||||
.iwb-out-cell-flag-busy { color: var(--iwb-warn); border-color: var(--iwb-warn-bd); background: var(--iwb-warn-bg); }
|
||||
Reference in new issue
Block a user