feat(image-annotate): v1.2.11 选中框手柄/旋转手柄/顶栏与选项栏打磨
- 缩放手柄 17px→11px(形状/文字/位图/放置四处统一),命中半径同步收小 - 旋转手柄重绘:细弧+末端小箭头(旋转语义更直观),线更细、色 #f0b34e - Shift+X 切换选中形状 描边/实心(箭头无实心给提示);isTyping 放行 Shift 组合键, 参数数字框里按 Shift+X 不再被吞 - 硬度:滑杆 84→140px + 5 个快捷点(0/25/50/75/100);笔刷推荐大小 7→4 个 - 顶栏:标题在最前,新建/覆盖/退出跟其后且三键统一中性色;标题后与撤销组后各加竖分隔 - harness 更新/新增断言(115 项全绿)
This commit is contained in:
1 parent
0d161d6ded
commit
c176744846
10 files changed
+153
-59
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/image-annotate",
|
||||
"private": true,
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.11",
|
||||
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
|
||||
"ibwPlugin": {
|
||||
"id": "image-annotate",
|
||||
|
||||
@@ -1546,6 +1546,9 @@
|
||||
border: 1px solid #45475a; border-radius: 4px;
|
||||
}
|
||||
.iwb-editor-optionbar-body .iwb-editor-size-input:focus { outline: none; border-color: #4488ff; }
|
||||
/* 硬度滑杆加宽:参数太密时默认 84px 拉不开,用户反馈「软度调节不明显」(2026-11-04) */
|
||||
.iwb-editor-optionbar-body .iwb-opt-range-wide { width: 140px; }
|
||||
.iwb-editor-optionbar-body .iwb-opt-dots { margin-left: 2px; }
|
||||
.iwb-editor-optionbar-body .iwb-editor-size-input::-webkit-inner-spin-button { -webkit-appearance: none; }
|
||||
.iwb-editor-optionbar-body .iwb-editor-crop-confirm,
|
||||
.iwb-editor-optionbar-body .iwb-editor-crop-cancel {
|
||||
@@ -1589,10 +1592,19 @@
|
||||
.iwb-opt-selcmd:hover { background: #45475a; }
|
||||
|
||||
/* ================================================================
|
||||
v1.2.9:顶栏「新建/覆盖/退出」移到最左(用户裁定 2026-11-04)
|
||||
布局:⟨新建·覆盖·退出⟩ 标题 | 撤销·重做·还原 | 顺序·视图 | …… | 输出·导出
|
||||
会话组不设 order(默认 0 且是 header 第一个子元素)→ 与标题同序时按 DOM 排最前
|
||||
v1.2.11:顶栏次序与配色(用户裁定 2026-11-04 晚)
|
||||
布局:标题 | ⟨新建·覆盖·退出⟩ | 撤销·重做·还原 | 顺序·视图 | …… | 输出·导出
|
||||
标题在前(它是标题,不能跑到按钮后面);会话组三键统一中性色,不再花
|
||||
================================================================ */
|
||||
.iwb-editor-header > .iwb-editor-session { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
|
||||
.iwb-editor-header > .iwb-editor-title { order: 0; }
|
||||
.iwb-editor-header > .iwb-editor-session { order: 1; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-left: 8px; }
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn { padding: 6px 10px; font-size: 11px; min-width: 56px; white-space: nowrap; }
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-download { min-width: 72px; }
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-new,
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-replace,
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-cancel { background: #45475a; color: #cdd6f4; }
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-new:hover,
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-replace:hover,
|
||||
.iwb-editor-header > .iwb-editor-session .iwb-editor-btn-cancel:hover { background: #585b70; }
|
||||
/* 标题与会话组之间、撤销组与命令带之间的竖分隔 */
|
||||
.iwb-editor-header > .iwb-editor-session { margin-right: 4px; }
|
||||
.iwb-editor-header > .iwb-editor-divider { width: 1px; height: 20px; background: #313244; flex: 0 0 auto; margin: 0 4px; }
|
||||
@@ -19,18 +19,19 @@ import { bindEvents } from './events.js'
|
||||
runtime.el.innerHTML = `
|
||||
<div class="iwb-editor-modal">
|
||||
<div class="iwb-editor-header">
|
||||
<!-- 会话组(v1.2.9):新建/覆盖/退出从顶栏最右移到最左(用户裁定 2026-11-04) -->
|
||||
<span class="iwb-editor-title">图片编辑 <em class="iwb-editor-doc-size">—</em></span>
|
||||
<!-- 会话组(v1.2.9):标题是标题、按钮是按钮 —— 新建/覆盖/退出跟在标题后(用户裁定 2026-11-04 晚) -->
|
||||
<div class="iwb-editor-session">
|
||||
<button class="iwb-editor-btn iwb-editor-btn-new" data-action="newNode" title="把当前编辑结果新建为节点(不关闭编辑器)">新建</button>
|
||||
<button class="iwb-editor-btn iwb-editor-btn-replace" data-action="replace" title="用当前编辑结果覆盖原图">覆盖</button>
|
||||
<button class="iwb-editor-btn iwb-editor-btn-cancel" data-action="cancel" title="放弃修改并退出">退出</button>
|
||||
</div>
|
||||
<span class="iwb-editor-title">图片编辑 <em class="iwb-editor-doc-size">—</em></span>
|
||||
<div class="iwb-editor-history">
|
||||
<button class="iwb-editor-action" data-action="undo" title="撤销 (Ctrl+Z)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button>
|
||||
<button class="iwb-editor-action" data-action="redo" title="重做 (Ctrl+Shift+Z)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg></button>
|
||||
<button class="iwb-editor-action iwb-editor-action-reset" data-action="reset" title="还原原图:删掉所有标注/图层,回到打开时的样子(Ctrl+Z 可撤销)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg></button>
|
||||
</div>
|
||||
<span class="iwb-editor-divider"></span>
|
||||
<!-- 顶栏命令带(v1.2.6):撤销/重做/还原 | 顺序 | 视图;图层新建/导入回图层面板标题栏 -->
|
||||
<div class="iwb-editor-commands">
|
||||
<div class="iwb-editor-cmdgroup" data-group="order" title="调整选中元素的图层顺序">
|
||||
|
||||
@@ -857,8 +857,8 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
function fillStyleHTML(owner) {
|
||||
const fill = owner === 'pen' ? S.penFill : S.rectFill
|
||||
return `<span class="iwb-opt-label">样式</span>
|
||||
<button class="iwb-opt-btn${fill ? '' : ' active'}" data-opt-toggle="stroke" data-fill-owner="${owner}" data-value="stroke">描边</button>
|
||||
<button class="iwb-opt-btn${fill ? ' active' : ''}" data-opt-toggle="fill" data-fill-owner="${owner}" data-value="fill">实心</button>`
|
||||
<button class="iwb-opt-btn${fill ? '' : ' active'}" data-opt-toggle="stroke" data-fill-owner="${owner}" data-value="stroke" title="描边 (Shift+X 切换)">描边</button>
|
||||
<button class="iwb-opt-btn${fill ? ' active' : ''}" data-opt-toggle="fill" data-fill-owner="${owner}" data-value="fill" title="实心 (Shift+X 切换)">实心</button>`
|
||||
}
|
||||
|
||||
const SHAPE_NAMES = { rect: '矩形', circle: '圆形', arrow: '箭头', pen: '钢笔路径' }
|
||||
@@ -914,13 +914,14 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
if (tool === 'select') return selectOptionHTML()
|
||||
if (tool === 'brush' || tool === 'eraser') {
|
||||
return rangeOpt('brushSize', '大小', 1, 300, S.brushSize, '')
|
||||
+ presetDots('brushSize', [2, 4, 8, 12, 16, 24, 32])
|
||||
+ presetDots('brushSize', [2, 4, 8, 12])
|
||||
+ `<span class="iwb-opt-label">硬度</span>
|
||||
<input type="range" class="iwb-opt-range" data-opt="brushHardness" min="0" max="100" step="1" value="${S.brushHardness}">
|
||||
<input type="range" class="iwb-opt-range iwb-opt-range-wide" data-opt="brushHardness" min="0" max="100" step="1" value="${S.brushHardness}">
|
||||
<span class="iwb-opt-val" data-opt-val="brushHardness">${S.brushHardness}</span>
|
||||
<span class="iwb-opt-label">透明</span>
|
||||
<input type="range" class="iwb-opt-range" data-opt="brushOpacity" min="5" max="100" step="1" value="${Math.round(S.brushOpacity * 100)}">
|
||||
<span class="iwb-opt-val" data-opt-val="brushOpacity">${Math.round(S.brushOpacity * 100)}%</span>`
|
||||
+ presetDots('brushHardness', [0, 25, 50, 75, 100])
|
||||
}
|
||||
if (tool === 'rect' || tool === 'circle') {
|
||||
return rangeOpt('shapeLineWidth', '线宽', 1, 60, S.shapeLineWidth, '')
|
||||
@@ -1673,7 +1674,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
const cls = t.classList
|
||||
if (cls && (cls.contains('iwb-editor-text-input') || cls.contains('iwb-editor-color-hex-input'))) return true
|
||||
// 以下是参数控件(数字框 / 滑杆)
|
||||
if (e.ctrlKey || e.metaKey || e.altKey) return false
|
||||
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return false
|
||||
if (e.key === 'Delete' || e.key === 'Escape') return false
|
||||
return true
|
||||
}
|
||||
@@ -1740,6 +1741,17 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
return
|
||||
}
|
||||
|
||||
// PS 风格:Shift+X 切换选中形状的 描边/实心(与选项栏按钮共用 setShapeFill)
|
||||
if (!mod && e.shiftKey && key === 'x') {
|
||||
const sh = getSelectedShape()
|
||||
if (sh && !sh.locked) {
|
||||
e.preventDefault()
|
||||
if (sh.type === 'arrow') { toast('箭头没有实心样式', 'info'); return }
|
||||
setShapeFill(!sh.fill, sh.type === 'pen' ? 'pen' : 'rect')
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// PS:] 增大 / [ 减小画笔大小(画笔与橡皮共用,光标环即时反馈)
|
||||
// 同时匹配 e.code(BracketLeft/Right):中文输入法下 e.key 会变成「【」「】」,只看 e.key 会失灵
|
||||
const isBracket = e.key === '[' || e.key === ']' || e.code === 'BracketLeft' || e.code === 'BracketRight'
|
||||
|
||||
@@ -202,7 +202,7 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
if (!(box.w > 0 && box.h > 0)) return
|
||||
const ctx = S.overlayCtx
|
||||
const rot = layer.rotation || 0
|
||||
const hs = 7 / S.zoom
|
||||
const hs = 5.5 / S.zoom
|
||||
ctx.save()
|
||||
ctx.strokeStyle = '#e8a735'
|
||||
ctx.lineWidth = 1.5 / S.zoom
|
||||
|
||||
@@ -309,7 +309,7 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
if (hitRotationHandle(lp, b)) return 'rotate'
|
||||
const pts = shapeHandlePoints(s)
|
||||
const offset = 8 / S.zoom
|
||||
const R = Math.max(18 / S.zoom, 11)
|
||||
const R = Math.max(14 / S.zoom, 9)
|
||||
let best = null, bestDist = 1e9
|
||||
for (const name in pts) {
|
||||
const px = pts[name][0] + (name.includes('w') ? -offset : name.includes('e') ? offset : 0)
|
||||
@@ -405,7 +405,7 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
octx.closePath()
|
||||
octx.stroke()
|
||||
octx.setLineDash([])
|
||||
const hs = 8.5 / S.zoom
|
||||
const hs = 5.5 / S.zoom
|
||||
octx.fillStyle = '#ffffff'
|
||||
octx.strokeStyle = '#e8a735'
|
||||
const pts = shapeHandleWorld(s)
|
||||
@@ -460,7 +460,7 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
octx.closePath()
|
||||
octx.stroke()
|
||||
octx.setLineDash([])
|
||||
const hs = 7 / S.zoom
|
||||
const hs = 5.5 / S.zoom
|
||||
octx.fillStyle = '#ffffff'
|
||||
octx.strokeStyle = '#e8a735'
|
||||
const pts = textHandlePoints(sel)
|
||||
|
||||
@@ -140,7 +140,7 @@ import { updateCursor } from './events.js'
|
||||
ctx.stroke()
|
||||
ctx.setLineDash([])
|
||||
// 8 个缩放手柄(旋转后位置)
|
||||
const hs = 8 / S.zoom
|
||||
const hs = 5.5 / S.zoom
|
||||
ctx.fillStyle = '#fff'
|
||||
ctx.strokeStyle = '#4488ff'
|
||||
ctx.lineWidth = 1.5 / S.zoom
|
||||
|
||||
@@ -260,25 +260,40 @@ import { getSelectedShape, getSelectedText, renderObjects, shapeBounds, textBoun
|
||||
/** 命中旋转手柄(传局部坐标点) */
|
||||
export function hitRotationHandle(lp, b) {
|
||||
const pts = rotationHandlesLocal(b)
|
||||
const R = Math.max(13 / Math.max(S.zoom, 0.0001), 9)
|
||||
const R = Math.max(11 / Math.max(S.zoom, 0.0001), 8)
|
||||
for (const pt of pts) {
|
||||
if (Math.hypot(lp[0] - pt[0], lp[1] - pt[1]) < R) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/** 绘制四个角外侧的圆弧旋转手柄 */
|
||||
/** 绘制四个角外侧的旋转手柄:细弧 + 末端小箭头(旋转语义,比裸 C 弧更可读) */
|
||||
export function drawRotationHandles(ctx, b, rot) {
|
||||
const cx = b.x + b.w / 2, cy = b.y + b.h / 2
|
||||
const pts = rotationHandlesLocal(b)
|
||||
const r = Math.max(8 / Math.max(S.zoom, 0.0001), 6)
|
||||
const k = Math.max(S.zoom, 0.0001)
|
||||
const r = Math.max(6.5 / k, 5)
|
||||
const lw = 1.5 / k
|
||||
const ah = Math.max(3 / k, 2.6) // 箭头长度
|
||||
const A0 = Math.PI * 0.2, A1 = Math.PI * 1.72
|
||||
ctx.save()
|
||||
ctx.strokeStyle = '#e8a735'
|
||||
ctx.lineWidth = 2 / Math.max(S.zoom, 0.0001)
|
||||
ctx.strokeStyle = '#f0b34e'
|
||||
ctx.fillStyle = '#f0b34e'
|
||||
ctx.lineWidth = lw
|
||||
ctx.lineCap = 'round'
|
||||
for (const pt of pts) {
|
||||
const w = rotPt(pt[0], pt[1], cx, cy, rot || 0)
|
||||
ctx.beginPath()
|
||||
ctx.arc(w[0], w[1], r, Math.PI * 0.15, Math.PI * 1.85)
|
||||
ctx.arc(w[0], w[1], r, A0, A1)
|
||||
ctx.stroke()
|
||||
// 弧末端顺时针切线方向的小箭头
|
||||
const ex = w[0] + Math.cos(A1) * r, ey = w[1] + Math.sin(A1) * r
|
||||
const ta = A1 + Math.PI / 2
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(ex + Math.cos(ta) * ah * 1.4, ey + Math.sin(ta) * ah * 1.4)
|
||||
ctx.lineTo(ex + Math.cos(ta + 2.4) * ah, ey + Math.sin(ta + 2.4) * ah)
|
||||
ctx.lineTo(ex + Math.cos(ta - 2.4) * ah, ey + Math.sin(ta - 2.4) * ah)
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
}
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
+47
-20
@@ -9,7 +9,7 @@
|
||||
var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
id: 'image-annotate',
|
||||
name: '标注 / 修图',
|
||||
version: '1.2.10',
|
||||
version: '1.2.11',
|
||||
apiVersion: 1,
|
||||
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
|
||||
settings: {
|
||||
@@ -253,7 +253,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
ctx.closePath();
|
||||
ctx.stroke();
|
||||
ctx.setLineDash([]);
|
||||
const hs = 8 / S.zoom;
|
||||
const hs = 5.5 / S.zoom;
|
||||
ctx.fillStyle = "#fff";
|
||||
ctx.strokeStyle = "#4488ff";
|
||||
ctx.lineWidth = 1.5 / S.zoom;
|
||||
@@ -1114,7 +1114,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (hitRotationHandle(lp, b)) return "rotate";
|
||||
const pts = shapeHandlePoints(s);
|
||||
const offset = 8 / S.zoom;
|
||||
const R = Math.max(18 / S.zoom, 11);
|
||||
const R = Math.max(14 / S.zoom, 9);
|
||||
let best = null, bestDist = 1e9;
|
||||
for (const name in pts) {
|
||||
const px = pts[name][0] + (name.includes("w") ? -offset : name.includes("e") ? offset : 0);
|
||||
@@ -1225,7 +1225,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
octx.closePath();
|
||||
octx.stroke();
|
||||
octx.setLineDash([]);
|
||||
const hs = 8.5 / S.zoom;
|
||||
const hs = 5.5 / S.zoom;
|
||||
octx.fillStyle = "#ffffff";
|
||||
octx.strokeStyle = "#e8a735";
|
||||
const pts = shapeHandleWorld(s);
|
||||
@@ -1276,7 +1276,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
octx.closePath();
|
||||
octx.stroke();
|
||||
octx.setLineDash([]);
|
||||
const hs = 7 / S.zoom;
|
||||
const hs = 5.5 / S.zoom;
|
||||
octx.fillStyle = "#ffffff";
|
||||
octx.strokeStyle = "#e8a735";
|
||||
const pts = textHandlePoints(sel);
|
||||
@@ -1667,7 +1667,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (!(box.w > 0 && box.h > 0)) return;
|
||||
const ctx = S.overlayCtx;
|
||||
const rot = layer.rotation || 0;
|
||||
const hs = 7 / S.zoom;
|
||||
const hs = 5.5 / S.zoom;
|
||||
ctx.save();
|
||||
ctx.strokeStyle = "#e8a735";
|
||||
ctx.lineWidth = 1.5 / S.zoom;
|
||||
@@ -2673,18 +2673,19 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
runtime.el.innerHTML = `
|
||||
<div class="iwb-editor-modal">
|
||||
<div class="iwb-editor-header">
|
||||
<!-- 会话组(v1.2.9):新建/覆盖/退出从顶栏最右移到最左(用户裁定 2026-11-04) -->
|
||||
<span class="iwb-editor-title">图片编辑 <em class="iwb-editor-doc-size">—</em></span>
|
||||
<!-- 会话组(v1.2.9):标题是标题、按钮是按钮 —— 新建/覆盖/退出跟在标题后(用户裁定 2026-11-04 晚) -->
|
||||
<div class="iwb-editor-session">
|
||||
<button class="iwb-editor-btn iwb-editor-btn-new" data-action="newNode" title="把当前编辑结果新建为节点(不关闭编辑器)">新建</button>
|
||||
<button class="iwb-editor-btn iwb-editor-btn-replace" data-action="replace" title="用当前编辑结果覆盖原图">覆盖</button>
|
||||
<button class="iwb-editor-btn iwb-editor-btn-cancel" data-action="cancel" title="放弃修改并退出">退出</button>
|
||||
</div>
|
||||
<span class="iwb-editor-title">图片编辑 <em class="iwb-editor-doc-size">—</em></span>
|
||||
<div class="iwb-editor-history">
|
||||
<button class="iwb-editor-action" data-action="undo" title="撤销 (Ctrl+Z)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button>
|
||||
<button class="iwb-editor-action" data-action="redo" title="重做 (Ctrl+Shift+Z)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg></button>
|
||||
<button class="iwb-editor-action iwb-editor-action-reset" data-action="reset" title="还原原图:删掉所有标注/图层,回到打开时的样子(Ctrl+Z 可撤销)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg></button>
|
||||
</div>
|
||||
<span class="iwb-editor-divider"></span>
|
||||
<!-- 顶栏命令带(v1.2.6):撤销/重做/还原 | 顺序 | 视图;图层新建/导入回图层面板标题栏 -->
|
||||
<div class="iwb-editor-commands">
|
||||
<div class="iwb-editor-cmdgroup" data-group="order" title="调整选中元素的图层顺序">
|
||||
@@ -3705,8 +3706,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
function fillStyleHTML(owner) {
|
||||
const fill = owner === "pen" ? S.penFill : S.rectFill;
|
||||
return `<span class="iwb-opt-label">样式</span>
|
||||
<button class="iwb-opt-btn${fill ? "" : " active"}" data-opt-toggle="stroke" data-fill-owner="${owner}" data-value="stroke">描边</button>
|
||||
<button class="iwb-opt-btn${fill ? " active" : ""}" data-opt-toggle="fill" data-fill-owner="${owner}" data-value="fill">实心</button>`;
|
||||
<button class="iwb-opt-btn${fill ? "" : " active"}" data-opt-toggle="stroke" data-fill-owner="${owner}" data-value="stroke" title="描边 (Shift+X 切换)">描边</button>
|
||||
<button class="iwb-opt-btn${fill ? " active" : ""}" data-opt-toggle="fill" data-fill-owner="${owner}" data-value="fill" title="实心 (Shift+X 切换)">实心</button>`;
|
||||
}
|
||||
var SHAPE_NAMES = { rect: "矩形", circle: "圆形", arrow: "箭头", pen: "钢笔路径" };
|
||||
var SELCMD_SVGS = {
|
||||
@@ -3739,12 +3740,12 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (tool === "crop") return cropOptionHTML();
|
||||
if (tool === "select") return selectOptionHTML();
|
||||
if (tool === "brush" || tool === "eraser") {
|
||||
return rangeOpt("brushSize", "大小", 1, 300, S.brushSize, "") + presetDots("brushSize", [2, 4, 8, 12, 16, 24, 32]) + `<span class="iwb-opt-label">硬度</span>
|
||||
<input type="range" class="iwb-opt-range" data-opt="brushHardness" min="0" max="100" step="1" value="${S.brushHardness}">
|
||||
return rangeOpt("brushSize", "大小", 1, 300, S.brushSize, "") + presetDots("brushSize", [2, 4, 8, 12]) + `<span class="iwb-opt-label">硬度</span>
|
||||
<input type="range" class="iwb-opt-range iwb-opt-range-wide" data-opt="brushHardness" min="0" max="100" step="1" value="${S.brushHardness}">
|
||||
<span class="iwb-opt-val" data-opt-val="brushHardness">${S.brushHardness}</span>
|
||||
<span class="iwb-opt-label">透明</span>
|
||||
<input type="range" class="iwb-opt-range" data-opt="brushOpacity" min="5" max="100" step="1" value="${Math.round(S.brushOpacity * 100)}">
|
||||
<span class="iwb-opt-val" data-opt-val="brushOpacity">${Math.round(S.brushOpacity * 100)}%</span>`;
|
||||
<span class="iwb-opt-val" data-opt-val="brushOpacity">${Math.round(S.brushOpacity * 100)}%</span>` + presetDots("brushHardness", [0, 25, 50, 75, 100]);
|
||||
}
|
||||
if (tool === "rect" || tool === "circle") {
|
||||
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + fillStyleHTML("rect");
|
||||
@@ -4468,7 +4469,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (t.tagName !== "INPUT") return false;
|
||||
const cls = t.classList;
|
||||
if (cls && (cls.contains("iwb-editor-text-input") || cls.contains("iwb-editor-color-hex-input"))) return true;
|
||||
if (e.ctrlKey || e.metaKey || e.altKey) return false;
|
||||
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return false;
|
||||
if (e.key === "Delete" || e.key === "Escape") return false;
|
||||
return true;
|
||||
}
|
||||
@@ -4567,6 +4568,18 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
togglePanelsCollapsed();
|
||||
return;
|
||||
}
|
||||
if (!mod && e.shiftKey && key === "x") {
|
||||
const sh = getSelectedShape();
|
||||
if (sh && !sh.locked) {
|
||||
e.preventDefault();
|
||||
if (sh.type === "arrow") {
|
||||
toast("箭头没有实心样式", "info");
|
||||
return;
|
||||
}
|
||||
setShapeFill(!sh.fill, sh.type === "pen" ? "pen" : "rect");
|
||||
}
|
||||
return;
|
||||
}
|
||||
const isBracket = e.key === "[" || e.key === "]" || e.code === "BracketLeft" || e.code === "BracketRight";
|
||||
if (!mod && !e.altKey && isBracket) {
|
||||
e.preventDefault();
|
||||
@@ -4959,7 +4972,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
}
|
||||
function hitRotationHandle(lp, b) {
|
||||
const pts = rotationHandlesLocal(b);
|
||||
const R = Math.max(13 / Math.max(S.zoom, 1e-4), 9);
|
||||
const R = Math.max(11 / Math.max(S.zoom, 1e-4), 8);
|
||||
for (const pt of pts) {
|
||||
if (Math.hypot(lp[0] - pt[0], lp[1] - pt[1]) < R) return true;
|
||||
}
|
||||
@@ -4968,15 +4981,29 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
function drawRotationHandles(ctx, b, rot) {
|
||||
const cx = b.x + b.w / 2, cy = b.y + b.h / 2;
|
||||
const pts = rotationHandlesLocal(b);
|
||||
const r = Math.max(8 / Math.max(S.zoom, 1e-4), 6);
|
||||
const k = Math.max(S.zoom, 1e-4);
|
||||
const r = Math.max(6.5 / k, 5);
|
||||
const lw = 1.5 / k;
|
||||
const ah = Math.max(3 / k, 2.6);
|
||||
const A0 = Math.PI * 0.2, A1 = Math.PI * 1.72;
|
||||
ctx.save();
|
||||
ctx.strokeStyle = "#e8a735";
|
||||
ctx.lineWidth = 2 / Math.max(S.zoom, 1e-4);
|
||||
ctx.strokeStyle = "#f0b34e";
|
||||
ctx.fillStyle = "#f0b34e";
|
||||
ctx.lineWidth = lw;
|
||||
ctx.lineCap = "round";
|
||||
for (const pt of pts) {
|
||||
const w = rotPt(pt[0], pt[1], cx, cy, rot || 0);
|
||||
ctx.beginPath();
|
||||
ctx.arc(w[0], w[1], r, Math.PI * 0.15, Math.PI * 1.85);
|
||||
ctx.arc(w[0], w[1], r, A0, A1);
|
||||
ctx.stroke();
|
||||
const ex = w[0] + Math.cos(A1) * r, ey = w[1] + Math.sin(A1) * r;
|
||||
const ta = A1 + Math.PI / 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(ex + Math.cos(ta) * ah * 1.4, ey + Math.sin(ta) * ah * 1.4);
|
||||
ctx.lineTo(ex + Math.cos(ta + 2.4) * ah, ey + Math.sin(ta + 2.4) * ah);
|
||||
ctx.lineTo(ex + Math.cos(ta - 2.4) * ah, ey + Math.sin(ta - 2.4) * ah);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
@@ -6204,7 +6231,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
};
|
||||
|
||||
// image-annotate/plugin/editor.css
|
||||
var editor_default = '/* IWB 鲜艺抠图节点 - 注入样式 */\n\n/* 抠图按钮 */\n.iwb-cutout-btn {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n\n.iwb-cutout-btn:hover {\n opacity: 1;\n transform: scale(1.15);\n}\n\n.iwb-cutout-btn svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n/* 正在处理中的按钮状态 */\n.iwb-cutout-btn.processing {\n animation: iwb-cutout-pulse 1s infinite;\n pointer-events: none;\n}\n\n@keyframes iwb-cutout-pulse {\n 0%, 100% { opacity: 0.4; }\n 50% { opacity: 1; }\n}\n\n/* 全屏遮罩 */\n.iwb-cutout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.25);\n display: none;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n gap: 12px;\n z-index: 999999;\n pointer-events: all;\n backdrop-filter: blur(2px);\n}\n\n/* 自定义按钮提示(挂在 body,最高层级,不会被图片遮挡) */\n#iwb-cutout-tip {\n position: fixed;\n z-index: 2147483647;\n background: rgba(30, 30, 46, 0.95);\n color: #fff;\n padding: 5px 10px;\n border-radius: 6px;\n font-size: 12px;\n line-height: 1.5;\n white-space: nowrap;\n pointer-events: none;\n display: none;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);\n border: 1px solid rgba(255, 255, 255, 0.14);\n font-family: system-ui, -apple-system, "Segoe UI", sans-serif;\n max-width: 320px;\n white-space: normal;\n word-break: break-all;\n}\n\n/* 加载动画 */\n.iwb-cutout-spinner {\n width: 48px;\n height: 48px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top-color: #e8a735;\n border-radius: 50%;\n animation: iwb-cutout-spin 0.8s linear infinite;\n}\n\n@keyframes iwb-cutout-spin {\n to { transform: rotate(360deg); }\n}\n\n/* 遮罩文字 */\n.iwb-cutout-text {\n color: #fff;\n font-size: 14px;\n font-weight: 500;\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);\n background: rgba(0, 0, 0, 0.6);\n padding: 8px 16px;\n border-radius: 6px;\n}\n\n/* Toast 提示 */\n.iwb-cutout-toast {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 500;\n z-index: 999999;\n transition: opacity 0.3s;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n display: none;\n max-width: 400px;\n}\n\n.iwb-cutout-toast-success {\n background: #1a7f37;\n color: #fff;\n}\n\n.iwb-cutout-toast-error {\n background: #cf222e;\n color: #fff;\n}\n\n.iwb-cutout-toast-info {\n background: #1f6feb;\n color: #fff;\n}\n\n/* 白底按钮 */\n.iwb-whitebg-btn {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n.iwb-whitebg-btn:hover { opacity: 1; transform: scale(1.15); }\n.iwb-whitebg-btn svg { width: 14px; height: 14px; display: block; }\n.iwb-whitebg-btn.processing { animation: iwb-cutout-pulse 1s infinite; pointer-events: none; }\n\n/* 编辑按钮 */\n.iwb-editor-btn-icon {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n.iwb-editor-btn-icon:hover { opacity: 1; transform: scale(1.15); }\n.iwb-editor-btn-icon svg { width: 14px; height: 14px; display: block; }\n\n/* ==================== 图片编辑器 ==================== */\n\n.iwb-editor-overlay {\n position: fixed;\n top: 0; left: 0;\n width: 100%; height: 100%;\n background: rgba(0, 0, 0, 0.6);\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 999998;\n backdrop-filter: blur(3px);\n}\n\n.iwb-editor-modal {\n background: #1e1e2e;\n border-radius: 0;\n box-shadow: none;\n display: flex;\n flex-direction: column;\n width: 100vw;\n height: 100vh;\n max-width: none;\n max-height: none;\n overflow: visible;\n}\n\n/* 新增:主区域(画布 + 图层面板)flex 布局 */\n.iwb-editor-main {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n overflow: visible;\n}\n\n.iwb-editor-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 16px;\n background: #181825;\n border-bottom: 1px solid #313244;\n flex-wrap: nowrap;\n}\n.iwb-editor-header > .iwb-editor-tools {\n position: absolute;\n left: 12px;\n top: 68px;\n width: 44px;\n flex-direction: column;\n padding: 6px;\n background: #181825;\n border: 1px solid #313244;\n border-radius: 8px;\n z-index: 20;\n}\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action { position: static; }\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="undo"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="redo"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="reset"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="restore"] {\n position: absolute;\n top: -54px;\n left: auto;\n}\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="undo"] { right: 154px; }\n.iwb-editor-header > .iwb-edLine truncated
|
||||
var editor_default = '/* IWB 鲜艺抠图节点 - 注入样式 */\n\n/* 抠图按钮 */\n.iwb-cutout-btn {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n\n.iwb-cutout-btn:hover {\n opacity: 1;\n transform: scale(1.15);\n}\n\n.iwb-cutout-btn svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n/* 正在处理中的按钮状态 */\n.iwb-cutout-btn.processing {\n animation: iwb-cutout-pulse 1s infinite;\n pointer-events: none;\n}\n\n@keyframes iwb-cutout-pulse {\n 0%, 100% { opacity: 0.4; }\n 50% { opacity: 1; }\n}\n\n/* 全屏遮罩 */\n.iwb-cutout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.25);\n display: none;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n gap: 12px;\n z-index: 999999;\n pointer-events: all;\n backdrop-filter: blur(2px);\n}\n\n/* 自定义按钮提示(挂在 body,最高层级,不会被图片遮挡) */\n#iwb-cutout-tip {\n position: fixed;\n z-index: 2147483647;\n background: rgba(30, 30, 46, 0.95);\n color: #fff;\n padding: 5px 10px;\n border-radius: 6px;\n font-size: 12px;\n line-height: 1.5;\n white-space: nowrap;\n pointer-events: none;\n display: none;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);\n border: 1px solid rgba(255, 255, 255, 0.14);\n font-family: system-ui, -apple-system, "Segoe UI", sans-serif;\n max-width: 320px;\n white-space: normal;\n word-break: break-all;\n}\n\n/* 加载动画 */\n.iwb-cutout-spinner {\n width: 48px;\n height: 48px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top-color: #e8a735;\n border-radius: 50%;\n animation: iwb-cutout-spin 0.8s linear infinite;\n}\n\n@keyframes iwb-cutout-spin {\n to { transform: rotate(360deg); }\n}\n\n/* 遮罩文字 */\n.iwb-cutout-text {\n color: #fff;\n font-size: 14px;\n font-weight: 500;\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);\n background: rgba(0, 0, 0, 0.6);\n padding: 8px 16px;\n border-radius: 6px;\n}\n\n/* Toast 提示 */\n.iwb-cutout-toast {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 500;\n z-index: 999999;\n transition: opacity 0.3s;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n display: none;\n max-width: 400px;\n}\n\n.iwb-cutout-toast-success {\n background: #1a7f37;\n color: #fff;\n}\n\n.iwb-cutout-toast-error {\n background: #cf222e;\n color: #fff;\n}\n\n.iwb-cutout-toast-info {\n background: #1f6feb;\n color: #fff;\n}\n\n/* 白底按钮 */\n.iwb-whitebg-btn {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n.iwb-whitebg-btn:hover { opacity: 1; transform: scale(1.15); }\n.iwb-whitebg-btn svg { width: 14px; height: 14px; display: block; }\n.iwb-whitebg-btn.processing { animation: iwb-cutout-pulse 1s infinite; pointer-events: none; }\n\n/* 编辑按钮 */\n.iwb-editor-btn-icon {\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.15s, transform 0.15s;\n}\n.iwb-editor-btn-icon:hover { opacity: 1; transform: scale(1.15); }\n.iwb-editor-btn-icon svg { width: 14px; height: 14px; display: block; }\n\n/* ==================== 图片编辑器 ==================== */\n\n.iwb-editor-overlay {\n position: fixed;\n top: 0; left: 0;\n width: 100%; height: 100%;\n background: rgba(0, 0, 0, 0.6);\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 999998;\n backdrop-filter: blur(3px);\n}\n\n.iwb-editor-modal {\n background: #1e1e2e;\n border-radius: 0;\n box-shadow: none;\n display: flex;\n flex-direction: column;\n width: 100vw;\n height: 100vh;\n max-width: none;\n max-height: none;\n overflow: visible;\n}\n\n/* 新增:主区域(画布 + 图层面板)flex 布局 */\n.iwb-editor-main {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n overflow: visible;\n}\n\n.iwb-editor-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 16px;\n background: #181825;\n border-bottom: 1px solid #313244;\n flex-wrap: nowrap;\n}\n.iwb-editor-header > .iwb-editor-tools {\n position: absolute;\n left: 12px;\n top: 68px;\n width: 44px;\n flex-direction: column;\n padding: 6px;\n background: #181825;\n border: 1px solid #313244;\n border-radius: 8px;\n z-index: 20;\n}\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action { position: static; }\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="undo"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="redo"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="reset"],\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="restore"] {\n position: absolute;\n top: -54px;\n left: auto;\n}\n.iwb-editor-header > .iwb-editor-tools .iwb-editor-action[data-action="undo"] { right: 154px; }\n.iwb-editor-header > .iwb-edLine truncated
|
||||
|
||||
// image-annotate/plugin/glue.js
|
||||
function createGlue(ctx, css) {
|
||||
|
||||
@@ -96,7 +96,7 @@ const boot = await page.evaluate((png) => {
|
||||
window.__commands['annotate-selected'].run().catch(() => {})
|
||||
return { version: window.__manifest.version, settingsSchema: Object.keys(window.__manifest.settings || {}) }
|
||||
}, PNG)
|
||||
check('产物可执行(循环打包未炸)', boot.version === '1.2.10', 'version=' + boot.version)
|
||||
check('产物可执行(循环打包未炸)', boot.version === '1.2.11', 'version=' + boot.version)
|
||||
check('manifest 声明输出预设设置项', boot.settingsSchema.includes('exportPreset') && boot.settingsSchema.includes('panelsCollapsed'), boot.settingsSchema.join(','))
|
||||
|
||||
await page.locator('#iwb-editor-overlay').waitFor({ state: 'visible', timeout: 15000 })
|
||||
@@ -537,8 +537,8 @@ check('侧栏「实心」按钮已移除(选项栏承担该功能)',
|
||||
|
||||
// 快捷点:画笔大小
|
||||
await page.locator('.iwb-editor-tool[data-tool="brush"]').click()
|
||||
check('画笔选项栏有 7 个大小快捷点',
|
||||
(await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"]').count()) === 7)
|
||||
check('画笔选项栏有 4 个大小快捷点(16/24/32 已按用户裁定移除)',
|
||||
(await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"]').count()) === 4)
|
||||
await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"][data-value="12"]').click()
|
||||
check('点快捷点 12:笔刷大小即时生效且选项栏数字框同步',
|
||||
(await dbg()).toolOptions.brushSize === 12 &&
|
||||
@@ -807,6 +807,19 @@ selShapeDbg = await dbg()
|
||||
check('选中矩形就地改线宽 9', selShapeDbg.shapes[selShapeDbg.shapes.length - 1].lw === 9,
|
||||
JSON.stringify(selShapeDbg.shapes.slice(-1)))
|
||||
|
||||
// Shift+X:选中形状切 描边/实心(PS 风格;数字框输完值直接按也必须生效)
|
||||
check('Shift+X 切换选中形状 描边/实心(对象与选项栏按钮同步)', await (async () => {
|
||||
await page.keyboard.press('Shift+x')
|
||||
const d = await dbg()
|
||||
const sh = d.shapes.find(s => s.id === d.selectedShapeId)
|
||||
const btnActive = await page.evaluate(() => document.querySelector('.iwb-editor-optionbar-body [data-opt-toggle="fill"][data-fill-owner="rect"]').classList.contains('active'))
|
||||
const flipped = sh && sh.fill === true && btnActive
|
||||
await page.keyboard.press('Shift+x') // 切回描边,恢复现场
|
||||
const d2 = await dbg()
|
||||
const sh2 = d2.shapes.find(s => s.id === d2.selectedShapeId)
|
||||
return flipped && sh2 && sh2.fill === false
|
||||
})())
|
||||
|
||||
// 钢笔:闭合路径选中后同样可切描边/实心
|
||||
await page.locator('.iwb-editor-tool[data-tool="pen"]').click()
|
||||
const pA = [liveBox.x + liveBox.width * 0.55, liveBox.y + liveBox.height * 0.25]
|
||||
@@ -859,25 +872,39 @@ await page.keyboard.press('Control+z') // 撤销矩形线宽
|
||||
|
||||
// ---- v1.2.9:会话组(新建/覆盖/退出)移到顶栏最左 + 图层 PS 快捷键 ----
|
||||
|
||||
check('顶栏:新建/覆盖/退出 在最左侧(会话组),右侧只剩 输出+导出,下载文案改「导出」', await page.evaluate(() => {
|
||||
check('顶栏:标题最前 → 新建/覆盖/退出(统一中性色)→ 竖分隔 → 撤销组,右侧只剩 输出+导出', await page.evaluate(() => {
|
||||
const q = (s) => document.querySelector(s)
|
||||
const session = q('.iwb-editor-header > .iwb-editor-session')
|
||||
const title = q('.iwb-editor-header > .iwb-editor-title')
|
||||
const ex = q('.iwb-editor-header > .iwb-editor-export-actions')
|
||||
const hist = q('.iwb-editor-header > .iwb-editor-history')
|
||||
const dl = q('.iwb-editor-header [data-action="download"]')
|
||||
if (!session || !title || !ex || !dl) return false
|
||||
if (!session || !title || !hist || !dl) return false
|
||||
const t = title.getBoundingClientRect(), s = session.getBoundingClientRect(), h = hist.getBoundingClientRect()
|
||||
const btns = Array.from(session.querySelectorAll('.iwb-editor-btn')).map(b => b.dataset.action).join(',')
|
||||
const bg = (sel) => getComputedStyle(q(sel)).backgroundColor
|
||||
const unified = bg('.iwb-editor-header .iwb-editor-btn-new') === bg('.iwb-editor-header .iwb-editor-btn-replace') &&
|
||||
bg('.iwb-editor-header .iwb-editor-btn-replace') === bg('.iwb-editor-header .iwb-editor-btn-cancel')
|
||||
return btns === 'newNode,replace,cancel' &&
|
||||
session.getBoundingClientRect().left < title.getBoundingClientRect().left &&
|
||||
ex.contains(dl) && dl.textContent.trim() === '导出' &&
|
||||
!ex.querySelector('[data-action="newNode"]')
|
||||
}))
|
||||
check('顶栏会话组左侧留白 ≤ 12px(贴 header 左内边距)', await page.evaluate(() => {
|
||||
const hdr = document.querySelector('.iwb-editor-header')
|
||||
const s = document.querySelector('.iwb-editor-header > .iwb-editor-session')
|
||||
if (!hdr || !s) return false
|
||||
return s.getBoundingClientRect().left - hdr.getBoundingClientRect().left <= 12
|
||||
t.left < s.left && s.right < h.left &&
|
||||
Boolean(q('.iwb-editor-header > .iwb-editor-divider')) &&
|
||||
unified && dl.textContent.trim() === '导出' &&
|
||||
!q('.iwb-editor-export-actions [data-action="newNode"]')
|
||||
}))
|
||||
check('画笔选项栏:推荐大小只留 4 个快捷点,硬度补 5 个快捷点且滑杆加宽', await (async () => {
|
||||
await page.locator('.iwb-editor-tool[data-tool="brush"]').click()
|
||||
const ok = await page.evaluate(() => {
|
||||
const body = document.querySelector('.iwb-editor-optionbar-body')
|
||||
if (!body) return false
|
||||
const size = body.querySelectorAll('[data-opt-preset="brushSize"]').length
|
||||
const hard = body.querySelectorAll('[data-opt-preset="brushHardness"]').length
|
||||
const wide = Boolean(body.querySelector('input[data-opt="brushHardness"].iwb-opt-range-wide'))
|
||||
return size === 4 && hard === 5 && wide
|
||||
})
|
||||
await page.locator('.iwb-editor-tool[data-tool="select"]').click()
|
||||
return ok
|
||||
})())
|
||||
|
||||
// Shift+X:选中形状切 描边/实心(PS 风格,用户裁定 2026-11-04 晚)
|
||||
|
||||
// 图层快捷键:Ctrl+]/[ 上/下移、Ctrl+Shift+]/[ 置顶/置底、Alt+]/[ 选层、Delete 删图层
|
||||
// 注意:__debug().layers 是 S.layers 数组原序,叠放顺序必须看 z(位图与矢量共用一套 z)
|
||||
|
||||
Reference in new issue
Block a user