feat(image-annotate): v1.8.0 快速效果加参数(马赛克块大小 / 柔化半径 / 其余强度)

v1.4 的六个效果都是一键定死强度:马赛克在 800px 图上固定 13px 块挡不住手机号,
柔化固定 1.6px 小图上几乎看不出。现在每个效果都带参数,点完还能继续拖。

参数模型:
- 百分比类(反白/灰度/增强/高对比):强度 0~100%,走 invert()/grayscale() 原生比例,
  其余按 k 插值(高对比 = grayscale(k) contrast(1+1.4k))
- 物理量类:柔化半径 0~16px、马赛克块大小 2~96px,默认值按短边缩放

关键设计:效果不能叠加在自己的结果上。
点效果时把目标层像素备份进 S.fx.source,拖滑杆一律「先还原 source 再按新参数渲染」。
否则「马赛克 12 → 48 → 12」会做三次重采样,块越来越碎且不可逆。

交互约定:
- 一次效果 = 一条撤销(点效果时快照,拖滑杆不再拍)
- 同效果再点 = 回默认值,不再糊一层
- 切到别的层滑杆置灰(源属于旧层),切回自动恢复
- 当前生效效果描橙边;拖滑杆不重建图层面板(否则每帧 innerHTML 会闪)

顺带修了两处既有缺陷:
- .iwb-editor-fx-target 标签从来没被更新过,一直显示「原图」——现在跟随目标层
- 柔化默认过弱(1.6px / 800px 图)——系数改 400、下限 1.2

验证:harness 139 项全通(新增 6 项,含「12→48→12 像素指纹一致」的叠加检测)、
validate 9/9、产物 341608 B。
This commit is contained in:
qiqi committed 2026-11-08 17:06:56 +08:00
1 parent eb90939f11
commit 3819048e54
11 files changed
+710 -50

No files matched your search

+46
View File
@@ -1757,6 +1757,13 @@
.iwb-editor-fx-btn:hover { background: #313244; border-color: #45475a; }
.iwb-editor-fx-btn:active { transform: scale(0.96); }
.iwb-editor-fx-btn:focus-visible { outline: 2px solid #89b4fa; outline-offset: 1px; }
/* v1.8:当前生效的效果。必须与 hover 一眼区分 —— 拖动强度滑杆时要能看出在调哪个效果 */
.iwb-editor-fx-btn.is-active {
background: #2c2735; border-color: #e8a735; color: #f3dcb0;
}
.iwb-editor-fx-btn.is-active .iwb-editor-fx-ico {
box-shadow: inset 0 0 0 1px rgba(232, 167, 53, 0.75);
}
.iwb-editor-fx-ico {
width: 22px; height: 22px; border-radius: 5px; display: block;
background-color: #d9d9e3;
@@ -1780,6 +1787,45 @@
margin: 0; font-size: 10px; line-height: 1.55; color: #6c7086;
}
/* v1.8:效果参数滑杆。范围与单位随效果切换(马赛克=块大小 px、柔化=半径 px、其余=强度 %)。
未点效果 / 目标层被切走时加 .iwb-editor-fx-adj-off 整条置灰。 */
.iwb-editor-fx-adj {
display: flex; flex-direction: column; gap: 4px;
padding: 6px 8px 5px; border-radius: 7px;
background: #1e1e2c; border: 1px solid #2f2f42;
transition: opacity 0.12s ease;
}
.iwb-editor-fx-adj-head {
display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.iwb-editor-fx-adj-name {
font-size: 10.5px; font-weight: 500; color: #b9c0d8;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iwb-editor-fx-adj-val {
font-size: 10.5px; color: #e8a735; font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.iwb-editor-fx-adj-off { opacity: 0.5; }
.iwb-editor-fx-range {
-webkit-appearance: none; appearance: none;
width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer;
}
.iwb-editor-fx-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #313244; }
.iwb-editor-fx-range::-webkit-slider-thumb {
-webkit-appearance: none; appearance: none;
width: 12px; height: 12px; margin-top: -4px; border-radius: 50%;
background: #e8a735; border: 1px solid #1e1e2c;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.iwb-editor-fx-range::-moz-range-track { height: 4px; border-radius: 2px; background: #313244; }
.iwb-editor-fx-range::-moz-range-thumb {
width: 12px; height: 12px; border-radius: 50%; background: #e8a735; border: 1px solid #1e1e2c;
}
.iwb-editor-fx-range:disabled { cursor: default; }
.iwb-editor-fx-range:disabled::-webkit-slider-thumb { background: #585b70; }
.iwb-editor-fx-range:disabled::-moz-range-thumb { background: #585b70; }
.iwb-editor-fx-range:focus-visible { outline: 2px solid #89b4fa; outline-offset: 2px; }
/* ================================================================
v1.6:图层面板多选(⌘/Ctrl 点击)+ 合并按钮
多选用青色侧条与单选(橙色 #e8a735)区分:一个图层可以「被选中但不在合并集合里」,