fix(image-annotate): 1.2.3 橡皮修复(漏 import getActiveLayer + 锁定层兜底)/钢笔描边实心切换/侧栏笔刷粗细移除/顶栏输出组右置

This commit is contained in:
qiqi committed 2026-11-04 20:44:52 +08:00
1 parent f50b734fd7
commit b83b8f3755
8 files changed
+190 -242

No files matched your search

+55 -116
View File
@@ -9,7 +9,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.2.2',
version: '1.2.3',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -43,6 +43,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
// 吸管取样用的合成画布缓存(切工具/画布变化时失效)
rectFill: false,
// 矩形/圆形是否实心填充
penFill: true,
// 钢笔闭合路径是否实心填充(只对闭合路径有意义)
// v1.2 工具参数解耦:形状线宽与文字字号不再借用画笔粗细,
// 否则「调细画笔」会顺手把所有形状的描边一起改掉。
shapeLineWidth: 3,
@@ -489,7 +491,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
ctx.lineTo(x2, y2);
ctx.stroke();
ctx.restore();
const active = getActiveLayer2();
const active = getActiveLayer();
if (active && active.id === "draw" && active.sourceCanvas) {
const sourceCtx = active.sourceCanvas.getContext("2d", { willReadFrequently: true });
sourceCtx.save();
@@ -518,7 +520,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
layer._bounds = void 0;
}
function beginStroke() {
bakeDrawableLayer(getActiveLayer2());
bakeDrawableLayer(getActiveLayer());
S.strokeCanvas.width = S.imgW;
S.strokeCanvas.height = S.imgH;
S.strokeCtx.clearRect(0, 0, S.imgW, S.imgH);
@@ -538,7 +540,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
ctx.drawImage(S.strokeCanvas, 0, 0);
ctx.restore();
S.strokeCanvas.style.display = "none";
const active = getActiveLayer2();
const active = getActiveLayer();
if (active && active.id === "draw" && active.sourceCanvas && active.w > 0 && active.h > 0) {
const sourceCtx = active.sourceCanvas.getContext("2d", { willReadFrequently: true });
sourceCtx.save();
@@ -1450,11 +1452,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
el.style.display = u.obj.visible === false ? "none" : "block";
}
}
function getActiveLayer2() {
function getActiveLayer() {
return S.layers.find((l) => l.id === S.activeLayerId) || null;
}
function getActiveCtx() {
const layer = getActiveLayer2();
const layer = getActiveLayer();
return layer && !layer.locked ? layer.ctx : null;
}
function clearSelection({ keepBitmap = false } = {}) {
@@ -1717,7 +1719,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
placeImageDirectly(img);
}
function ensureWritableLayer() {
const current = getActiveLayer2();
const current = getActiveLayer();
if (current && !current.locked) return current;
const id = S.layers.some((l) => l.id === "draw") ? "L" + Date.now() + Math.floor(Math.random() * 1e3) : "draw";
const canvas = createLayerCanvas();
@@ -2423,7 +2425,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
return { canvas: c, x: e.x - pad, y: e.y - pad, w, h };
}
function writableLayer() {
const layer = getActiveLayer2();
const layer = getActiveLayer();
if (!layer || layer.locked) {
toast(layer && layer.locked ? "当前图层已锁定,请先解锁" : "没有可用的图层", "warn");
return null;
@@ -2792,24 +2794,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<aside class="iwb-editor-left">
<div class="iwb-editor-color-panel"><div class="iwb-editor-color-panel-title">调色板</div><div class="iwb-editor-color-picker2"><div class="iwb-color-sv"><span></span></div><div class="iwb-color-hue"><span></span></div></div><div class="iwb-editor-color-fields"><button type="button" class="iwb-editor-color-eye" data-action="palettePick" title="吸色:点击后在画布取样"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m2 22 1-1h3l9-9"/><path d="M3 21v-3l9-9"/><path d="m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3Z"/></svg></button><input class="iwb-editor-color-hex-input" value="#ff4444" maxlength="7"></div><div class="iwb-editor-color-swatches"><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#ff4444" style="background:#ff4444" title="#ff4444"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#ff8800" style="background:#ff8800" title="#ff8800"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#ffd400" style="background:#ffd400" title="#ffd400"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#44dd44" style="background:#44dd44" title="#44dd44"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#00bfa5" style="background:#00bfa5" title="#00bfa5"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#4488ff" style="background:#4488ff" title="#4488ff"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#aa44ff" style="background:#aa44ff" title="#aa44ff"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#ff66aa" style="background:#ff66aa" title="#ff66aa"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#ffffff" style="background:#ffffff" title="#ffffff"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#b8b8b8" style="background:#b8b8b8" title="#b8b8b8"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#555555" style="background:#555555" title="#555555"></button><button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="#000000" style="background:#000000" title="#000000"></button></div></div>
<div class="iwb-editor-params">
<label class="iwb-editor-brush-label">描边
<input type="range" class="iwb-editor-brush-size" min="1" max="300" value="3">
<input type="number" class="iwb-editor-brush-num" min="1" max="300" step="1" value="3" title="输入精确笔刷大小(1~300)">
</label>
<div class="iwb-editor-brush-presets" aria-label="描边快捷值">
<button type="button" class="iwb-editor-brush-preset" data-brush-size="2" title="描边 2"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="4" title="描边 4"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="8" title="描边 8"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="12" title="描边 12"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="16" title="描边 16"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="24" title="描边 24"><i></i></button>
<button type="button" class="iwb-editor-brush-preset" data-brush-size="32" title="描边 32"><i></i></button>
</div>
<!-- 硬度/透明滑杆已移除:与就地选项栏(画笔/橡皮工具态)完全重复,参数只留选项栏一处 -->
</div>
<!-- 描边粗细/快捷点已从侧栏移除(用户裁定 2026-11-04):都收进工具选项栏一处,
侧栏只保留调色板与缩放,避免「同一参数两个入口、数值还对不上」 -->
<div class="iwb-editor-zoom">
<button class="iwb-editor-zoom-btn" data-action="zoomOut" title="缩小 (滚轮向下)">−</button>
<span class="iwb-editor-zoom-val" title="滚轮缩放">100%</span>
@@ -3090,14 +3076,27 @@ var __IWB_ANNOTATE_MANIFEST__ = {
strokeSegment(pos.x, pos.y, pos.x, pos.y);
}
function onEraserMouseDown(pos) {
const layer = getActiveLayer();
if (!layer || layer.locked) return;
let layer = getActiveLayer();
if (!layer || layer.locked) layer = topWritableLayer();
if (!layer) {
toast("没有可擦的图层:先用画笔标注,或在图层面板新建一层", "info");
return;
}
S.activeLayerId = layer.id;
S.selectedLayerId = layer.id;
S.isDrawing = true;
saveSnapshot();
beginStroke();
eraseSegment(pos.x, pos.y, pos.x, pos.y);
}
function topWritableLayer() {
let hit = null;
for (const l of S.layers) {
if (l.locked || l.visible === false) continue;
if (!hit || (l.z || 0) >= (hit.z || 0)) hit = l;
}
return hit;
}
function onPenMouseDown(pos) {
if (!S.penPath) S.penPath = { pts: [], preview: null, closed: false };
const point = { x: clamp(pos.x, 0, S.imgW), y: clamp(pos.y, 0, S.imgH) };
@@ -3615,28 +3614,10 @@ var __IWB_ANNOTATE_MANIFEST__ = {
}
}
function updateBrushUI() {
const slider = runtime.el.querySelector(".iwb-editor-brush-size");
if (!slider) return;
slider.value = S.brushSize;
const num = runtime.el.querySelector(".iwb-editor-brush-num");
if (num && document.activeElement !== num) num.value = S.brushSize;
syncOptionBar();
}
function updateBrushParamUI() {
const g = runtime.el.querySelector(".iwb-editor-brush-group");
if (!g) return;
g.style.display = S.tool === "brush" || S.tool === "eraser" ? "flex" : "none";
const oLabel = g.querySelector(".iwb-editor-opacity-label");
if (oLabel) oLabel.style.display = S.tool === "brush" || S.tool === "eraser" ? "" : "none";
const h = g.querySelector(".iwb-editor-brush-hardness");
if (h) {
h.value = S.brushHardness;
g.querySelector(".iwb-editor-brush-hardness-val").textContent = S.brushHardness;
}
const o = g.querySelector(".iwb-editor-brush-opacity");
if (o) {
o.value = Math.round(S.brushOpacity * 100);
g.querySelector(".iwb-editor-brush-opacity-val").textContent = Math.round(S.brushOpacity * 100) + "%";
}
syncOptionBar();
}
function updateFillUI() {
const b = runtime.el.querySelector('[data-action="toggleFill"]');
@@ -3700,6 +3681,12 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<button type="button" class="iwb-editor-crop-cancel" data-action="cancelCrop" title="Esc">✗ 取消</button>
<span class="iwb-opt-hint">拖出裁剪框;Enter 确认 · Esc 取消;裁剪后可 Ctrl+Z</span>`;
}
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>`;
}
function optionBarHTML(tool) {
if (tool === "crop") return cropOptionHTML();
if (tool === "brush" || tool === "eraser") {
@@ -3711,12 +3698,13 @@ var __IWB_ANNOTATE_MANIFEST__ = {
<span class="iwb-opt-val" data-opt-val="brushOpacity">${Math.round(S.brushOpacity * 100)}%</span>`;
}
if (tool === "rect" || tool === "circle") {
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + `<span class="iwb-opt-label">样式</span>
<button class="iwb-opt-btn${S.rectFill ? "" : " active"}" data-opt-toggle="stroke" data-value="stroke">描边</button>
<button class="iwb-opt-btn${S.rectFill ? " active" : ""}" data-opt-toggle="fill" data-value="fill">实心</button>`;
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + fillStyleHTML("rect");
}
if (tool === "arrow" || tool === "pen") {
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + `<span class="iwb-opt-hint">${tool === "pen" ? "逐点点击,点回起点闭合" : "拖出箭头,松手完成"}</span>`;
if (tool === "arrow") {
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + '<span class="iwb-opt-hint">拖出箭头,松手完成</span>';
}
if (tool === "pen") {
return rangeOpt("shapeLineWidth", "线宽", 1, 60, S.shapeLineWidth, "") + presetDots("shapeLineWidth", [1, 2, 3, 6, 10, 16, 24]) + fillStyleHTML("pen") + '<span class="iwb-opt-hint">逐点点击,点回起点闭合;闭合后可切换描边/实心</span>';
}
if (tool === "text") {
return rangeOpt("textSize", "字号", 8, 400, S.textSize, "px") + '<span class="iwb-opt-hint">点画布输入文字,Enter 确认</span>';
@@ -3772,7 +3760,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
btn.classList.toggle("active", S.selectionKind === btn.dataset.value);
});
body.querySelectorAll("[data-opt-toggle]").forEach((btn) => {
btn.classList.toggle("active", !!S.rectFill === (btn.dataset.value === "fill"));
const cur = btn.dataset.fillOwner === "pen" ? S.penFill : S.rectFill;
btn.classList.toggle("active", !!cur === (btn.dataset.value === "fill"));
});
}
function updateStatusbar() {
@@ -3821,14 +3810,17 @@ var __IWB_ANNOTATE_MANIFEST__ = {
renderObjects();
if (committed) textSnapDone = false;
}
function setShapeFill(fill) {
S.rectFill = !!fill;
function setShapeFill(fill, owner) {
const isPen = owner === "pen";
if (isPen) S.penFill = !!fill;
else S.rectFill = !!fill;
updateFillUI();
syncOptionBar();
const sh = getSelectedShape();
if (sh && (sh.type === "rect" || sh.type === "circle") && !sh.locked) {
const types = isPen ? ["pen"] : ["rect", "circle"];
if (sh && types.indexOf(sh.type) >= 0 && !sh.locked) {
saveSnapshot("填充");
sh.fill = S.rectFill;
sh.fill = isPen ? !!S.penFill && !!sh.closed : !!S.rectFill;
renderObjects();
}
}
@@ -3934,7 +3926,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
const toggle = e.target.closest("[data-opt-toggle]");
if (toggle) {
e.stopPropagation();
setShapeFill(toggle.dataset.value === "fill");
setShapeFill(toggle.dataset.value === "fill", toggle.dataset.fillOwner);
return;
}
const dot = e.target.closest("[data-opt-preset]");
@@ -4011,8 +4003,6 @@ var __IWB_ANNOTATE_MANIFEST__ = {
bindColorPalette();
bindFillToggle();
bindLayerOrderButtons();
bindBrushSizeControls();
bindBrushParams();
bindZoomButtons();
bindHistoryActions();
bindLayerAddActions();
@@ -4144,58 +4134,6 @@ var __IWB_ANNOTATE_MANIFEST__ = {
btn.addEventListener("click", () => moveLayer(btn.dataset.layer));
});
}
function bindBrushSizeControls() {
const slider = runtime.el.querySelector(".iwb-editor-brush-size");
const brushNum = runtime.el.querySelector(".iwb-editor-brush-num");
let lwHistoryPushed = false;
const syncBrushSize = (value, continuous) => {
const v = clamp(parseInt(value, 10) || 1, 1, 300);
S.brushSize = v;
slider.value = v;
if (brushNum && document.activeElement !== brushNum) brushNum.value = v;
const sh = getSelectedShape();
if (sh && !sh.locked && sh.lw !== v) {
if (!continuous || !lwHistoryPushed) {
saveSnapshot();
lwHistoryPushed = true;
}
sh.lw = v;
renderObjects();
renderLayerPanel();
}
if (!continuous) lwHistoryPushed = false;
};
runtime.el.querySelectorAll(".iwb-editor-brush-preset").forEach((btn) => {
btn.addEventListener("mousedown", (e) => e.stopPropagation());
btn.addEventListener("click", () => syncBrushSize(btn.dataset.brushSize, false));
});
slider && slider.addEventListener("input", () => syncBrushSize(slider.value, true));
slider && slider.addEventListener("change", () => syncBrushSize(slider.value, false));
if (brushNum) {
brushNum.addEventListener("mousedown", (e) => e.stopPropagation());
brushNum.addEventListener("input", () => {
const v = clamp(parseInt(brushNum.value, 10) || 1, 1, 300);
syncBrushSize(v, true);
});
brushNum.addEventListener("blur", () => {
brushNum.value = S.brushSize;
lwHistoryPushed = false;
});
}
}
function bindBrushParams() {
const hardnessSlider = runtime.el.querySelector(".iwb-editor-brush-hardness");
hardnessSlider && hardnessSlider.addEventListener("input", () => {
S.brushHardness = parseInt(hardnessSlider.value, 10);
runtime.el.querySelector(".iwb-editor-brush-hardness-val").textContent = S.brushHardness;
});
const opacitySlider = runtime.el.querySelector(".iwb-editor-brush-opacity");
opacitySlider && opacitySlider.addEventListener("input", () => {
S.brushOpacity = parseInt(opacitySlider.value, 10) / 100;
runtime.el.querySelector(".iwb-editor-brush-opacity-val").textContent = opacitySlider.value + "%";
if (S.strokeCanvas) S.strokeCanvas.style.opacity = S.brushOpacity;
});
}
function bindZoomButtons() {
bindIf('[data-action="zoomOut"]', "click", (e) => {
e.stopPropagation();
@@ -4299,7 +4237,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
return;
}
saveSnapshot();
const shape = { id: "s" + Date.now() + Math.floor(Math.random() * 1e3), type: "pen", pts: S.penPath.pts.slice(), closed: !!S.penPath.closed, color: S.color, lw: Math.max(1, S.shapeLineWidth), fill: !!S.penPath.closed, opacity: 1, visible: true, locked: false, z: ++S.zCounter };
const shape = { id: "s" + Date.now() + Math.floor(Math.random() * 1e3), type: "pen", pts: S.penPath.pts.slice(), closed: !!S.penPath.closed, color: S.color, lw: Math.max(1, S.shapeLineWidth), fill: !!S.penFill && !!S.penPath.closed, opacity: 1, visible: true, locked: false, z: ++S.zCounter };
S.shapeLayers.push(shape);
selectUnit("shape", shape.id);
S.penPath = null;
@@ -6091,7 +6029,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
brushOpacity: S.brushOpacity,
shapeLineWidth: S.shapeLineWidth,
textSize: S.textSize,
rectFill: S.rectFill
rectFill: S.rectFill,
penFill: S.penFill
},
history: S.history.length,
historyLabels: S.history.map((s) => s.__label || ""),
@@ -6118,7 +6057,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) {