Files
qiqi 3e76f2792e feat(image-annotate): v1.7.0 图层面板补齐(缩略图 / 重命名 / 不透明度)
按通读代码后定的顺序处理 P3 剩余项里最有价值的三条。

1) 不透明度真正可调
   opacity 字段一直在(合成/合并/导出/快照都读它),但面板没有任何控件能写它,
   roadmap 里标的「已有」与事实不符。现在选中层后在该项下方展开滑杆:
   - 位图走 canvas 的 CSS opacity(像素不动),导出/合并时乘 globalAlpha,所见即所得
   - 文字/形状改完重绘矢量层(不透明度已烘进像素,不能再叠 CSS)
   - input 第一次到达才拍快照,一次拖动只产生 1 条历史;双击滑杆复位 100%
   - 非 100% 且未选中的层在名字旁挂百分比角标

2) 缩略图 + 双击重命名
   - 22px 缩略图(canvas 44 设备像素),等比缩放居中;空图层透出类型图标兜底
   - 绘制合批 90ms,避免每次 renderLayerPanel 都重画几十张
   - 双击名字改名(Enter 提交 / Esc 放弃),改名期间禁用整项拖动

3) 顺手清理
   - 删除 .iwb-layer-color / .iwb-layer-width 两个永远看不见的死控件
     (CSS display:none !important 写了三遍),连同绑定与死样式
   - pasteImageFromUrl 的 window.alert 改 toast(阻塞弹窗在宿主里会卡整页)
   - resetState() 补清 layerMulti / hoverPos / lastClick / lastNameClick / altPicker

关键修正:矢量层不透明度只能乘一次。
drawVectorToCanvas / drawShape 已把 opacity 画进像素,getCompositeCanvas 与
composeUnitsInto 再乘 globalAlpha 就是双倍透明 —— 两处都改为只对位图乘。

验证:harness 133 项全通(新增 4 项)、validate 9/9、产物 331811 B。
harness 的版本断言改为读 package.json,不再硬编码。
2026-11-08 16:43:38 +08:00

12 lines
295 B
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "@iwb-plugin/image-annotate",
"private": true,
"version": "1.7.0",
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
"ibwPlugin": {
"id": "image-annotate",
"entry": "src/index.js",
"apiVersion": 1
}
}