feat(canvas-v3): P3 插件节点未选中走 canvas 占位 fallback
This commit is contained in:
1 parent
0b1293892c
commit
b0ceb3353d
8 files changed
+24
-13
No files matched your search
@@ -68,6 +68,7 @@
|
||||
const outThumbsFor = typeof o.outThumbsFor === 'function' ? o.outThumbsFor : () => []
|
||||
const onImageLoad = o.onImageLoad
|
||||
const types = Array.isArray(o.types) && o.types.length ? o.types : ['ref']
|
||||
const isType = typeof o.isType === 'function' ? o.isType : (n) => types.indexOf(n.type) >= 0
|
||||
const bg = css('--iwb-panel', '#ffffff')
|
||||
const border = css('--iwb-border2', '#d7dbe2')
|
||||
const text = css('--iwb-text2', '#5f6673')
|
||||
@@ -77,7 +78,7 @@
|
||||
ctx.setTransform(dpr * scale, 0, 0, dpr * scale, dpr * (Number(vp.x) || 0), dpr * (Number(vp.y) || 0))
|
||||
ctx.lineJoin = 'round'
|
||||
for (const n of nodes) {
|
||||
if (!n || types.indexOf(n.type) < 0 || sel.indexOf(n.id) >= 0) continue
|
||||
if (!n || !isType(n) || sel.indexOf(n.id) >= 0) continue
|
||||
const x = n.x, y = n.y, nw = widthOf(n), nh = heightOf(n)
|
||||
// 卡片
|
||||
ctx.fillStyle = bg
|
||||
@@ -89,7 +90,7 @@
|
||||
// 标题
|
||||
ctx.fillStyle = text
|
||||
ctx.font = '600 ' + Math.max(10, 12 / scale * 0.9) + 'px -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif'
|
||||
const title = String((n.data && (n.data.title || n.data.name)) || ({ ref: '参考图', prompt: '提示词', textout: '文本', combine: '组合', batch: '连接', relay: '中继', gen: '生成配置' }[n.type] || '节点'))
|
||||
const title = String((n.data && (n.data.title || n.data.name)) || ({ ref: '参考图', prompt: '提示词', textout: '文本', combine: '组合', batch: '连接', relay: '中继', gen: '生成配置', plugin: '插件' }[n.type] || (String(n.type).indexOf('plugin:') === 0 ? '插件' : '节点')))
|
||||
ctx.save()
|
||||
ctx.beginPath(); ctx.rect(x + 10, y, Math.max(0, nw - 20), headH); ctx.clip()
|
||||
ctx.fillText(title, x + 12, y + 21)
|
||||
|
||||
Reference in new issue
Block a user