Skip to content

12 个视觉参考图库与浏览器无限画布 AI 创作台(5,700+ 素材、中英提示词、多图对比、ComfyUI & MCP)· Visual reference library & infinite-canvas AI studio in the browser

fix: v1.5.1 production hardening for infinite canvas, filters, recipes & mobile

atuizz6a14f5ccad0a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a130ee..d8665ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@
## 简体中文
+### 2026-11-28 · v1.5.1
+
+- **无限空间画布生产级打磨**:适配 macOS / 笔记本触控板平滑指数缩放、双指斜向平移与平板双指捏合缩放;新增 `ResizeObserver` 处理隐藏标签切入与视野重算;支持 360° 左右动态端口贝塞尔连线、成品迭代节点自由拖拽/点击对比与防重叠垂直间距、输出预览节点一键直下(`↓`)及实时状态联动(提示词/便签/生成中同步);修复 `Space` 拖拽误触页面滚动与失焦卡滞,以及移动端紧凑模式精简冗余按钮。
+- **滤镜校准、安全校验与全站回归**:校准纯 SVG 剪影(`#pwSil`)与三阶明度块面(`#pwNotan3`)阈值,使浅色棚拍背景保持纯白而人物轮廓更锐利;加固造型方案 JSON 导入校验(2MB 体积上限、槽位字段清洗与空导入拦截);修复卡片缩放手柄 DOM 语义与五语纯提示词方案翻译,全部 **23 项**离线与全站回归套件(含 `v12`–`v18`、`studio-regressions`、`studio-materials-regressions`)100% 全绿通过。
+
### 2026-11-28 · v1.5.0
- **无限空间画布工作台(Infinite Spatial Canvas Studio)**:将中心参考画板全面升级为支持滚轮居中缩放(`35%–240%`)与自由平移的无限空间画布,动态点阵背景随视角跟随;支持自由拖拽排布与右下角缩放参考卡、卡片悬浮操作条(替换 / 切视角 / 画布镜像 / 移除)、**可注入提示词的导演便签**(支持双击空白处添加并一键切换 `↳ 提示词` 实时注入)、自动连接的**语义贝塞尔连线**、随画幅实时变化的**输出预览节点与成品回钉迭代**,以及一键整理(Tidy)、适配视野(`0`)与全屏专注画布(Zen Focus)模式;560px 以下移动端自动切换零溢出紧凑流式排版。
@@ -87,6 +92,11 @@
## English
+### 2026-11-28 · v1.5.1
+
+- **Infinite Spatial Canvas Production Polish**: added smooth Figma-style exponential wheel/pinch zoom, two-finger trackpad pan, and tablet two-finger touch pinch; added `ResizeObserver` for hidden-tab reveal resync; added 360° dynamic left/right Bézier port routing, draggable & clickable pinned output iterations with non-overlapping spacing, one-click Output Hub download (`↓`), and live Output Hub / Zen button state sync (`syncMeta`); prevented `Space`-pan page scroll / blur lock and pruned desktop-only HUD controls on sample & compact mobile views.
+- **Filter Calibration, Import Hardening & Full-Site QA**: calibrated `#pwSil` and `#pwNotan3` SVG thresholds so light studio backdrops remain crisp white while figures read as sharp silhouettes; hardened recipe JSON import with 2MB cap, strict slot sanitization, and empty-import rejection; fixed card resize handle DOM semantics (`<i class="cv-rsz">`) and 5-language prompt-only recipe labels — passing **23 / 23** offline & full-site suites (`v12`–`v18` + all studio regressions).
+
### 2026-11-28 · v1.5.0
- **Infinite Spatial Canvas Studio**: upgraded the center reference board into a true pan-and-zoom infinite canvas (`35%–240%`, cursor-centered wheel zoom, dynamic dot-matrix parallax) with draggable/resizable reference cards, quick hover actions (replace / angle / canvas mirror / remove), **prompt-linked art-direction sticky notes** (double-click empty space to drop, live `↳ Prompt` injection), **semantic Bézier flow wires**, a live aspect-ratio **Output Preview Hub** with pinned result iterations, Auto-Arrange (Tidy), Fit to View (`0`), and **Zen Focus Canvas** mode — with automatic overflow-free compact flow below `560px`.
@@ -167,6 +177,11 @@
## 日本語
+### 2026-11-28 · v1.5.1
+
+- **無限空間キャンバスの本番品質ブラッシュアップ**:トラックパッド連続ズーム・二本指パン・タブレット二本指ピンチ対応、非表示タブ切替時の `ResizeObserver` 再同期、360° 左右ポート自動ルーティング、ドラッグ&クリック可能な生成結果ノード(重複防止間隔)と出力ノード直ダウンロード(`↓`)、生成ボタン・ビジー状態のリアルタイム同期、`Space` パン時のスクロール防止およびモバイル/サンプル画面の不要 HUD 整理を実施。
+- **フィルター校正・JSON 安全検証・全 23 スイート合格**:`#pwSil`/`#pwNotan3` の閾値を校正し明るいスタジオ背景で人物シルエットを鮮明化;レシピ JSON 読込に 2MB 上限・スロット厳格サニタイズ・空ファイル拒否を追加;カードリサイズ要素の DOM 構造と 5 言語訳を修正し、オフライン+全サイト **23 / 23 スイート**全合格を達成。
+
### 2026-11-28 · v1.5.0
- **無限空間キャンバススタジオ(Infinite Spatial Canvas)**:中央リファレンスボードをパン&カーソル中心ズーム(`35%–240%`)対応の無限キャンバスへ刷新。カードの自由ドラッグ&リサイズ、ホバー操作バー(差替/アングル/反転/削除)、**プロンプト連動アートディレクション付箋**(空白ダブルクリックで追加・`↳ プロンプト` リアルタイム注入)、**セマンティック・ベジェ配線**、比率連動の**出力プレビューノード&生成結果ピン留め**、自動整列(整列)、全体表示(`0`)、集中フルキャンバス(集中)を搭載。560px 未満のスマホでは自動でコンパクト配置へ切替。
diff --git a/README.en.md b/README.en.md
index b980315..4dc3a8f 100644
--- a/README.en.md
+++ b/README.en.md
@@ -192,7 +192,7 @@ npm run test:offline
npm test
```
-Current release **v1.5.0** (2026-11-28) · [Full changelog](CHANGELOG.md)
+Current release **v1.5.1** (2026-11-28) · [Full changelog](CHANGELOG.md)
---
diff --git a/README.ja.md b/README.ja.md
index ae56d0d..cf995ed 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -192,7 +192,7 @@ npm run test:offline
npm test
```
-現在のリリース:**v1.5.0**(2026-11-28)· [全バージョン履歴](CHANGELOG.md)
+現在のリリース:**v1.5.1**(2026-11-28)· [全バージョン履歴](CHANGELOG.md)
---
diff --git a/README.md b/README.md
index 8798ce2..171dfa6 100644
--- a/README.md
+++ b/README.md
@@ -192,7 +192,7 @@ npm run test:offline
npm test
```
-当前发布版本 **v1.5.0**(2026-11-28)· [查看全部更新日志](CHANGELOG.md)
+当前发布版本 **v1.5.1**(2026-11-28)· [查看全部更新日志](CHANGELOG.md)
---
diff --git a/README.tr.md b/README.tr.md
index a264508..5c418d4 100644
--- a/README.tr.md
+++ b/README.tr.md
@@ -192,7 +192,7 @@ npm run test:offline
npm test
```
-Güncel sürüm **v1.5.0** (2026-11-28) · [Tam değişiklik günlüğü](CHANGELOG.md)
+Güncel sürüm **v1.5.1** (2026-11-28) · [Tam değişiklik günlüğü](CHANGELOG.md)
---
diff --git a/README.vi.md b/README.vi.md
index b05b3f6..db40018 100644
--- a/README.vi.md
+++ b/README.vi.md
@@ -192,7 +192,7 @@ npm run test:offline
npm test
```
-Phiên bản hiện tại **v1.5.0** (2026-11-28) · [Xem toàn bộ nhật ký thay đổi](CHANGELOG.md)
+Phiên bản hiện tại **v1.5.1** (2026-11-28) · [Xem toàn bộ nhật ký thay đổi](CHANGELOG.md)
---
diff --git a/src/canvas.js b/src/canvas.js
index a3d30c0..7bd106c 100644
--- a/src/canvas.js
+++ b/src/canvas.js
@@ -29,6 +29,9 @@
let zenMode = false;
let lastRefSig = '';
let userCamera = false;
+ const outPos = new Map();
+ const activePointers = new Map();
+ let pinchState = null;
const saved = LS(STORAGE_KEY) || {};
const state = {
@@ -275,13 +278,16 @@
const hubPos = state.hub || defaultHubPos(refsList.length);
const hubW = hubEl.offsetWidth || HUB_W;
const hubH = hubEl.offsetHeight || 280;
- const targetX = hubPos.x - hubW / 2;
+ const hubLeft = hubPos.x - hubW / 2;
+ const hubRight = hubPos.x + hubW / 2;
const targetY = hubPos.y;
const paths = [];
const busy = !!(api && api.isBusy());
+ let usedLeftPort = false;
+ let usedRightPort = false;
- const makeCurve = (sx, sy, tx, ty, cls) => {
- const dx = Math.max(54, Math.abs(tx - sx) * 0.48);
+ const makeHorizCurve = (sx, sy, tx, ty, cls, dir) => {
+ const dx = Math.max(54, Math.abs(tx - sx) * 0.48) * dir;
const d = `M ${sx} ${sy} C ${sx + dx} ${sy}, ${tx - dx} ${ty}, ${tx} ${ty}`;
return `<path class="cv-wire ${cls}${busy ? ' pulse' : ''}" d="${d}"/><circle class="cv-port ${cls}" cx="${sx}" cy="${sy}" r="3.5"/>`;
};
@@ -291,9 +297,13 @@
const el = cardNodeEl(entry.id);
if (!node || !el) return;
const w = el.offsetWidth || node.w || DEFAULT_CARD_W;
- const sx = node.x + w / 2;
- const sy = node.y;
- paths.push(makeCurve(sx, sy, targetX, targetY, 'ref-wire'));
+ if (node.x > hubPos.x + hubW * 0.25) {
+ usedRightPort = true;
+ paths.push(makeHorizCurve(node.x - w / 2, node.y, hubRight, targetY, 'ref-wire', -1));
+ } else {
+ usedLeftPort = true;
+ paths.push(makeHorizCurve(node.x + w / 2, node.y, hubLeft, targetY, 'ref-wire', 1));
+ }
});
state.notes.forEach(note => {
@@ -301,36 +311,45 @@
const el = $(`#wbCanvasNotes .cv-note[data-note-id="${CSS.escape(note.id)}"]`);
const w = el ? el.offsetWidth : NOTE_W;
const h = el ? el.offsetHeight : 120;
- if (note.x + w / 2 < targetX + 16) {
- // Left of hub: clean horizontal Bezier right into hub's left input port
- paths.push(makeCurve(note.x + w / 2, note.y, targetX, targetY, 'note-wire'));
+ if (note.x + w / 2 < hubLeft + 16) {
+ usedLeftPort = true;
+ paths.push(makeHorizCurve(note.x + w / 2, note.y, hubLeft, targetY, 'note-wire', 1));
+ } else if (note.x - w / 2 > hubRight - 16) {
+ usedRightPort = true;
+ paths.push(makeHorizCurve(note.x - w / 2, note.y, hubRight, targetY, 'note-wire', -1));
} else {
- // Below/around hub: route vertically from note's top edge into hub's bottom center
+ // Above or below hub: route vertically into nearest vertical edge of hub
+ const below = note.y >= hubPos.y;
const sx = note.x;
- const sy = note.y - h / 2;
+ const sy = below ? note.y - h / 2 : note.y + h / 2;
const tx = hubPos.x;
- const ty = hubPos.y + hubH / 2;
- const dy = Math.max(36, Math.abs(sy - ty) * 0.5);
- const d = `M ${sx} ${sy} C ${sx} ${sy - dy}, ${tx} ${ty + dy}, ${tx} ${ty}`;
+ const ty = below ? hubPos.y + hubH / 2 : hubPos.y - hubH / 2;
+ const dy = Math.max(36, Math.abs(sy - ty) * 0.5) * (below ? -1 : 1);
+ const d = `M ${sx} ${sy} C ${sx} ${sy + dy}, ${tx} ${ty - dy}, ${tx} ${ty}`;
paths.push(`<path class="cv-wire note-wire${busy ? ' pulse' : ''}" d="${d}"/><circle class="cv-port note-wire" cx="${sx}" cy="${sy}" r="3.5"/>`);
}
});
// Connect pinned historical result iterations to the hub
- resultsList.slice(1, 5).forEach((_, i) => {
- const outEl = $(`#wbCanvasOutputs .cv-out-node[data-out-pos="${i + 1}"]`);
+ resultsList.slice(1, 5).forEach(res => {
+ const outEl = $(`#wbCanvasOutputs .cv-out-node[data-out-i="${res.index}"]`);
if (!outEl) return;
const ox = Number(outEl.dataset.wx || 0);
const oy = Number(outEl.dataset.wy || 0);
const ow = outEl.offsetWidth || 176;
- const sx = hubPos.x + hubW / 2;
- const tx = ox - ow / 2;
- const dx = Math.max(40, Math.abs(tx - sx) * 0.45);
+ const rightSide = ox >= hubPos.x;
+ const sx = rightSide ? hubRight : hubLeft;
+ const tx = rightSide ? ox - ow / 2 : ox + ow / 2;
+ const dir = rightSide ? 1 : -1;
+ const dx = Math.max(40, Math.abs(tx - sx) * 0.45) * dir;
paths.push(`<path class="cv-wire out-wire" d="M ${sx} ${targetY} C ${sx + dx} ${targetY}, ${tx - dx} ${oy}, ${tx} ${oy}"/>`);
});
- if (paths.length) {
- paths.push(`<circle class="cv-port hub-port${busy ? ' pulse' : ''}" cx="${targetX}" cy="${targetY}" r="4.5"/>`);
+ if (usedLeftPort) {
+ paths.push(`<circle class="cv-port hub-port${busy ? ' pulse' : ''}" cx="${hubLeft}" cy="${targetY}" r="4.5"/>`);
+ }
+ if (usedRightPort) {
+ paths.push(`<circle class="cv-port hub-port${busy ? ' pulse' : ''}" cx="${hubRight}" cy="${targetY}" r="4.5"/>`);
}
svg.innerHTML = paths.join('');
}
@@ -355,7 +374,7 @@
`<button type="button" data-cv-card="flip" class="${flipped ? 'on' : ''}" title="画布镜像预览" aria-label="镜像">⇄</button>` +
`<button type="button" data-cv-card="pick" title="替换素材" aria-label="替换">换</button>` +
`<button type="button" data-cv-card="rm" title="移除" aria-label="移除">×</button>` +
- `</div><span class="cv-rsz" data-cv-rsz title="拖拽调整卡片大小" aria-hidden="true"></span>`;
+ `</div><i class="cv-rsz" data-cv-rsz title="拖拽调整卡片大小" aria-hidden="true"></i>`;
const styleAttr = compactMode
? ''
@@ -400,6 +419,15 @@
.join('');
}
+ function outputNodePos(res, idx, hubPos) {
+ const savedPos = outPos.get(res.index);
+ if (savedPos) return savedPos;
+ return {
+ x: hubPos.x + HUB_W + 38 + Math.floor(idx / 2) * 200,
+ y: hubPos.y + (idx % 2 === 0 ? -144 : 144),
+ };
+ }
+
function renderOutputs() {
const box = $('#wbCanvasOutputs');
if (!box) return;
@@ -415,13 +443,14 @@
const tags = [meta.styleLabel, meta.shotLabel, meta.ar !== 'auto' ? meta.ar : ''].filter(Boolean);
const previewInner = latest
- ? `<img src="${esc(latest.url)}" alt="最新生成结果" draggable="false">`
+ ? `<img src="${esc(latest.url)}" alt="最新生成结果" data-out-act="view" data-out-i="${latest.index}" draggable="false">`
: `<div class="cv-hub-wire" style="width:${dims.w}px;height:${dims.h}px"><span>${meta.ar === 'auto' ? '3:4' : esc(meta.ar)}</span><small>${refsList.length} 项输入 · ${meta.jobs} 张</small></div>`;
const hubActions = latest
? `<div class="cv-hub-acts">` +
`<button type="button" class="sm ghost" data-out-act="view" data-out-i="${latest.index}">对比</button>` +
`<button type="button" class="sm ghost" data-out-act="use" data-out-i="${latest.index}">当原图</button>` +
+ `<button type="button" class="sm ghost cv-hub-dl" data-out-act="dl" data-out-i="${latest.index}" title="下载成品" aria-label="下载成品">↓</button>` +
`<button type="button" class="sm pri" data-hub-go${meta.canGo && !meta.busy ? '' : ' disabled'}>${meta.busy ? '生成中…' : '再生成'}</button>` +
`</div>`
: `<div class="cv-hub-acts">` +
@@ -443,12 +472,11 @@
const extraOutputs = resultsList
.slice(1, 5)
.map((res, idx) => {
- const wx = hubPos.x + HUB_W + 34 + Math.floor(idx / 2) * 196;
- const wy = hubPos.y + (idx % 2 === 0 ? -110 : 122);
- const posStyle = compactMode ? '' : ` style="left:${wx}px;top:${wy}px;width:176px"`;
+ const p = outputNodePos(res, idx, hubPos);
+ const posStyle = compactMode ? '' : ` style="left:${p.x}px;top:${p.y}px;width:176px"`;
return (
- `<article class="cv-out-node" data-out-pos="${idx + 1}" data-wx="${wx}" data-wy="${wy}"${posStyle}>` +
- `<img src="${esc(res.url)}" alt="生成结果 ${res.index + 1}" draggable="false">` +
+ `<article class="cv-out-node" data-out-pos="${idx + 1}" data-out-i="${res.index}" data-wx="${p.x}" data-wy="${p.y}"${posStyle}>` +
+ `<img src="${esc(res.url)}" alt="生成结果 ${res.index + 1}" data-out-act="view" data-out-i="${res.index}" draggable="false">` +
`<div class="cv-out-bar">` +
`<small>#${res.index + 1}</small>` +
`<button type="button" class="sm ghost" data-out-act="view" data-out-i="${res.index}">对比</button>` +
@@ -459,7 +487,20 @@
.join('');
box.innerHTML = hubHtml + extraOutputs;
+ syncMeta();
+ }
+ function syncMeta() {
+ if (!api) return;
+ const meta = api.getMeta();
+ const latest = resultsList[0] || null;
+ const hubGo = $('#wbCanvasOutputs [data-hub-go]');
+ if (hubGo) {
+ hubGo.disabled = !meta.canGo || meta.busy;
+ hubGo.textContent = meta.busy ? '生成中…' : latest ? '再生成' : '从画布生成';
+ }
+ const dot = $('#wbCanvasOutputs .cv-hub-dot');
+ if (dot) dot.classList.toggle('busy', !!meta.busy);
const zenInfo = $('#wbZenInfo');
if (zenInfo) zenInfo.textContent = `${refsList.length} 项参考 · ${meta.styleLabel || '默认'}${meta.ar !== 'auto' ? ' · ' + meta.ar : ''}`;
const zenGo = $('#wbZenGo');
@@ -467,6 +508,7 @@
zenGo.disabled = !meta.canGo || meta.busy;
zenGo.textContent = meta.busy ? '生成中…' : '生成';
}
+ if ($('#wbCanvasWires')?.childElementCount) scheduleWires();
}
function updateHud() {
@@ -475,7 +517,13 @@
const tools = $('#wbCanvasTools');
const zoomBar = $('#wbCanvasZoom');
const hideTools = compactMode && isSample && !state.notes.length;
- if (tools) tools.hidden = hideTools;
+ if (tools) {
+ tools.hidden = hideTools;
+ const spatialOnly = compactMode || (isSample && !state.notes.length);
+ tools.querySelectorAll('[data-cv-act="tidy"], [data-cv-act="fit"], [data-cv-act="wires"]').forEach(b => {
+ b.hidden = spatialOnly;
+ });
+ }
if (zoomBar) zoomBar.hidden = compactMode;
const wireBtn = $('#wbCanvasTools [data-cv-act="wires"]');
if (wireBtn) {
@@ -502,7 +550,11 @@
boxes.push([pos.x - w / 2, pos.y - h / 2, pos.x + w / 2, pos.y + h / 2]);
});
if (!isSample && state.hub) {
- boxes.push([state.hub.x - HUB_W / 2, state.hub.y - 150, state.hub.x + HUB_W / 2, state.hub.y + 150]);
+ boxes.push([state.hub.x - HUB_W / 2, state.hub.y - 160, state.hub.x + HUB_W / 2, state.hub.y + 160]);
+ resultsList.slice(1, 5).forEach((res, idx) => {
+ const p = outputNodePos(res, idx, state.hub);
+ boxes.push([p.x - 92, p.y - 135, p.x + 92, p.y + 135]);
+ });
}
state.notes.forEach(n => {
boxes.push([n.x - NOTE_W / 2, n.y - 68, n.x + NOTE_W / 2, n.y + 68]);
@@ -628,6 +680,7 @@
function tidy() {
userCamera = false;
+ outPos.clear();
ensurePositions(true);
renderCards();
renderNotes();
@@ -645,10 +698,11 @@
state.scale = 1;
lastRefSig = '';
userCamera = false;
+ outPos.clear();
persist();
}
- // ---------- Pointer Interactions (Pan / Drag Node / Resize / Drag Hub / Drag Note) ----------
+ // ---------- Pointer Interactions (Pan / Drag Node / Resize / Drag Hub / Drag Note / Drag Output / Pinch) ----------
function bindEvents() {
const vp = $('#wbCanvasVp');
const ph0 = $('#wbPh0');
@@ -658,6 +712,24 @@
vp.addEventListener('pointerdown', e => {
if (compactMode || e.button === 2) return;
+ if (e.pointerType === 'touch') {
+ activePointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
+ if (activePointers.size === 2) {
+ drag = null;
+ const pts = [...activePointers.values()];
+ const dist = Math.hypot(pts[1].x - pts[0].x, pts[1].y - pts[0].y) || 1;
+ const r = vp.getBoundingClientRect();
+ pinchState = {
+ dist,
+ scale: state.scale,
+ tx: state.tx,
+ ty: state.ty,
+ mx: (pts[0].x + pts[1].x) / 2 - r.left,
+ my: (pts[0].y + pts[1].y) / 2 - r.top,
+ };
+ return;
+ }
+ }
if (e.target.closest('button, textarea, input, select, a')) return;
// Resize card handle
@@ -695,6 +767,16 @@
return;
}
+ // Drag pinned generated output iteration
+ const outNode = !spaceHeld ? e.target.closest('.cv-out-node') : null;
+ if (outNode) {
+ const outIdx = Number(outNode.dataset.outI || 0);
+ const ox = Number(outNode.dataset.wx || 0);
+ const oy = Number(outNode.dataset.wy || 0);
+ drag = { kind: 'out', pointerId: e.pointerId, outIdx, el: outNode, sx: e.clientX, sy: e.clientY, ox, oy, moved: false };
+ return;
+ }
+
// Drag Spatial Reference Card (unless Space held -> pan canvas)
const card = !spaceHeld && !isSample ? e.target.closest('.board-card') : null;
if (card) {
@@ -714,6 +796,26 @@
});
const onPointerMove = e => {
+ if (e.pointerType === 'touch' && activePointers.has(e.pointerId)) {
+ activePointers.set(e.pointerId, { x: e.clientX, y: e.clientY });
+ if (pinchState && activePointers.size === 2) {
+ const pts = [...activePointers.values()];
+ const dist = Math.hypot(pts[1].x - pts[0].x, pts[1].y - pts[0].y) || 1;
+ const r = vp.getBoundingClientRect();
+ const mx = (pts[0].x + pts[1].x) / 2 - r.left;
+ const my = (pts[0].y + pts[1].y) / 2 - r.top;
+ const { w, h } = vpMetrics();
+ const next = clamp(Math.round(pinchState.scale * (dist / pinchState.dist) * 100) / 100, MIN_SCALE, MAX_SCALE);
+ const wx = (pinchState.mx - w / 2 - pinchState.tx) / pinchState.scale;
+ const wy = (pinchState.my - h / 2 - pinchState.ty) / pinchState.scale;
+ state.scale = next;
+ state.tx = mx - w / 2 - wx * next;
+ state.ty = my - h / 2 - wy * next;
+ userCamera = true;
+ applyCamera();
+ return;
+ }
+ }
if (!drag) return;
const dx = e.clientX - drag.sx;
const dy = e.clientY - drag.sy;
@@ -761,10 +863,27 @@
drag.el.style.left = state.hub.x + 'px';
drag.el.style.top = state.hub.y + 'px';
scheduleWires();
+ } else if (drag.kind === 'out') {
+ drag.el.classList.add('dragging');
+ const nx = snap(drag.ox + dx / state.scale);
+ const ny = snap(drag.oy + dy / state.scale);
+ outPos.set(drag.outIdx, { x: nx, y: ny });
+ drag.el.dataset.wx = String(nx);
+ drag.el.dataset.wy = String(ny);
+ drag.el.style.left = nx + 'px';
+ drag.el.style.top = ny + 'px';
+ scheduleWires();
}
};
const endDrag = e => {
+ if (e.pointerType === 'touch') {
+ activePointers.delete(e.pointerId);
+ if (pinchState && activePointers.size < 2) {
+ pinchState = null;
+ persist();
+ }
+ }
if (!drag) return;
if (drag.moved) {
suppressClickUntil = performance.now() + 180;
@@ -788,9 +907,9 @@
}
});
- // Prevent click from triggering picker right after dragging a card
+ // Prevent click from triggering picker or lightbox right after dragging a card/output
vp.addEventListener('click', e => {
- if (performance.now() < suppressClickUntil && e.target.closest('.board-card')) {
+ if (performance.now() < suppressClickUntil && e.target.closest('.board-card, .cv-out-node')) {
e.preventDefault();
e.stopPropagation();
}
@@ -805,13 +924,26 @@
addNote(wx, wy);
});
- // Cursor-centered smooth wheel zoom
+ // Figma-grade cursor-centered continuous wheel/pinch zoom + trackpad horizontal/diagonal pan
vp.addEventListener('wheel', e => {
if (compactMode) return;
if (e.target.closest('textarea')) return;
e.preventDefault();
+ const unit = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? 240 : 1;
+ const dx = e.deltaX * unit;
+ const dy = e.deltaY * unit;
+ if (!e.ctrlKey && !e.metaKey && Math.abs(dx) > 0) {
+ state.tx -= dx;
+ state.ty -= dy;
+ userCamera = true;
+ applyCamera();
+ persist();
+ return;
+ }
const r = vp.getBoundingClientRect();
- const factor = e.deltaY < 0 ? 1.1 : 1 / 1.1;
+ const pinch = e.ctrlKey || e.metaKey;
+ const sensitivity = pinch ? 0.0085 : 0.0014;
+ const factor = Math.exp(-clamp(dy, -140, 140) * sensitivity);
zoomBy(factor, e.clientX - r.left, e.clientY - r.top);
}, { passive: false });
@@ -904,6 +1036,7 @@
const i = Number(outActBtn.dataset.outI || 0);
if (act === 'view') api?.viewResult(i);
else if (act === 'use') api?.useResultAsPerson(i);
+ else if (act === 'dl') api?.downloadResult?.(i);
}
});
@@ -932,25 +1065,40 @@
}
if (typing || e.ctrlKey || e.metaKey || e.altKey) return;
if (e.code === 'Space') {
+ if (!ae || !/^(BUTTON|A|SUMMARY)$/.test(ae.tagName) && ae.getAttribute?.('role') !== 'button') {
+ e.preventDefault();
+ }
spaceHeld = true;
vp.classList.add('space');
} else if (e.key === '0') {
+ userCamera = false;
fitToView(true);
}
});
+ const clearSpace = () => {
+ if (!spaceHeld) return;
+ spaceHeld = false;
+ vp.classList.remove('space');
+ };
addEventListener('keyup', e => {
- if (e.code === 'Space') {
- spaceHeld = false;
- vp.classList.remove('space');
- }
+ if (e.code === 'Space') clearSpace();
});
+ addEventListener('blur', clearSpace);
- // Re-sync compact mode & camera on window resize
+ // Re-sync compact mode, camera & wires on viewport resize or hidden-to-visible tab switch
let resizeRaf = 0;
- addEventListener('resize', () => {
+ let lastVpW = 0;
+ const handleResize = () => {
if (resizeRaf || !document.body.classList.contains('studio')) return;
resizeRaf = requestAnimationFrame(() => {
resizeRaf = 0;
+ const rect = vp.getBoundingClientRect();
+ if (!rect.width && !rect.height) {
+ lastVpW = 0;
+ return;
+ }
+ const revealed = lastVpW === 0 && rect.width > 0;
+ lastVpW = rect.width;
const nextCompact = isCompactViewport();
if (nextCompact !== compactMode) {
compactMode = nextCompact;
@@ -960,10 +1108,31 @@
renderOutputs();
updateHud();
}
- applyCamera();
+ if (revealed && !compactMode && !userCamera && !isSample && refsList.length > 0) {
+ const { w, h } = vpMetrics();
+ const needsFit = refsList.some(entry => {
+ const p = state.nodes[entry.id];
+ if (!p) return false;
+ const hw = (p.w || DEFAULT_CARD_W) / 2;
+ const hh = Math.round(hw * 1.48);
+ const sx1 = w / 2 + state.tx + (p.x - hw) * state.scale;
+ const sx2 = w / 2 + state.tx + (p.x + hw) * state.scale;
+ const sy1 = h / 2 + state.ty + (p.y - hh) * state.scale;
+ const sy2 = h / 2 + state.ty + (p.y + hh) * state.scale;
+ return sx1 < 16 || sx2 > w - 16 || sy1 < 44 || sy2 > h - 44;
+ });
+ if (needsFit) fitToView(false);
+ else applyCamera();
+ } else {
+ applyCamera();
+ }
scheduleWires();
});
- });
+ };
+ addEventListener('resize', handleResize);
+ if (typeof ResizeObserver !== 'undefined') {
+ new ResizeObserver(handleResize).observe(vp);
+ }
}
function init(studioApi) {
@@ -977,6 +1146,7 @@
window.PoseWearCanvas = {
init,
sync,
+ syncMeta,
tidy,
fitToView,
addNote,
diff --git a/src/i18n.js b/src/i18n.js
index 887c888..a4f6a60 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -855,7 +855,7 @@
"Qwen-Image 编辑": ["Qwen-Image Edit","Qwen-Image 編集","Qwen-Image Chỉnh sửa","Qwen-Image Düzenleme"],
"Gemini 中转": ["Gemini Relay","Gemini 中継","Gemini Trung chuyển","Gemini Aktarıcı"],
"本机网关": ["Local Gateway","ローカルゲートウェイ","Cổng cục bộ","Yerel Ağ Geçidi"],
- "v1.5.0:工作台升级无限空间画布(拖拽缩放、可注入提示词的便签与语义连线),新增多图同屏对比、三阶明度与剪影检查、造型方案与最新生图模型。": ["v1.5.0: Upgraded Studio to an Infinite Spatial Canvas (drag, zoom, prompt-linked sticky notes & semantic wires), plus Side-by-Side Compare, 3-tone Notan & Silhouette check, Studio Recipes, and latest image models.","v1.5.0:スタジオを無限キャンバス化(ドラッグ・ズーム・プロンプト連動付箋・セマンティック配線)。最大4枚比較、3階調明度&シルエット確認、レシピ保存、最新モデル対応も追加。","v1.5.0: Nâng cấp Studio thành Bảng vẽ Không gian Vô hạn (kéo thả, thu phóng, ghi chú nối prompt & dây dẫn ngữ nghĩa), thêm So sánh song song, kiểm tra sắc độ 3 bậc & bóng dáng, Công thức phối đồ và mô hình mới nhất.","v1.5.0: Stüdyo Sonsuz Uzamsal Tuvale yükseltildi (sürükleme, yakınlaştırma, istem bağlantılı yapışkan notlar ve semantik kablolar); Yan Yana Karşılaştırma, 3 ton Notan ve silüet kontrolü, Stüdyo Tarifleri ve en yeni modeller eklendi."],
+ "v1.5.1:工作台升级无限空间画布(拖拽缩放、可注入提示词的便签与语义连线),新增多图同屏对比、三阶明度与剪影检查、造型方案与最新生图模型。": ["v1.5.1: Upgraded Studio to an Infinite Spatial Canvas (drag, zoom, prompt-linked sticky notes & semantic wires), plus Side-by-Side Compare, 3-tone Notan & Silhouette check, Studio Recipes, and latest image models.","v1.5.1:スタジオを無限キャンバス化(ドラッグ・ズーム・プロンプト連動付箋・セマンティック配線)。最大4枚比較、3階調明度&シルエット確認、レシピ保存、最新モデル対応も追加。","v1.5.1: Nâng cấp Studio thành Bảng vẽ Không gian Vô hạn (kéo thả, thu phóng, ghi chú nối prompt & dây dẫn ngữ nghĩa), thêm So sánh song song, kiểm tra sắc độ 3 bậc & bóng dáng, Công thức phối đồ và mô hình mới nhất.","v1.5.1: Stüdyo Sonsuz Uzamsal Tuvale yükseltildi (sürükleme, yakınlaştırma, istem bağlantılı yapışkan notlar ve semantik kablolar); Yan Yana Karşılaştırma, 3 ton Notan ve silüet kontrolü, Stüdyo Tarifleri ve en yeni modeller eklendi."],
"画布工具": ["Canvas tools","キャンバスツール","Công cụ bảng vẽ","Tuval araçları"],
"画布缩放与视图": ["Canvas zoom and view","キャンバスズームと表示","Thu phóng & góc nhìn","Tuval yakınlaştırma ve görünüm"],
"在画布添加导演便签(双击空白处也可添加)": ["Add an art-direction sticky note (or double-click canvas)","アートディレクション付箋を追加(空白ダブルクリックでも追加)","Thêm ghi chú đạo diễn (hoặc nhấp đúp vùng trống)","Sanat yönetimi notu ekle (veya boş tuvale çift tıkla)"],
@@ -895,6 +895,8 @@
"整理无限画布并适配视野": ["Tidy infinite canvas & fit view","無限キャンバスを整列して全体表示","Sắp xếp bảng vẽ vô hạn & vừa khung","Sonsuz tuvali düzenle ve görünüme sığdır"],
"进入全屏专注画布": ["Enter Zen focus canvas","集中フルキャンバスに入る","Vào chế độ tập trung toàn bảng vẽ","Odak tam ekran tuvale gir"],
"退出专注画布": ["Exit Zen focus canvas","集中フルキャンバスを終了","Thoát chế độ tập trung bảng vẽ","Odak tam ekran tuvalden çık"],
+ "下载成品": ["Download image","画像をダウンロード","Tải ảnh về","Görseli indir"],
+ "导入失败:文件中没有有效的方案": ["Import failed: no valid recipes found in file","読み込みに失敗しました:有効なレシピがありません","Nhập thất bại: không có công thức hợp lệ trong tệp","İçe aktarma başarısız: dosyada geçerli tarif bulunamadı"],
};
const formats = [
@@ -989,7 +991,7 @@
for (const attr of attributes) {
// Reference images can have filenames and user-authored labels as their alternative text.
if (attr === 'alt' && !['wbAfter','wbBefore','tgViewImg'].includes(el.id)) continue;
- if (attr === 'title' && el.matches('.card h3,#pkG button,.pick b,.cmp-card h4,.recipe-name')) continue;
+ if (attr === 'title' && el.matches('.card h3,#pkG button,.pick b,.cmp-card h4,.recipe-name,.board-card')) continue;
if (attr === 'aria-label' && el.matches('.card .phk')) continue;
const current = el.getAttribute(attr);
if (current === null) continue;
diff --git a/src/index.html b/src/index.html
index ac79f2b..89f1735 100644
--- a/src/index.html
+++ b/src/index.html
@@ -28,17 +28,17 @@
<filter id="pwNotan3" color-interpolation-filters="sRGB">
<feColorMatrix type="saturate" values="0"/>
<feComponentTransfer>
- <feFuncR type="discrete" tableValues="0.09 0.48 0.93"/>
- <feFuncG type="discrete" tableValues="0.09 0.48 0.93"/>
- <feFuncB type="discrete" tableValues="0.09 0.48 0.93"/>
+ <feFuncR type="discrete" tableValues="0.08 0.08 0.48 0.48 0.94"/>
+ <feFuncG type="discrete" tableValues="0.08 0.08 0.48 0.48 0.94"/>
+ <feFuncB type="discrete" tableValues="0.08 0.08 0.48 0.48 0.94"/>
</feComponentTransfer>
</filter>
<filter id="pwSil" color-interpolation-filters="sRGB">
<feColorMatrix type="saturate" values="0"/>
<feComponentTransfer>
- <feFuncR type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.96"/>
- <feFuncG type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.96"/>
- <feFuncB type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.96"/>
+ <feFuncR type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.96 0.96"/>
+ <feFuncG type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.96 0.96"/>
+ <feFuncB type="discrete" tableValues="0.06 0.06 0.06 0.06 0.06 0.06 0.96 0.96"/>
</feComponentTransfer>
</filter>
<filter id="pwSilDepth" color-interpolation-filters="sRGB">
@@ -219,7 +219,7 @@
</article>
<article id="releaseNotice">
<strong>图库更新</strong>
- <p>v1.5.0:工作台升级无限空间画布(拖拽缩放、可注入提示词的便签与语义连线),新增多图同屏对比、三阶明度与剪影检查、造型方案与最新生图模型。</p>
+ <p>v1.5.1:工作台升级无限空间画布(拖拽缩放、可注入提示词的便签与语义连线),新增多图同屏对比、三阶明度与剪影检查、造型方案与最新生图模型。</p>
</article>
<button id="help" class="notice-help" type="button">快捷键</button>
</section>
diff --git a/src/recipes.js b/src/recipes.js
index 1a1e1bf..0da4f62 100644
--- a/src/recipes.js
+++ b/src/recipes.js
@@ -113,7 +113,7 @@
`<div class="rcp-thumbs">${thumbs || '<span class="rcp-ph">Aa</span>'}</div>` +
`<div class="rcp-meta">` +
`<b class="recipe-name" title="${esc(r.name)}">${esc(r.name)}</b>` +
- `<small>${count ? `${count} 项参考` : '纯提示词'}${r.ar && r.ar !== 'auto' ? ' · ' + esc(r.ar) : ''} · ${esc(stamp)}</small>` +
+ `<small><span>${count ? `${count} 项参考` : '纯提示词'}</span>${r.ar && r.ar !== 'auto' ? ' · ' + esc(r.ar) : ''} · ${esc(stamp)}</small>` +
`</div>` +
`<div class="rcp-act">` +
`<button type="button" class="sm pri" data-rcp-load="${esc(r.id)}">载入</button>` +
@@ -228,42 +228,71 @@
window.APP?.toast(`已导出 ${recipes.length} 个方案`);
}
+ function sanitizeSlot(arr, maxLen, allowTuple) {
+ if (!Array.isArray(arr)) return [];
+ const out = [];
+ for (const entry of arr) {
+ if (out.length >= maxLen) break;
+ if (typeof entry === 'string' && entry.length > 0 && entry.length <= 80) {
+ out.push(entry);
+ } else if (
+ allowTuple &&
+ Array.isArray(entry) &&
+ typeof entry[0] === 'string' &&
+ entry[0].length > 0 &&
+ entry[0].length <= 80
+ ) {
+ const ai = Number.isInteger(entry[1]) && entry[1] >= 0 && entry[1] < 32 ? entry[1] : 0;
+ out.push([entry[0], ai]);
+ }
+ }
+ return out;
+ }
+
async function importJson(file) {
if (!file) return;
+ if (file.size > 2 * 1024 * 1024) {
+ window.APP?.toast('导入失败:文件格式不正确');
+ return;
+ }
try {
const parsed = JSON.parse(await file.text());
- const incoming = Array.isArray(parsed.recipes) ? parsed.recipes : Array.isArray(parsed) ? parsed : null;
+ const incoming = Array.isArray(parsed?.recipes) ? parsed.recipes : Array.isArray(parsed) ? parsed : null;
if (!incoming) throw Error('invalid');
const existingIds = new Set(recipes.map(r => r.id));
let added = 0;
- for (const item of incoming) {
- if (!item || typeof item.name !== 'string' || !item.refs || typeof item.refs !== 'object') continue;
- const id = typeof item.id === 'string' && !existingIds.has(item.id)
+ for (const item of incoming.slice(0, MAX_RECIPES)) {
+ if (!item || typeof item.name !== 'string' || !item.name.trim() || !item.refs || typeof item.refs !== 'object') continue;
+ const id = typeof item.id === 'string' && item.id.length <= 64 && !existingIds.has(item.id)
? item.id
: 'r_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 6);
existingIds.add(id);
recipes.unshift({
id,
- name: item.name.slice(0, 48),
- t: Number(item.t) || Date.now(),
+ name: item.name.trim().slice(0, 48),
+ t: Number.isFinite(Number(item.t)) && Number(item.t) > 0 ? Number(item.t) : Date.now(),
mode: item.mode === 'tryon' ? 'tryon' : 'gen',
- style: typeof item.style === 'string' ? item.style : 'keep',
- shot: typeof item.shot === 'string' ? item.shot : 'auto',
- ar: typeof item.ar === 'string' ? item.ar : 'auto',
+ style: typeof item.style === 'string' ? item.style.slice(0, 32) : 'keep',
+ shot: typeof item.shot === 'string' ? item.shot.slice(0, 32) : 'auto',
+ ar: typeof item.ar === 'string' ? item.ar.slice(0, 16) : 'auto',
pl: item.pl === 'zh' ? 'zh' : 'en',
- extra: typeof item.extra === 'string' ? item.extra : '',
- neg: typeof item.neg === 'string' ? item.neg : '',
- prompt: typeof item.prompt === 'string' ? item.prompt : null,
+ extra: typeof item.extra === 'string' ? item.extra.slice(0, 1000) : '',
+ neg: typeof item.neg === 'string' ? item.neg.slice(0, 1000) : '',
+ prompt: typeof item.prompt === 'string' ? item.prompt.slice(0, 4000) : null,
refs: {
- r: Array.isArray(item.refs.r) ? item.refs.r : [],
- g: Array.isArray(item.refs.g) ? item.refs.g : [],
- p: Array.isArray(item.refs.p) ? item.refs.p : [],
- e: Array.isArray(item.refs.e) ? item.refs.e : [],
- x: Array.isArray(item.refs.x) ? item.refs.x : [],
+ r: sanitizeSlot(item.refs.r, 3, false),
+ g: sanitizeSlot(item.refs.g, 2, true),
+ p: sanitizeSlot(item.refs.p, 6, true),
+ e: sanitizeSlot(item.refs.e, 1, true),
+ x: sanitizeSlot(item.refs.x, 12, true),
},
});
added++;
}
+ if (!added) {
+ window.APP?.toast('导入失败:文件中没有有效的方案');
+ return;
+ }
if (recipes.length > MAX_RECIPES) recipes.length = MAX_RECIPES;
saveStore();
renderList();
diff --git a/src/studio.js b/src/studio.js
index d031f1c..21b91ea 100644
--- a/src/studio.js
+++ b/src/studio.js
@@ -688,19 +688,24 @@
}
};
- function updateStart() {
+ function missingRequirements() {
const ready =
allSelectedCount() ||
$('#wbExtra').value.trim() ||
(window.PoseWearCanvas?.linkedNotesText?.() || '') ||
(W.dirty && $('#wbPrompt').value.trim()) ||
(isGen() && W.char === 'custom' && W.charTxt.trim());
- const need = ready ? [] : ['选择素材或输入提示词'];
+ return ready ? [] : ['选择素材或输入提示词'];
+ }
+
+ function updateStart() {
+ const need = missingRequirements();
const button = $('#wbGo');
if (!W.busy) {
button.disabled = !!need.length;
button.title = need.length ? '请先' + need.join('、') : '';
}
+ window.PoseWearCanvas?.syncMeta?.();
return need;
}
@@ -1644,6 +1649,7 @@
clearInterval(tick);
if (!on) { render(); return; }
go.textContent = '生成中…';
+ window.PoseWearCanvas?.syncMeta?.();
const started = Date.now();
const update = () => {
progress.max = total;
@@ -2012,14 +2018,15 @@
}
e.target.value = '';
};
- $('#wbDl').onclick = () => {
- const r = W.results[W.ri];
+ function downloadResult(idx) {
+ const r = W.results[idx];
if (!r) return;
const link = document.createElement('a');
link.href = U(r.after);
- link.download = `posewear-${r.mode === 'gen' ? 'gen' : 'tryon'}-${stamp(new Date(r.t))}-${String(W.ri + 1).padStart(2, '0')}.png`;
+ link.download = `posewear-${r.mode === 'gen' ? 'gen' : 'tryon'}-${stamp(new Date(r.t || Date.now()))}-${String(idx + 1).padStart(2, '0')}.png`;
link.click();
- };
+ }
+ $('#wbDl').onclick = () => downloadResult(W.ri);
async function useResultAsPerson(idx) {
const r = W.results[idx];
if (!r) return;
@@ -2438,6 +2445,7 @@
generate: () => run(),
viewResult: idx => show(idx),
useResultAsPerson,
+ downloadResult,
isBusy: () => !!W.busy,
getMeta: () => {
const style = STYLES.find(s => s[0] === W.style) || STYLES[0];
@@ -2450,7 +2458,7 @@
styleLabel: style[1],
shotLabel,
jobs: nJobs(),
- canGo: !updateStart().length,
+ canGo: !missingRequirements().length,
busy: !!W.busy,
};
},
@@ -2471,8 +2479,10 @@
try {
await init();
render();
- if (!W.results.length) loadExample();
- requestAnimationFrame(() => window.PoseWearCanvas?.fitToView(false));
+ if (!W.results.length) {
+ await loadExample();
+ if (!allSelectedCount()) requestAnimationFrame(() => window.PoseWearCanvas?.fitToView(false));
+ }
} catch {
toast('试穿台选材加载失败,请重新打开后再试');
}
diff --git a/src/style.css b/src/style.css
index ddd45b1..eb6e713 100644
--- a/src/style.css
+++ b/src/style.css
@@ -4413,6 +4413,15 @@ body.studio .top {
margin-right: auto;
}
+.canvas-head:has(#wbCanvasSwitch:not([hidden])) #wbCanvasTitle {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+}
+
.board-export-acts {
display: inline-flex;
align-items: center;
@@ -4953,6 +4962,7 @@ body.studio .top {
max-height: 256px;
object-fit: contain;
border-radius: 11px;
+ cursor: pointer;
}
.cv-hub-wire {
@@ -5015,6 +5025,12 @@ body.studio .top {
border: 1px solid var(--line2);
}
+.cv-hub-acts .cv-hub-dl {
+ min-width: 28px;
+ padding: 6px;
+ justify-content: center;
+}
+
.cv-out-node {
position: absolute;
transform: translate(-50%, -50%);
@@ -5027,6 +5043,18 @@ body.studio .top {
display: flex;
flex-direction: column;
gap: 6px;
+ cursor: grab;
+ transition: box-shadow .18s var(--out), border-color .18s;
+}
+
+.cv-out-node:hover {
+ border-color: var(--tx2);
+}
+
+.cv-out-node.dragging {
+ cursor: grabbing;
+ z-index: 14;
+ box-shadow: 0 20px 48px rgba(0, 0, 0, .2);
}
.cv-out-node img {
@@ -5036,6 +5064,7 @@ body.studio .top {
object-fit: cover;
border-radius: 9px;
background: var(--sf);
+ cursor: pointer;
}
.cv-out-bar {
@@ -5057,6 +5086,13 @@ body.studio .top {
font-size: 11px;
}
+@media (hover: none) {
+ .board-card .cv-card-bar {
+ opacity: .92;
+ transform: none;
+ }
+}
+
/* Floating Frosted-Glass Canvas HUDs */
.cv-hud {
position: absolute;
@@ -5174,7 +5210,11 @@ body.studio .top {
gap: 14px;
height: auto;
overflow: visible;
- padding: 48px 12px 18px;
+ padding: 54px 12px 18px;
+}
+
+.reference-board[data-layout=compact]:has(#wbCanvasTools[hidden]) {
+ padding-top: 16px;
}
.reference-board[data-layout=compact] .cv-viewport,
@@ -5213,6 +5253,10 @@ body.studio .top {
cursor: pointer;
}
+.reference-board[data-layout=compact] .board-card .cv-card-bar {
+ display: none;
+}
+
.reference-board[data-layout=compact] .cv-notes,
.reference-board[data-layout=compact] .cv-outputs {
display: flex;
@@ -5230,6 +5274,19 @@ body.studio .top {
top: auto !important;
transform: none !important;
width: 100% !important;
+ cursor: default;
+}
+
+.reference-board[data-layout=compact] .cv-hub:not(.has-img) .cv-hub-body {
+ min-height: 92px;
+}
+
+.reference-board[data-layout=compact] .cv-hub:not(.has-img) .cv-hub-wire {
+ height: 76px !important;
+}
+
+.reference-board[data-layout=compact] .cv-hub:not(.has-img) .cv-hub-acts {
+ display: none;
}
.reference-board[data-layout=compact] .board-actions {
@@ -5239,9 +5296,9 @@ body.studio .top {
.reference-board[data-layout=compact] .cv-hud-tl {
top: 8px;
- left: 8px;
- right: 8px;
- justify-content: center;
+ left: 50%;
+ right: auto;
+ transform: translateX(-50%);
}
/* Before/after comparison, busy & output controls */
diff --git a/tests/creative-update-regressions.js b/tests/creative-update-regressions.js
index df67a2a..be305a4 100644
--- a/tests/creative-update-regressions.js
+++ b/tests/creative-update-regressions.js
@@ -369,6 +369,15 @@ async function run() {
});
await page.waitForFunction(() => document.querySelectorAll('#rcpList .rcp-item').length === 2);
assert.equal(await page.locator('#wbRecipeN').textContent(), '2');
+
+ // Empty / invalid recipe import should be rejected cleanly without corrupting store
+ await page.setInputFiles('#rcpImpF', {
+ name: 'empty.json',
+ mimeType: 'application/json',
+ buffer: Buffer.from('{"recipes":[{"bad":1}]}', 'utf8'),
+ });
+ await page.waitForFunction(() => document.querySelector('#toast')?.textContent.includes('没有有效'));
+ assert.equal(await page.locator('#wbRecipeN').textContent(), '2');
await page.keyboard.press('Escape');
console.log('PASS Named Studio Recipes (save, persistence, keep-pose swap, full load, delete+undo, JSON import)');
@@ -408,17 +417,20 @@ async function run() {
}
console.log('PASS 5-language UI parity (en/ja/vi/tr) and preserved user recipe names');
- // 6. Narrow mobile (320x568) + Dark theme overflow & layout check on new controls
+ // 6. Narrow mobile (320x568) + Dark theme overflow & compact HUD pruning check
await page.setViewportSize({ width: 320, height: 568 });
await page.evaluate(() => window.PoseWearTheme.select('dark'));
await page.waitForFunction(() => document.documentElement.dataset.theme === 'dark');
+ await page.waitForFunction(() => document.querySelector('#wbPh0')?.dataset.layout === 'compact');
const studioOverflow = await page.evaluate(() => ({
scrollW: document.documentElement.scrollWidth,
innerW: window.innerWidth,
rcpRect: document.querySelector('#wbRecipesBtn').getBoundingClientRect().toJSON(),
+ hiddenSpatialTools: [...document.querySelectorAll('#wbCanvasTools [data-cv-act="tidy"], #wbCanvasTools [data-cv-act="fit"], #wbCanvasTools [data-cv-act="wires"]')].every(b => b.hidden),
}));
assert.ok(studioOverflow.scrollW <= studioOverflow.innerW + 1, 'Studio should not overflow horizontally at 320px: ' + JSON.stringify(studioOverflow));
assert.ok(studioOverflow.rcpRect.right <= 321 && studioOverflow.rcpRect.left >= 0, '#wbRecipesBtn should stay within 320px viewport');
+ assert.ok(studioOverflow.hiddenSpatialTools, 'Desktop-only tidy/fit/wires canvas tools should be hidden in compact mobile layout');
await page.locator('#wbRecipesBtn').click();
await page.locator('#recipeBox').waitFor({ state: 'visible' });