feat(image-annotate): 1.2.5 选区命令(全选/反选/取消)移入选择工具选项栏,竖工具条不再占用
This commit is contained in:
1 parent
77b4f7d5fe
commit
c87cec659b
6 files changed
+53
-35
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/image-annotate",
|
||||
"private": true,
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
|
||||
"ibwPlugin": {
|
||||
"id": "image-annotate",
|
||||
|
||||
@@ -1566,6 +1566,11 @@
|
||||
.iwb-editor-header > .iwb-editor-commands .iwb-editor-action:hover:not(:disabled),
|
||||
.iwb-editor-header > .iwb-editor-commands .iwb-editor-layer-btn:hover:not(:disabled) { background: #45475a; }
|
||||
.iwb-editor-header > .iwb-editor-commands .iwb-editor-layer-btn:disabled { opacity: 0.35; cursor: not-allowed; }
|
||||
/* 竖工具条里的选区命令(全选/反选/取消)与工具按钮区分一点点:命令用中性色底 */
|
||||
.iwb-editor-header > .iwb-editor-tools .iwb-editor-selcmd { background: #26263a; }
|
||||
.iwb-editor-header > .iwb-editor-tools .iwb-editor-selcmd:hover { background: #45475a; }
|
||||
/* 选区命令(全选/反选/取消):v1.2.5 起放在「选择」工具的选项栏里,不再占竖工具条 */
|
||||
.iwb-opt-sep { width: 1px; height: 18px; background: #313244; margin: 0 4px 0 auto; flex: 0 0 auto; }
|
||||
.iwb-opt-selcmd {
|
||||
width: 26px; height: 26px; min-width: 26px; padding: 0; border: 0; border-radius: 7px;
|
||||
background: #26263a; color: #cdd6f4; flex: 0 0 auto;
|
||||
display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
|
||||
}
|
||||
.iwb-opt-selcmd:hover { background: #45475a; }
|
||||
@@ -46,12 +46,6 @@ import { bindEvents } from './events.js'
|
||||
</div>
|
||||
<div class="iwb-editor-tools">
|
||||
<button class="iwb-editor-tool" data-tool="select" title="选择/移动:点击元素选中,拖拽移动,手柄调整大小,双击文字改内容"><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="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/></svg></button>
|
||||
|
||||
<!-- 选区命令紧跟「选择」工具(用户裁定 2026-11-04:从「更多」里拿出来,不再藏二级) -->
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.all" title="全选 (Ctrl+A)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 2"><rect x="3.5" y="3.5" width="17" height="17" rx="1"/></svg></button>
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.invert" title="反选 (Ctrl+Shift+I)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><rect x="8" y="8" width="8" height="8" rx="1" fill="currentColor" stroke="none"/></svg></button>
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.none" title="取消选区 (Esc / Ctrl+D)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><line x1="4" y1="20" x2="20" y2="4"/></svg></button>
|
||||
|
||||
<span class="iwb-editor-divider"></span>
|
||||
|
||||
<button class="iwb-editor-tool" data-tool="marquee" title="框选:拖出矩形/椭圆选区,松手后旁边出现操作条(M)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4 3"><rect x="3" y="4" width="18" height="16" rx="1"/></svg></button>
|
||||
|
||||
@@ -864,6 +864,19 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
/** 选择工具:只有选中了元素才出该元素的参数。
|
||||
* 用户裁定 2026-11-04:选中矩形/钢笔后要能就地切描边/实心、改描边粗细,
|
||||
* 不必再切回绘制工具 —— 所以这里复用绘制工具同一套控件与写回路径。 */
|
||||
/** 选区命令(全选/反选/取消):用户裁定 2026-11-04 晚 —— 不放竖工具条,
|
||||
* 启用「选择」工具时显示在工具选项栏里(data-more 走 bindLiteUI 的根级委托)。 */
|
||||
const SELCMD_SVGS = {
|
||||
all: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 2"><rect x="3.5" y="3.5" width="17" height="17" rx="1"/></svg>',
|
||||
invert: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><rect x="8" y="8" width="8" height="8" rx="1" fill="currentColor" stroke="none"/></svg>',
|
||||
none: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><line x1="4" y1="20" x2="20" y2="4"/></svg>'
|
||||
}
|
||||
const selCmdHTML = () =>
|
||||
`<span class="iwb-opt-sep"></span>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.all" title="全选 (Ctrl+A)">${SELCMD_SVGS.all}</button>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.invert" title="反选 (Ctrl+Shift+I)">${SELCMD_SVGS.invert}</button>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.none" title="取消选区 (Esc / Ctrl+D)">${SELCMD_SVGS.none}</button>`
|
||||
|
||||
function selectOptionHTML() {
|
||||
const sh = getSelectedShape()
|
||||
if (sh) {
|
||||
@@ -878,6 +891,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
+ (t === 'pen' && !sh.closed
|
||||
? '<span class="iwb-opt-hint">这条钢笔路径未闭合,实心不生效;点回起点闭合后即可填充</span>'
|
||||
: '')
|
||||
+ selCmdHTML()
|
||||
}
|
||||
}
|
||||
const text = getSelectedText()
|
||||
@@ -885,9 +899,11 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
return `<span class="iwb-opt-current">已选中:文字</span>`
|
||||
+ rangeOpt('textSize', '字号', 8, 400, Math.round(text.fontSize || S.textSize), 'px')
|
||||
+ '<span class="iwb-opt-hint">双击文字改内容,拖动移动,手柄缩放</span>'
|
||||
+ selCmdHTML()
|
||||
}
|
||||
return `<span class="iwb-opt-current">当前工具:选择 / 移动</span>
|
||||
<span class="iwb-opt-hint">点中矩形/圆形/钢笔/文字后,这里会出现它的描边、实心与粗细</span>`
|
||||
+ selCmdHTML()
|
||||
}
|
||||
|
||||
/** 每个工具只露最常用的 2–4 个参数,全部直接写回 S(右侧参数面板同步) */
|
||||
@@ -1101,7 +1117,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
if (toggle) toggle.setAttribute('aria-expanded', 'false')
|
||||
}
|
||||
|
||||
// 选区命令(全选/反选/取消)已从「更多 ▾」搬到竖工具条「选择」后面,改走事件委托:
|
||||
// 选区命令(全选/反选/取消)在「选择」工具的选项栏里,与竖工具条时代一样走根级事件委托:
|
||||
// 三个按钮不切换工具,只调命令层(与快捷键、右键菜单同一条路径)。
|
||||
root.addEventListener('click', (e) => {
|
||||
const btn = e.target.closest('[data-more]')
|
||||
|
||||
+14
-11
@@ -9,7 +9,7 @@
|
||||
var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
id: 'image-annotate',
|
||||
name: '标注 / 修图',
|
||||
version: '1.2.4',
|
||||
version: '1.2.5',
|
||||
apiVersion: 1,
|
||||
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
|
||||
settings: {
|
||||
@@ -2677,12 +2677,6 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
</div>
|
||||
<div class="iwb-editor-tools">
|
||||
<button class="iwb-editor-tool" data-tool="select" title="选择/移动:点击元素选中,拖拽移动,手柄调整大小,双击文字改内容"><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="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/></svg></button>
|
||||
|
||||
<!-- 选区命令紧跟「选择」工具(用户裁定 2026-11-04:从「更多」里拿出来,不再藏二级) -->
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.all" title="全选 (Ctrl+A)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 2"><rect x="3.5" y="3.5" width="17" height="17" rx="1"/></svg></button>
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.invert" title="反选 (Ctrl+Shift+I)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><rect x="8" y="8" width="8" height="8" rx="1" fill="currentColor" stroke="none"/></svg></button>
|
||||
<button class="iwb-editor-tool iwb-editor-selcmd" data-more="sel.none" title="取消选区 (Esc / Ctrl+D)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><line x1="4" y1="20" x2="20" y2="4"/></svg></button>
|
||||
|
||||
<span class="iwb-editor-divider"></span>
|
||||
|
||||
<button class="iwb-editor-tool" data-tool="marquee" title="框选:拖出矩形/椭圆选区,松手后旁边出现操作条(M)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4 3"><rect x="3" y="4" width="18" height="16" rx="1"/></svg></button>
|
||||
@@ -3689,6 +3683,15 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
<button class="iwb-opt-btn${fill ? " active" : ""}" data-opt-toggle="fill" data-fill-owner="${owner}" data-value="fill">实心</button>`;
|
||||
}
|
||||
var SHAPE_NAMES = { rect: "矩形", circle: "圆形", arrow: "箭头", pen: "钢笔路径" };
|
||||
var SELCMD_SVGS = {
|
||||
all: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 2"><rect x="3.5" y="3.5" width="17" height="17" rx="1"/></svg>',
|
||||
invert: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><rect x="8" y="8" width="8" height="8" rx="1" fill="currentColor" stroke="none"/></svg>',
|
||||
none: '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="17" height="17" rx="1" stroke-dasharray="3 2"/><line x1="4" y1="20" x2="20" y2="4"/></svg>'
|
||||
};
|
||||
var selCmdHTML = () => `<span class="iwb-opt-sep"></span>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.all" title="全选 (Ctrl+A)">${SELCMD_SVGS.all}</button>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.invert" title="反选 (Ctrl+Shift+I)">${SELCMD_SVGS.invert}</button>
|
||||
<button class="iwb-opt-selcmd" data-more="sel.none" title="取消选区 (Esc / Ctrl+D)">${SELCMD_SVGS.none}</button>`;
|
||||
function selectOptionHTML() {
|
||||
const sh = getSelectedShape();
|
||||
if (sh) {
|
||||
@@ -3696,15 +3699,15 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (t === "rect" || t === "circle" || t === "pen" || t === "arrow") {
|
||||
const owner = t === "pen" ? "pen" : "rect";
|
||||
const lw = Math.max(1, Math.round(sh.lw || S.shapeLineWidth));
|
||||
return `<span class="iwb-opt-current">已选中:${SHAPE_NAMES[t] || t}</span>` + rangeOpt("shapeLineWidth", "线宽", 1, 60, lw, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + (t === "arrow" ? "" : fillStyleHTML(owner)) + (t === "pen" && !sh.closed ? '<span class="iwb-opt-hint">这条钢笔路径未闭合,实心不生效;点回起点闭合后即可填充</span>' : "");
|
||||
return `<span class="iwb-opt-current">已选中:${SHAPE_NAMES[t] || t}</span>` + rangeOpt("shapeLineWidth", "线宽", 1, 60, lw, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + (t === "arrow" ? "" : fillStyleHTML(owner)) + (t === "pen" && !sh.closed ? '<span class="iwb-opt-hint">这条钢笔路径未闭合,实心不生效;点回起点闭合后即可填充</span>' : "") + selCmdHTML();
|
||||
}
|
||||
}
|
||||
const text = getSelectedText();
|
||||
if (text) {
|
||||
return `<span class="iwb-opt-current">已选中:文字</span>` + rangeOpt("textSize", "字号", 8, 400, Math.round(text.fontSize || S.textSize), "px") + '<span class="iwb-opt-hint">双击文字改内容,拖动移动,手柄缩放</span>';
|
||||
return `<span class="iwb-opt-current">已选中:文字</span>` + rangeOpt("textSize", "字号", 8, 400, Math.round(text.fontSize || S.textSize), "px") + '<span class="iwb-opt-hint">双击文字改内容,拖动移动,手柄缩放</span>' + selCmdHTML();
|
||||
}
|
||||
return `<span class="iwb-opt-current">当前工具:选择 / 移动</span>
|
||||
<span class="iwb-opt-hint">点中矩形/圆形/钢笔/文字后,这里会出现它的描边、实心与粗细</span>`;
|
||||
<span class="iwb-opt-hint">点中矩形/圆形/钢笔/文字后,这里会出现它的描边、实心与粗细</span>` + selCmdHTML();
|
||||
}
|
||||
function optionBarHTML(tool) {
|
||||
if (tool === "crop") return cropOptionHTML();
|
||||
@@ -6073,7 +6076,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.4', 'version=' + boot.version)
|
||||
check('产物可执行(循环打包未炸)', boot.version === '1.2.5', '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 })
|
||||
@@ -439,9 +439,8 @@ const cropAfterA = await dbg()
|
||||
check('裁剪中 Ctrl+A:不建选区、不启动蚂蚁线、浮动条不出现',
|
||||
cropAfterA.selection === null && cropAfterA.ants === false &&
|
||||
(await page.locator('.iwb-editor-sel-bar').isVisible()) === false)
|
||||
await page.locator('.iwb-editor-selcmd[data-more="sel.all"]').click()
|
||||
const cropAfterMenu = await dbg()
|
||||
check('裁剪中「全选」图标同样被拦', cropAfterMenu.selection === null && cropAfterMenu.ants === false)
|
||||
check('裁剪模式下选项栏没有选区命令入口(selcmd 只属于选择工具)',
|
||||
(await page.locator('.iwb-editor-optionbar-body .iwb-opt-selcmd').count()) === 0)
|
||||
await page.mouse.click(box2.x + box2.width * 0.5, box2.y + box2.height * 0.5, { button: 'right' })
|
||||
const menuShown = await page.locator('.iwb-editor-sel-bar.as-menu').count()
|
||||
await page.locator('.iwb-editor-sel-bar button[data-sel-cmd="sel.all"]').click()
|
||||
@@ -667,19 +666,20 @@ check('「更多」菜单已移除,新建/导入/顺序/视图图标进顶栏
|
||||
q('.iwb-editor-header [data-action="togglePanels"]')
|
||||
}))
|
||||
|
||||
check('全选/反选/取消选区三个图标紧跟「选择」工具', await page.evaluate(() => {
|
||||
const tools = Array.from(document.querySelectorAll('.iwb-editor-header > .iwb-editor-tools .iwb-editor-tool'))
|
||||
const idx = tools.findIndex(b => b.dataset.tool === 'select')
|
||||
const cmds = tools.slice(idx + 1, idx + 4)
|
||||
return idx >= 0 && cmds.length === 3 && cmds.every(b => /^sel\./.test(b.dataset.more || ''))
|
||||
await page.locator('.iwb-editor-tool[data-tool="select"]').click()
|
||||
check('选择工具的选项栏里有 全选/反选/取消 三个命令(竖工具条不再有)', await page.evaluate(() => {
|
||||
const cmds = document.querySelectorAll('.iwb-editor-optionbar-body .iwb-opt-selcmd[data-more]')
|
||||
const keys = Array.from(cmds).map(b => b.dataset.more).join(',')
|
||||
return cmds.length === 3 && keys === 'sel.all,sel.invert,sel.none' &&
|
||||
!document.querySelector('.iwb-editor-tools .iwb-editor-selcmd')
|
||||
}))
|
||||
|
||||
await page.locator('.iwb-editor-selcmd[data-more="sel.all"]').click()
|
||||
await page.locator('.iwb-editor-optionbar-body .iwb-opt-selcmd[data-more="sel.all"]').click()
|
||||
const selAllDbg = await dbg()
|
||||
check('点「全选」图标 = Ctrl+A(选区生成)', Boolean(selAllDbg.selection && selAllDbg.selection.w === selAllDbg.doc.w),
|
||||
check('点选项栏「全选」= Ctrl+A(选区生成)', Boolean(selAllDbg.selection && selAllDbg.selection.w === selAllDbg.doc.w),
|
||||
JSON.stringify(selAllDbg.selection))
|
||||
await page.locator('.iwb-editor-selcmd[data-more="sel.none"]').click()
|
||||
check('点「取消选区」图标清掉选区', !(await dbg()).selection)
|
||||
await page.locator('.iwb-editor-optionbar-body .iwb-opt-selcmd[data-more="sel.none"]').click()
|
||||
check('点选项栏「取消选区」清掉选区', !(await dbg()).selection)
|
||||
|
||||
// 画一个矩形 → 切选择工具点中它 → 选项栏就地改 描边/实心 + 线宽
|
||||
await page.locator('.iwb-editor-tool[data-tool="rect"]').click()
|
||||
|
||||
Reference in new issue
Block a user