feat(image-annotate): 1.2.4 选择态就地改形状参数(描边/实心/线宽) + 顶栏命令带(更多菜单图标化: 新建/导入图层、置顶/上/下/置底、适应窗口、收起侧栏) + 选区命令入竖工具条

This commit is contained in:
qiqi committed 2026-11-04 21:12:36 +08:00
1 parent b83b8f3755
commit 77b4f7d5fe
8 files changed
+307 -147

No files matched your search

+84 -68
View File
@@ -9,7 +9,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.2.3',
version: '1.2.4',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -932,6 +932,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
S.textDrag = null;
S.shapeDrag = null;
S.bitmapDrag = null;
renderOptionBar();
}
function hitUnit(unit, pos) {
const { kind, obj } = unit;
@@ -2655,25 +2656,35 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<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"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg></button>
</div>
<div class="iwb-editor-more-wrap">
<button class="iwb-editor-more-btn" data-action="toggleMore" aria-expanded="false">更多 ▾</button>
<div class="iwb-editor-more-menu">
<button data-more="sel.all">全选 <kbd>Ctrl+A</kbd></button>
<button data-more="sel.invert">反选 <kbd>Ctrl+Shift+I</kbd></button>
<button data-more="sel.none">取消选区 <kbd>Esc</kbd></button>
<span class="iwb-editor-more-sep"></span>
<button data-more="addBlankLayer">新建空白图层</button>
<button data-more="addBitmapLayer">导入图片为图层</button>
<button data-more="zoomFit">适应窗口</button>
<button data-more="reset">还原原图</button>
<span class="iwb-editor-more-sep"></span>
<button data-action="togglePanels">收起 / 展开侧栏</button>
<!-- 顶栏命令带(v1.2.4):原「更多 ▾」菜单全部铺开成图标,按 图层 / 顺序 / 视图 分三组 -->
<div class="iwb-editor-commands">
<div class="iwb-editor-cmdgroup" data-group="layers">
<button class="iwb-editor-action" data-action="addBlankLayer" title="新建空白图层"><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" y="3" width="18" height="18" rx="2"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg></button>
<button class="iwb-editor-action" data-action="addBitmapLayer" title="导入图片为图层(也可直接 ⌘/Ctrl+V 粘贴剪贴板图片)"><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" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/><line x1="19" y1="8" x2="19" y2="14"/><line x1="22" y1="11" x2="16" y2="11"/></svg></button>
</div>
<span class="iwb-editor-divider"></span>
<div class="iwb-editor-cmdgroup" data-group="order" title="调整选中元素的图层顺序">
<button class="iwb-editor-layer-btn" data-layer="top" title="置顶:选中元素移到最上层 (Ctrl+Shift+])"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="5" x2="20" y2="5"/><line x1="12" y1="19" x2="12" y2="5"/><polyline points="6 11 12 5 18 11"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="up" title="上移一层 (Ctrl+])"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="6 11 12 5 18 11"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="down" title="下移一层 (Ctrl+[)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><polyline points="6 13 12 19 18 13"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="bottom" title="置底:选中元素移到最下层 (Ctrl+Shift+[)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><polyline points="6 13 12 19 18 13"/><line x1="4" y1="19" x2="20" y2="19"/></svg></button>
</div>
<span class="iwb-editor-divider"></span>
<div class="iwb-editor-cmdgroup" data-group="view">
<button class="iwb-editor-action" data-action="zoomFit" title="适应窗口"><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="9 3 3 3 3 9"/><polyline points="15 3 21 3 21 9"/><polyline points="3 15 3 21 9 21"/><polyline points="21 15 21 21 15 21"/></svg></button>
<button class="iwb-editor-action" data-action="togglePanels" title="收起 / 展开侧栏(画布优先)"><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" y="4" width="18" height="16" rx="2"/><line x1="9" y1="4" x2="9" y2="20"/></svg></button>
</div>
</div>
<button class="iwb-editor-panel-toggle" data-action="togglePanels" title="收起 / 展开侧栏(画布优先)">⇥</button>
<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>
<button class="iwb-editor-tool" data-tool="lasso" title="套索:按住拖动自由圈选,松手闭合(L)"><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="M4 12c0-4 3.6-7 8-7s8 3 8 7-3.6 7-8 7c-2 0-3.8-.6-5.2-1.6"/><path d="M6.8 17.4 4 20l1.2-3.2"/><circle cx="20" cy="19" r="2"/></svg></button>
@@ -2701,7 +2712,6 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<span class="iwb-editor-divider"></span>
</div>
<span class="iwb-editor-divider"></span>
<div class="iwb-editor-export-actions">
<div class="iwb-editor-export-settings-wrap">
@@ -2751,19 +2761,10 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<div class="iwb-editor-layer-panel">
<div class="iwb-editor-layer-panel-header">
<span class="iwb-editor-layer-panel-title">图层</span>
<div class="iwb-editor-layer-add-group">
<button class="iwb-editor-layer-add-btn" data-action="addBitmapLayer" title="导入图片为新图层(也可直接 ⌘/Ctrl+V 粘贴剪贴板图片)"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/><line x1="19" y1="8" x2="19" y2="14"/><line x1="22" y1="11" x2="16" y2="11"/></svg></button>
<button class="iwb-editor-layer-add-btn" data-action="addBlankLayer" title="新建空白图层"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg></button>
</div>
<!-- 新建图层 / 导入图片已上移到顶栏命令带(v1.2.4),面板只留标题,避免同一功能两个入口 -->
</div>
<div class="iwb-editor-layer-group" title="调整选中元素的图层顺序">
<span class="iwb-editor-constraint-label">图层</span>
<button class="iwb-editor-layer-btn" data-layer="top" title="置顶:选中元素移到最上层 (Ctrl+Shift+])"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="5" x2="20" y2="5"/><line x1="12" y1="19" x2="12" y2="5"/><polyline points="6 11 12 5 18 11"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="up" title="上移一层 (Ctrl+])"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="6 11 12 5 18 11"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="down" title="下移一层 (Ctrl+[)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><polyline points="6 13 12 19 18 13"/></svg></button>
<button class="iwb-editor-layer-btn" data-layer="bottom" title="置底:选中元素移到最下层 (Ctrl+Shift+[)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><polyline points="6 13 12 19 18 13"/><line x1="4" y1="19" x2="20" y2="19"/></svg></button>
</div>
<!-- 图层顺序(置顶/上移/下移/置底)已移到顶栏命令带(v1.2.4) -->
<div class="iwb-editor-layer-list"></div>
</div>
<div class="iwb-editor-canvas-wrap">
@@ -3687,8 +3688,27 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<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>`;
}
var SHAPE_NAMES = { rect: "矩形", circle: "圆形", arrow: "箭头", pen: "钢笔路径" };
function selectOptionHTML() {
const sh = getSelectedShape();
if (sh) {
const t = sh.type;
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>' : "");
}
}
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>
<span class="iwb-opt-hint">点中矩形/圆形/钢笔/文字后,这里会出现它的描边、实心与粗细</span>`;
}
function optionBarHTML(tool) {
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}">
@@ -3726,10 +3746,12 @@ var __IWB_ANNOTATE_MANIFEST__ = {
function renderOptionBar(force) {
const body = runtime.el && runtime.el.querySelector(".iwb-editor-optionbar-body");
if (!body) return;
if (!force && body.dataset.tool === S.tool) {
const sig = S.tool + "|" + (S.selectedShapeId || "") + "|" + (S.selectedTextId || "");
if (!force && body.dataset.sig === sig) {
syncOptionBar();
return;
}
body.dataset.sig = sig;
body.dataset.tool = S.tool;
body.innerHTML = optionBarHTML(S.tool);
if (S.tool === "crop") updateCropInfo();
@@ -3738,12 +3760,14 @@ var __IWB_ANNOTATE_MANIFEST__ = {
function syncOptionBar() {
const body = runtime.el && runtime.el.querySelector(".iwb-editor-optionbar-body");
if (!body) return;
const selShape = S.tool === "select" ? getSelectedShape() : null;
const selText = S.tool === "select" ? getSelectedText() : null;
const val = (key) => {
if (key === "brushSize") return S.brushSize;
if (key === "brushHardness") return S.brushHardness;
if (key === "brushOpacity") return Math.round(S.brushOpacity * 100);
if (key === "shapeLineWidth") return S.shapeLineWidth;
if (key === "textSize") return S.textSize;
if (key === "shapeLineWidth") return selShape ? Math.max(1, Math.round(selShape.lw || S.shapeLineWidth)) : S.shapeLineWidth;
if (key === "textSize") return selText ? Math.round(selText.fontSize || S.textSize) : S.textSize;
if (key === "feather") return S.selectionFeather;
return "";
};
@@ -3760,7 +3784,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
btn.classList.toggle("active", S.selectionKind === btn.dataset.value);
});
body.querySelectorAll("[data-opt-toggle]").forEach((btn) => {
const cur = btn.dataset.fillOwner === "pen" ? S.penFill : S.rectFill;
const owner = btn.dataset.fillOwner === "pen" ? "pen" : "rect";
let cur = owner === "pen" ? S.penFill : S.rectFill;
if (selShape && (owner === "pen" ? selShape.type === "pen" : selShape.type === "rect" || selShape.type === "circle")) {
cur = !!selShape.fill;
}
btn.classList.toggle("active", !!cur === (btn.dataset.value === "fill"));
});
}
@@ -3822,6 +3850,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
saveSnapshot("填充");
sh.fill = isPen ? !!S.penFill && !!sh.closed : !!S.rectFill;
renderObjects();
syncOptionBar();
}
}
function setOptionFromControl(el, committed) {
@@ -3857,41 +3886,22 @@ var __IWB_ANNOTATE_MANIFEST__ = {
const root = runtime.el;
if (!root || root.dataset.liteBound === "1") return;
root.dataset.liteBound = "1";
const moreBtn = root.querySelector('[data-action="toggleMore"]');
const moreMenu = root.querySelector(".iwb-editor-more-menu");
const closeMenus = () => {
if (moreMenu) moreMenu.classList.remove("open");
if (moreBtn) moreBtn.setAttribute("aria-expanded", "false");
const panel = root.querySelector(".iwb-editor-export-settings");
if (panel) panel.classList.remove("open");
const toggle = root.querySelector('[data-action="toggleExportSettings"]');
if (toggle) toggle.setAttribute("aria-expanded", "false");
};
if (moreBtn && moreMenu) {
moreBtn.addEventListener("mousedown", (e) => e.stopPropagation());
moreBtn.addEventListener("click", (e) => {
e.stopPropagation();
const open2 = moreMenu.classList.toggle("open");
moreBtn.setAttribute("aria-expanded", String(open2));
});
}
if (moreMenu) {
moreMenu.addEventListener("mousedown", (e) => e.stopPropagation());
moreMenu.addEventListener("click", (e) => {
const btn = e.target.closest("button");
if (!btn) return;
e.stopPropagation();
const key = btn.dataset.more;
if (key && key.indexOf("sel.") === 0) runCommand(key);
else if (key === "addBlankLayer") addBlankLayer();
else if (key === "addBitmapLayer") {
const b = root.querySelector('.iwb-editor-layer-add-btn[data-action="addBitmapLayer"]');
if (b) b.click();
} else if (key === "zoomFit") setZoomFit();
else if (key === "reset") restoreAll();
closeMenus();
});
}
root.addEventListener("click", (e) => {
const btn = e.target.closest("[data-more]");
if (!btn) return;
e.stopPropagation();
const key = btn.dataset.more;
if (key && key.indexOf("sel.") === 0) runCommand(key);
else if (key === "addBlankLayer") addBlankLayer();
else if (key === "zoomFit") setZoomFit();
else if (key === "reset") restoreAll();
});
root.querySelectorAll('[data-action="togglePanels"]').forEach((btn) => {
btn.addEventListener("mousedown", (e) => e.stopPropagation());
btn.addEventListener("click", (e) => {
@@ -3981,7 +3991,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
}
const modal = root.querySelector(".iwb-editor-modal") || root;
modal.addEventListener("mousedown", (e) => {
if (!e.target.closest(".iwb-editor-more-wrap") && !e.target.closest(".iwb-editor-export-settings-wrap")) closeMenus();
if (!e.target.closest(".iwb-editor-export-settings-wrap")) closeMenus();
}, true);
}
var warnedMissing = /* @__PURE__ */ new Set();
@@ -3997,6 +4007,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
el.addEventListener(type, handler);
return el;
}
function bindAll(selector, type, handler) {
const list = runtime.el.querySelectorAll(selector);
list.forEach((el) => el.addEventListener(type, handler));
return list.length;
}
function bindEvents() {
bindToolButtons();
bindColorPanel();
@@ -4013,6 +4028,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
}
function bindToolButtons() {
runtime.el.querySelectorAll(".iwb-editor-tool").forEach((btn) => {
if (!btn.dataset.tool) return;
btn.addEventListener("mousedown", (e) => e.stopPropagation());
btn.addEventListener("click", () => setTool(btn.dataset.tool));
});
@@ -4143,7 +4159,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
e.stopPropagation();
zoomStep(ZOOM_STEP, S.canvasWrap.clientWidth / 2, S.canvasWrap.clientHeight / 2);
});
bindIf('[data-action="zoomFit"]', "click", (e) => {
bindAll('[data-action="zoomFit"]', "click", (e) => {
e.stopPropagation();
setZoomFit();
});
@@ -4163,8 +4179,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
restoreBtn && restoreBtn.addEventListener("click", restoreOriginal);
}
function bindLayerAddActions() {
bindIf('[data-action="addBitmapLayer"]', "mousedown", (e) => e.stopPropagation());
bindIf('[data-action="addBitmapLayer"]', "click", () => {
bindAll('[data-action="addBitmapLayer"]', "mousedown", (e) => e.stopPropagation());
bindAll('[data-action="addBitmapLayer"]', "click", () => {
const fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.accept = "image/*";
@@ -4184,8 +4200,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
});
fileInput.click();
});
bindIf('[data-action="addBlankLayer"]', "mousedown", (e) => e.stopPropagation());
bindIf('[data-action="addBlankLayer"]', "click", () => {
bindAll('[data-action="addBlankLayer"]', "mousedown", (e) => e.stopPropagation());
bindAll('[data-action="addBlankLayer"]', "click", () => {
addBlankLayer();
});
}
@@ -6016,7 +6032,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
tool: S.tool,
doc: { w: S.imgW, h: S.imgH },
layers: S.layers.map((l) => ({ id: l.id, name: l.name, z: l.z, locked: !!l.locked, visible: l.visible !== false })),
shapes: S.shapeLayers.map((s) => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill })),
shapes: S.shapeLayers.map((s) => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill, closed: !!s.closed })),
texts: S.textLayers.map((t) => ({ id: t.id, text: t.text })),
selectedShapeId: S.selectedShapeId,
selectedTextId: S.selectedTextId,
@@ -6057,7 +6073,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) {