Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d16e68bfa9 | ||
|
|
00a2699e89 | ||
|
|
fdfb4ed603 | ||
|
|
929b7ec2a1 |
No files matched your search
@@ -234,6 +234,90 @@ P 下双击 = 结束当前路径(`commitPenPath`),不再进节点编辑。
|
|||||||
- 文字 / 形状 / 钢笔会被直接栅格化进结果层(PS 合并矢量层也是这个结果)。
|
- 文字 / 形状 / 钢笔会被直接栅格化进结果层(PS 合并矢量层也是这个结果)。
|
||||||
- 结果层落回「原最低参与层」的位置,`assignLayerZ` 重新连续编号,不产生重复 z。
|
- 结果层落回「原最低参与层」的位置,`assignLayerZ` 重新连续编号,不产生重复 z。
|
||||||
|
|
||||||
|
## v1.20.0:去色下移成常用色第一格 / 头部全部定宽,不再被自动布局抵掉
|
||||||
|
|
||||||
|
用户截图反馈:「如果是文本元素的时候,就会把那个去色按钮给丢掉…可以让这些颜色选项一直保持在上面,
|
||||||
|
只是说不可用的时候是灰色。那个吸色、去色,数值框可以就固定了,避免自动布局给它抵掉」,
|
||||||
|
随后补一句「或者你把去色按钮放在常用颜色的第一个」。
|
||||||
|
|
||||||
|
**根因**:头部一行本来就是「3 个 tab + 竖线 + 吸管 + 色值 + 去色 + 图钉」,440px 的面板里
|
||||||
|
content 只有 416px,文字工具多出「底色」tab 时已经超出 3px —— 色值框当时是 `flex: 0 1 150px`,
|
||||||
|
自己缩到 147 顶着,再去掉一份宽度,`去色` 就被 flex 压没了(不是被 `hidden` 藏起来的)。
|
||||||
|
|
||||||
|
**做法(两条一起做,正好互相成全)**:
|
||||||
|
|
||||||
|
```
|
||||||
|
[文字●][描边●][底色●] │ ⌖ [ #2F6FED ] │ 📌
|
||||||
|
常用色 [⊘][🔴][🟠][🟡][🟢][🟩][🔵][🩷]
|
||||||
|
[⚪][⚫灰][⚫][🟥][🟩][🟦][🟪] ← 去色 = 第一格,永远在
|
||||||
|
```
|
||||||
|
|
||||||
|
- **去色 = 常用色网格第一格**(20px 圆、虚线边框 + 斜圈图标、间距跟色块完全一致)。
|
||||||
|
位置永远固定,切到文字色 / 未闭合钢笔这类「去掉就等于删对象」的上下文——
|
||||||
|
**不再 hidden,改成 `disabled` + 32%→42% 不透明度**,title 写明原因
|
||||||
|
(「去色不可用:文字色去掉就等于把文字删了」),hover 反馈也随 `:disabled` 关掉。
|
||||||
|
- **头部元素全部定宽**:色值框 `flex: 0 0 124px`(原来是可缩的 150px)、吸管 26、图钉 24、tab 不可压缩。
|
||||||
|
加上「底色」tab 后色值框宽度与图钉右边缘**一格像素都不动**,harness 有专门的回归断言
|
||||||
|
(`hexW: [124,124]`、`pinR: [762,762]`)。
|
||||||
|
- 常用色 16 → 15(亮紫 `#aa44ff` 让位给去色第一格,深紫 `#6b4fbb` 还在),
|
||||||
|
去色 + 15 色正好仍是 8 列 × 2 行,不出现第 3 行孤零零一个色块。
|
||||||
|
- 删掉 `:has(> .iwb-color-pop-none[hidden]) > .iwb-color-pop-bar { display: none }`:
|
||||||
|
去色不再隐藏,竖线也就没有「悬空」问题,头部结构变成纯静态。
|
||||||
|
|
||||||
|
测试:harness 231 项(新增「去色是第一格 / 加底色 tab 后头部纹丝不动 / 文字色下去色置灰」3 条,
|
||||||
|
另有 4 条旧断言从看 `.hidden` 改成看 `.disabled`);真站 e2e 40 项(改为校验 `noneFirst` + 15 色)。
|
||||||
|
|
||||||
|
## v1.19.0:右栏调色模块退场 / 头部一行装完 / 常用色 16 个 + 最近两排
|
||||||
|
|
||||||
|
用户一段话:「右边栏的调色模块就可以去掉了,然后还去一个去色按钮,可以放在钉住按钮的左边,
|
||||||
|
用竖线分割,然后我希望最近色多几个…把吸色与色值数放在钉住按钮的一排,那下面的最近色就可以放两排了。
|
||||||
|
后宽度可以再多一点点,就是让颜色按钮一排可以放 8 个,那你就需要多加 4 个常用色」。
|
||||||
|
|
||||||
|
**1) 右栏常驻调色面板删除。**
|
||||||
|
色板现在只有工具栏弹层一处。v1.16 加它是因为「不想每次点开弹层」,但 v1.18 的钉住已经解决了同一件事——
|
||||||
|
弹层钉住后本来就是一个常开的浮层,右栏那份是同样内容的第二个副本,还占着最显眼的位置。
|
||||||
|
顺带少了一层「同一份 DOM 两套 CSS 布局」的分支,改色板不用再担心改了这头没那头。
|
||||||
|
|
||||||
|
**2) 头部一行装完**:调色槽 │ 吸管 + 色值 │ 去色 │ 图钉
|
||||||
|
|
||||||
|
```
|
||||||
|
[描边●][填充●] │ ⌖ [ #FFD400 ] │ [⊘ 去色] │ 📌
|
||||||
|
```
|
||||||
|
|
||||||
|
- 吸管与色值从右列搬到头部,body 的整块高度都留给色块 —— 这是「最近色能放两排」的前提。
|
||||||
|
- 「无」改名**去色**,挪到图钉左边、用 1px 竖线隔开:调色时「这一项不上色」和「钉住」都是随手要按的开关。
|
||||||
|
对描边/填充/底色都生效,title 随当前槽变。
|
||||||
|
- 没有可去色的上下文(没选中对象、文字色这种单槽)时它本来就隐藏,**它前面那条竖线跟着一起藏**
|
||||||
|
(`:has(> .iwb-color-pop-none[hidden])`),否则头部右侧会留一截悬空的「||」。
|
||||||
|
> v1.20 已推翻:隐藏 ⇒ 置灰 disabled,且整颗下移到常用色第一格(见上一节)。
|
||||||
|
- 「去色 | 图钉」整组用 `margin-left: auto` 贴最右,色值框固定 150px 不被拉成长条
|
||||||
|
(拉长后视觉重心全跑到输入框上,色块反倒成了配角)。tab 加 `flex: 0 0 auto; white-space: nowrap`——
|
||||||
|
宽度不够时该缩的是色值框,不是把「描边」压成竖排两个字。
|
||||||
|
> v1.20 已改:色值框收紧到定宽 124px 且不再可缩 —— 就是「该缩的是色值框」这条把去色缩没了。
|
||||||
|
|
||||||
|
**3) 色块 8 列 × 2 行,常用色 12 → 16,最近色 6 → 16。**
|
||||||
|
|
||||||
|
第一行是 8 个饱和亮色,第二行是 4 个中性色 + 4 个同色系「深一档」:
|
||||||
|
|
||||||
|
```
|
||||||
|
亮:#ff4444 #ff8a00 #ffd400 #4cd964 #00bfa5 #4488ff #aa44ff #ff66aa
|
||||||
|
常:#ffffff #d0d0d0 #808080 #000000 #c0392b #0f9d58 #1677ff #6b4fbb
|
||||||
|
```
|
||||||
|
|
||||||
|
加的那 4 个(深红/深绿/深蓝/深紫)在浅色底图上比亮色稳,做描边不刺眼。色块 18 → 20px。
|
||||||
|
弹层 **380×153 → 440×157**(宽度 +16%,高度只 +4px —— 多出来的一排被「吸管+色值上移」抵掉了)。
|
||||||
|
|
||||||
|
两个刻意的决定:
|
||||||
|
|
||||||
|
- **弹层宽度写死 440px**。绝对定位元素是 shrink-to-fit,宽度会跟着最长内容走:
|
||||||
|
文字工具多出「底色」tab 时头部变宽,弹层当场变宽 17px 再跳回来,定位还得重算。
|
||||||
|
- **分隔线从 `#313244` 提到 `#3b3b4e`**。没有小标题时,这条线是唯一能看出「常用 / 最近」分界的东西,
|
||||||
|
按原色画在深底上几乎看不见。
|
||||||
|
|
||||||
|
**验证**:harness 229 项、真站 e2e 40 项全绿。新增 harness 断言:头部四个控件同一水平线 + 去色在图钉左边 +
|
||||||
|
两者之间有竖线 + 三 tab(文字工具)时头部不横向溢出、常用色 16 个严格 8 列 2 行、最近色网格 8 列 2 排、
|
||||||
|
弹层宽高区间、右栏第一个模块是「图片调节」且无 `[data-color-surface]`。
|
||||||
|
|
||||||
## v1.18.0:色板可以「钉住」+ 右列竖向收窄 + 撤销组搬进工具条
|
## v1.18.0:色板可以「钉住」+ 右列竖向收窄 + 撤销组搬进工具条
|
||||||
|
|
||||||
用户两句话:「这个弹出的调色气泡,加一个功能就是让他能够钉住,在需要调色的时候不用每次都要点开」
|
用户两句话:「这个弹出的调色气泡,加一个功能就是让他能够钉住,在需要调色的时候不用每次都要点开」
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@iwb-plugin/image-annotate",
|
"name": "@iwb-plugin/image-annotate",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.18.0",
|
"version": "1.20.0",
|
||||||
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
|
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
|
||||||
"ibwPlugin": {
|
"ibwPlugin": {
|
||||||
"id": "image-annotate",
|
"id": "image-annotate",
|
||||||
|
|||||||
@@ -277,7 +277,6 @@
|
|||||||
.iwb-editor-params .iwb-editor-zoom { margin-left: auto; order: 20; }
|
.iwb-editor-params .iwb-editor-zoom { margin-left: auto; order: 20; }
|
||||||
.iwb-editor-top-colors { display: none; }
|
.iwb-editor-top-colors { display: none; }
|
||||||
|
|
||||||
.iwb-editor-colors { display: flex; gap: 4px; }
|
|
||||||
.iwb-editor-color {
|
.iwb-editor-color {
|
||||||
width: 20px; height: 20px;
|
width: 20px; height: 20px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@@ -1788,16 +1787,31 @@
|
|||||||
|
|
||||||
.iwb-editor-color-pop {
|
.iwb-editor-color-pop {
|
||||||
position: absolute; z-index: 60; display: flex; flex-direction: column; align-items: stretch; gap: 7px;
|
position: absolute; z-index: 60; display: flex; flex-direction: column; align-items: stretch; gap: 7px;
|
||||||
|
/* 固定宽度(不是让内容撑):绝对定位元素是 shrink-to-fit,宽度会跟着最长内容走 ——
|
||||||
|
文字工具多出「底色」tab 时头部变宽,弹层当场变宽 17px 再跳回来,定位也要重算。
|
||||||
|
440 = 内容 416(SV 176 + 8 + 色相 16 + 10 + 1 + 10 + 色块 195)+ 左右 padding 22 + 边框 2。 */
|
||||||
|
box-sizing: border-box; width: 440px;
|
||||||
padding: 9px 11px; border-radius: 12px;
|
padding: 9px 11px; border-radius: 12px;
|
||||||
background: rgba(24, 24, 37, 0.97); border: 1px solid #313244;
|
background: rgba(24, 24, 37, 0.97); border: 1px solid #313244;
|
||||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
|
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
|
||||||
-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
|
-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
.iwb-editor-color-pop[hidden] { display: none; }
|
.iwb-editor-color-pop[hidden] { display: none; }
|
||||||
/* 弹层头部:说明现在调的是描边还是填充,并可直接换;右侧是「无」(仅填充) */
|
/* 弹层头部(v1.19 一行装完):
|
||||||
|
调哪个槽(描边/填充/底色)│ 吸管 + 色值 │ 去色 │ 图钉
|
||||||
|
原来「吸管 + 色值」在右列占一整块,现在提到头部,body 的整块高度都留给色块。 */
|
||||||
.iwb-color-pop-head { display: flex; align-items: center; gap: 6px; }
|
.iwb-color-pop-head { display: flex; align-items: center; gap: 6px; }
|
||||||
|
/* 竖线:分隔「调哪个槽 / 取色工具 / 去色·钉住」三组,比空白更清楚,又不加边框重量 */
|
||||||
|
.iwb-color-pop-bar { width: 1px; height: 16px; background: #313244; flex: 0 0 auto; }
|
||||||
|
/* 「去色 | 图钉」整组贴最右(margin-left:auto)。这样色值框不用拉成一条长条去填空,
|
||||||
|
头部是「左边调色槽与工具 / 右边一个开关」两段式,扫视时不会把 HEX 当成主角。 */
|
||||||
|
.iwb-color-pop-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
|
||||||
|
|
||||||
.iwb-color-pop-tab {
|
.iwb-color-pop-tab {
|
||||||
display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
|
display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
|
||||||
|
/* 不许被压缩、不许折行:头部一行要同时装下 tab + 吸管 + 色值 + 去色 + 图钉,
|
||||||
|
宽度不够时该缩的是色值框(flex:0 1),不是把「描边」压成竖排两个字 */
|
||||||
|
flex: 0 0 auto; white-space: nowrap;
|
||||||
border: 1px solid transparent; border-radius: 7px; background: #232334;
|
border: 1px solid transparent; border-radius: 7px; background: #232334;
|
||||||
color: #a6adc8; font: 500 11.5px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
|
color: #a6adc8; font: 500 11.5px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -1814,47 +1828,70 @@
|
|||||||
background-image: linear-gradient(135deg, transparent calc(50% - 1px), #f38ba8 calc(50% - 1px), #f38ba8 calc(50% + 1px), transparent calc(50% + 1px));
|
background-image: linear-gradient(135deg, transparent calc(50% - 1px), #f38ba8 calc(50% - 1px), #f38ba8 calc(50% + 1px), transparent calc(50% + 1px));
|
||||||
}
|
}
|
||||||
.iwb-color-pop-tab[hidden] { display: none; }
|
.iwb-color-pop-tab[hidden] { display: none; }
|
||||||
|
/* 去色(v1.20,用户 2026-11-10):头部那颗带文字的按钮下移到「常用色第一格」,
|
||||||
|
尺寸、间距跟色块完全一致(20px 圆),只是画虚线边框 + 斜圈图标 ——
|
||||||
|
它是开关不是色块,所以不用填充色表达状态,只换边框/图标色。
|
||||||
|
永远显示(不可用时不 hidden,只 disabled + 变灰),位置才记得住、头部也不重排。 */
|
||||||
.iwb-color-pop-none {
|
.iwb-color-pop-none {
|
||||||
margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
|
flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
|
||||||
border: 1px dashed #585b70; border-radius: 7px; background: transparent; color: #a6adc8;
|
width: 20px; height: 20px; padding: 0; margin: 0; box-sizing: border-box;
|
||||||
font: 500 11.5px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; cursor: pointer;
|
border: 1px dashed #585b70; border-radius: 50%; background: transparent; color: #a6adc8;
|
||||||
|
cursor: pointer; transition: transform 0.08s ease, border-color 0.12s ease, color 0.12s ease;
|
||||||
}
|
}
|
||||||
.iwb-color-pop-none span {
|
.iwb-color-pop-none svg { flex: 0 0 auto; width: 12px; height: 12px; }
|
||||||
width: 11px; height: 11px; border-radius: 3px; display: block; background-color: #45475a;
|
/* hover 只对可用态生效:disabled 时不该有放大反馈,否则看着像能点 */
|
||||||
background-image: linear-gradient(135deg, transparent calc(50% - 1px), #f38ba8 calc(50% - 1px), #f38ba8 calc(50% + 1px), transparent calc(50% + 1px));
|
.iwb-color-pop-none:not(:disabled):hover { border-color: #f38ba8; color: #f38ba8; transform: scale(1.14); }
|
||||||
|
.iwb-color-pop-none.active { border-style: solid; border-color: #f38ba8; color: #f38ba8; background: rgba(243, 139, 168, 0.14); }
|
||||||
|
/* 不可用:整颗压到 42% 不透明度 —— 灰到能看出「这里有个去色,但现在用不上」,
|
||||||
|
但不至于淡到看不见(32% 时在深底上几乎消失,等于又变成了「消失」,只是慢一点)。
|
||||||
|
cursor 保持 default,不给 pointer。 */
|
||||||
|
.iwb-color-pop-none:disabled,
|
||||||
|
.iwb-color-pop-none.is-disabled {
|
||||||
|
opacity: 0.42; cursor: default; color: #8b8fa8; border-color: #4a4a5e;
|
||||||
|
background: transparent; transform: none;
|
||||||
}
|
}
|
||||||
.iwb-color-pop-none:hover { border-color: #f38ba8; color: #f38ba8; }
|
|
||||||
.iwb-color-pop-none.active { border-style: solid; border-color: #f38ba8; color: #f38ba8; background: rgba(243, 139, 168, 0.12); }
|
|
||||||
.iwb-color-pop-none[hidden] { display: none; }
|
.iwb-color-pop-none[hidden] { display: none; }
|
||||||
.iwb-color-pop-body { display: flex; align-items: stretch; gap: 10px; }
|
.iwb-color-pop-body { display: flex; align-items: stretch; gap: 10px; }
|
||||||
.iwb-color-pop-picker { display: flex; gap: 8px; flex: 0 0 auto; }
|
.iwb-color-pop-picker { display: flex; gap: 8px; flex: 0 0 auto; }
|
||||||
.iwb-editor-color-pop .iwb-color-sv { width: 176px; height: 102px; flex: 0 0 176px; }
|
.iwb-editor-color-pop .iwb-color-sv { width: 176px; height: 104px; flex: 0 0 176px; }
|
||||||
.iwb-editor-color-pop .iwb-color-hue { width: 16px; height: 102px; flex: 0 0 16px; }
|
.iwb-editor-color-pop .iwb-color-hue { width: 16px; height: 104px; flex: 0 0 16px; }
|
||||||
.iwb-color-pop-sep { width: 1px; align-self: stretch; background: #313244; flex: 0 0 auto; }
|
.iwb-color-pop-sep { width: 1px; align-self: stretch; background: #313244; flex: 0 0 auto; }
|
||||||
|
|
||||||
/* ==== 右列(v1.18,用户 2026-11-10)====
|
/* ==== 色块区(v1.19,用户 2026-11-10)====
|
||||||
设置 / 常用色 / 最近 三块竖着叠,块之间 1px 细线,不写小标题:
|
常用色 8×2 在上、最近色 8×2 在下,块间 1px 细线,不写小标题。
|
||||||
原来「常用色」「最近」各占一行标题 + 横向铺开,整块面板又宽又高。
|
8 列 20px = 195px;两排色块(45 + 11 + 45 = 101)刚好填满左侧取色器 104 的高度,
|
||||||
现宽 133px(6 列 × 18px),三块高度加起来刚好填满左侧取色器的高度。 */
|
所以整个弹层只有头部 + 取色器两层,没有多余留白。 */
|
||||||
.iwb-color-pop-side {
|
.iwb-color-pop-side {
|
||||||
display: flex; flex-direction: column; justify-content: space-between;
|
display: flex; flex-direction: column; justify-content: center;
|
||||||
width: 133px; flex: 0 0 133px; gap: 0;
|
width: 195px; flex: 0 0 195px; gap: 0;
|
||||||
}
|
}
|
||||||
/* 细线分隔:只加在「块与块之间」,第一块前面不加,否则顶部多一条悬空的线 */
|
/* 细线分隔:只加在「块与块之间」,第一块前面不加,否则顶部多一条悬空的线。
|
||||||
|
色号比背景亮两档(#3b3b4e):没有小标题时,这条线是唯一能看出「常用 / 最近」分界的东西,
|
||||||
|
按 #313244 画在深底上几乎看不见。 */
|
||||||
.iwb-color-pop-side > * + * {
|
.iwb-color-pop-side > * + * {
|
||||||
border-top: 1px solid #313244; margin-top: 5px; padding-top: 5px;
|
border-top: 1px solid #3b3b4e; margin-top: 5px; padding-top: 5px;
|
||||||
}
|
}
|
||||||
.iwb-color-pop-fields { display: flex; align-items: center; gap: 5px; }
|
.iwb-color-group { display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 0 0 auto; }
|
||||||
|
/* 标题不显示:「常用色 / 最近」各占一行是这块面板最浪费的高度,
|
||||||
|
色块自己的 title 已经写明是哪一个、哪一个最近用过 */
|
||||||
|
.iwb-editor-color-pop .iwb-color-group-label { display: none; }
|
||||||
|
/* display:flex 会盖掉 [hidden] 的默认 display:none,必须显式写一条 */
|
||||||
|
.iwb-color-group[hidden] { display: none; }
|
||||||
|
|
||||||
|
/* 色值输入定宽 124(v1.20 由 150 收窄、且不再可缩):#RRGGBB 七个字符 55px 出够,
|
||||||
|
v1.19 用的是 flex:0 1 150px,文字工具多出「底色」tab 时它会自己缩到 147 ——
|
||||||
|
头部宽度就跟着上下文抖,最后把「去色」整颗挤掉(用户截图里那次)。
|
||||||
|
现在头部每个元素都定宽:只有 gap 吸收亚像素误差,切工具不再重排。 */
|
||||||
.iwb-editor-color-pop .iwb-editor-color-hex-input {
|
.iwb-editor-color-pop .iwb-editor-color-hex-input {
|
||||||
flex: 1 1 auto; width: 0; height: 26px; padding: 0 5px; text-align: center;
|
flex: 0 0 124px; width: 124px; height: 26px; padding: 0 5px; text-align: center;
|
||||||
font: 600 12px monospace; border-radius: 6px; box-sizing: border-box;
|
font: 600 12px monospace; border-radius: 6px; box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.iwb-editor-color-pop .iwb-editor-color-swatches {
|
.iwb-editor-color-pop .iwb-editor-color-swatches {
|
||||||
display: grid; grid-template-columns: repeat(6, 18px); grid-auto-rows: 18px;
|
display: grid; grid-template-columns: repeat(8, 20px); grid-auto-rows: 20px;
|
||||||
gap: 5px; flex: 0 0 auto; align-content: center;
|
gap: 5px; flex: 0 0 auto; align-content: center;
|
||||||
}
|
}
|
||||||
.iwb-editor-color-pop .iwb-editor-color-panel-swatch {
|
.iwb-editor-color-pop .iwb-editor-color-panel-swatch {
|
||||||
width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
|
width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
|
||||||
transition: transform 0.08s ease;
|
transition: transform 0.08s ease;
|
||||||
}
|
}
|
||||||
.iwb-editor-color-pop .iwb-editor-color-panel-swatch:hover { transform: scale(1.14); }
|
.iwb-editor-color-pop .iwb-editor-color-panel-swatch:hover { transform: scale(1.14); }
|
||||||
@@ -1863,13 +1900,12 @@
|
|||||||
}
|
}
|
||||||
.iwb-editor-color-pop .iwb-editor-color-eye { width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto; }
|
.iwb-editor-color-pop .iwb-editor-color-eye { width: 26px; height: 26px; border-radius: 6px; flex: 0 0 auto; }
|
||||||
|
|
||||||
/* ==== 钉住(v1.18)====
|
/* ==== 钉住(v1.18 / v1.19 改为流式)====
|
||||||
绝对定位到头部右上角:这样「无」按钮显隐都不会把图钉挤来挤去,
|
v1.18 是绝对定位贴右上角(躲开「无」按钮显隐带来的位移);
|
||||||
头部加 padding-right 让出位置,两者不会叠在一起。 */
|
v1.19「吸管 + 色值」也进了头部,头部本来就是一排可变宽控件,
|
||||||
.iwb-color-pop-head { position: relative; padding-right: 26px; }
|
图钉跟着流走反而更稳 —— 竖线已经把「去色 | 图钉」和左边隔开,位置不会再被误读。 */
|
||||||
.iwb-color-pop-pin {
|
.iwb-color-pop-pin {
|
||||||
position: absolute; right: 0; top: 50%; transform: translateY(-50%);
|
flex: 0 0 auto; width: 24px; height: 24px; padding: 0;
|
||||||
width: 22px; height: 22px; padding: 0;
|
|
||||||
display: inline-flex; align-items: center; justify-content: center;
|
display: inline-flex; align-items: center; justify-content: center;
|
||||||
border: 1px solid transparent; border-radius: 6px; background: transparent;
|
border: 1px solid transparent; border-radius: 6px; background: transparent;
|
||||||
color: #9aa0b4; cursor: pointer;
|
color: #9aa0b4; cursor: pointer;
|
||||||
@@ -2107,20 +2143,20 @@
|
|||||||
/* 选项栏里色块旁边的分组标签,和「描边 / 底色」这类双字按钮区分开 */
|
/* 选项栏里色块旁边的分组标签,和「描边 / 底色」这类双字按钮区分开 */
|
||||||
.iwb-opt-swatch-label { color: #7f849c; font-size: 11px; flex: 0 0 auto; }
|
.iwb-opt-swatch-label { color: #7f849c; font-size: 11px; flex: 0 0 auto; }
|
||||||
|
|
||||||
/* 「最近使用」:色板弹层里与常用色同一套 6 列 18px 网格(v1.18 起上限 6 个,正好一行),
|
/* 「最近使用」:与常用色同一套 8 列 20px 网格(v1.19 起最多 16 个 = 铺满两排),
|
||||||
空的时候整块隐藏(不占位)。 */
|
空的时候整块隐藏(不占位)。 */
|
||||||
.iwb-editor-color-pop .iwb-editor-recent-colors {
|
.iwb-editor-color-pop .iwb-editor-recent-colors {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(6, 18px);
|
grid-template-columns: repeat(8, 20px);
|
||||||
grid-auto-rows: 18px;
|
grid-auto-rows: 20px;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
}
|
}
|
||||||
.iwb-editor-recent-colors[hidden] { display: none; }
|
.iwb-editor-recent-colors[hidden] { display: none; }
|
||||||
.iwb-editor-color-pop .iwb-editor-recent-colors .iwb-editor-color-panel-swatch {
|
.iwb-editor-color-pop .iwb-editor-recent-colors .iwb-editor-color-panel-swatch {
|
||||||
width: 18px;
|
width: 20px;
|
||||||
height: 18px;
|
height: 20px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@@ -2156,57 +2192,12 @@
|
|||||||
.iwb-editor-side-resizer:hover::after,
|
.iwb-editor-side-resizer:hover::after,
|
||||||
.iwb-editor-side-resizer.is-dragging::after { background: #e8a735; }
|
.iwb-editor-side-resizer.is-dragging::after { background: #e8a735; }
|
||||||
|
|
||||||
/* ---- 2) 右栏调色面板 ---- */
|
/* ---- 2) 右栏调色面板:已删(v1.19,用户 2026-11-10) ----
|
||||||
.iwb-editor-colors {
|
颜色只剩工具栏弹层一处。弹层钉住后本来就常开,右栏那份只是重复占位。
|
||||||
display: flex; flex-direction: column; gap: 9px;
|
原来这里的 .iwb-editor-colors / .iwb-editor-colors-head / 以及一批
|
||||||
padding: 9px 10px 10px; border-radius: 10px;
|
`.iwb-editor-colors .iwb-color-pop-*` 覆盖规则(弹层横排、右栏竖排)全部移除 ——
|
||||||
background: #1e1e2c; border: 1px solid #2f2f42;
|
少一层「同一份 DOM 两套布局」的分支,改色板不会再出现「改了一处另一处没跟上」。 */
|
||||||
flex: 0 0 auto;
|
|
||||||
}
|
|
||||||
.iwb-editor-colors-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
|
|
||||||
.iwb-editor-colors-title { font-size: 13px; font-weight: 600; color: #cdd6f4; }
|
|
||||||
.iwb-editor-colors-hint { font-size: 11.5px; color: #7f87a3; }
|
|
||||||
|
|
||||||
/* 弹层是横排一行;右栏窄,改成竖排:调色器全宽 → HEX 一行 → 常用色 → 最近。
|
|
||||||
结构完全一样(同一份 DOM),差异全在这里用容器选择器覆盖。 */
|
|
||||||
.iwb-editor-colors .iwb-color-pop-head { flex-wrap: wrap; gap: 5px; padding-right: 0; }
|
|
||||||
/* 右栏不需要「钉住」(它本来就常驻),也不需要 v1.18 那层 side 容器:
|
|
||||||
display:contents 把它拆掉,子元素直接参与 body 的竖排 flex,和改版前一样。 */
|
|
||||||
.iwb-editor-colors .iwb-color-pop-pin { display: none; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-side { display: contents; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-tab { padding: 0 8px; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-body { flex-direction: column; align-items: stretch; gap: 8px; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-sep { display: none; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-picker { width: 100%; gap: 6px; }
|
|
||||||
.iwb-editor-colors .iwb-color-sv { flex: 1 1 auto; width: auto; height: 118px; }
|
|
||||||
.iwb-editor-colors .iwb-color-hue { width: 16px; height: 118px; flex: 0 0 16px; }
|
|
||||||
.iwb-editor-colors .iwb-color-pop-fields { width: 100%; gap: 6px; }
|
|
||||||
.iwb-editor-colors .iwb-editor-color-hex-input { flex: 1 1 auto; width: auto; height: 28px; }
|
|
||||||
.iwb-editor-colors .iwb-editor-color-eye { width: 30px; height: 28px; border-radius: 6px; flex: 0 0 auto; }
|
|
||||||
|
|
||||||
/* 分组:右栏显示「常用色 / 最近」小标题,弹层里隐藏(那里横向排得下,加标题反而占高) */
|
|
||||||
.iwb-color-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 0 0 auto; }
|
|
||||||
.iwb-color-group-label { font-size: 11.5px; color: #7f87a3; letter-spacing: 0.3px; }
|
|
||||||
.iwb-editor-color-pop .iwb-color-group { gap: 0; }
|
|
||||||
.iwb-editor-color-pop .iwb-color-group-label { display: none; }
|
|
||||||
/* display:flex 会盖掉 [hidden] 的默认 display:none,必须显式写一条 */
|
|
||||||
.iwb-color-group[hidden] { display: none; }
|
|
||||||
|
|
||||||
/* 右栏色块:网格按容器宽度自适应,拖宽后一行能多放几个 */
|
|
||||||
.iwb-editor-colors .iwb-editor-color-swatches {
|
|
||||||
display: grid; grid-template-columns: repeat(auto-fill, minmax(24px, 1fr));
|
|
||||||
gap: 6px; width: 100%;
|
|
||||||
}
|
|
||||||
.iwb-editor-colors .iwb-editor-recent-colors {
|
|
||||||
display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
|
|
||||||
gap: 6px; width: 100%;
|
|
||||||
}
|
|
||||||
.iwb-editor-colors .iwb-editor-color-panel-swatch {
|
|
||||||
width: 100%; aspect-ratio: 1 / 1; min-height: 22px; padding: 0; border: 0;
|
|
||||||
border-radius: 50%; cursor: pointer; transition: transform 0.08s ease;
|
|
||||||
}
|
|
||||||
.iwb-editor-colors .iwb-editor-color-panel-swatch:hover { transform: scale(1.1); }
|
|
||||||
.iwb-editor-colors .iwb-editor-color-panel-swatch.active { outline: 2px solid #fff; outline-offset: 2px; }
|
|
||||||
|
|
||||||
/* ---- 3) 字号 +1 档 ----
|
/* ---- 3) 字号 +1 档 ----
|
||||||
旧值大量是 10–11.5px(按 1440 宽屏定的),在 2K/4K 与系统缩放 125% 下发虚。
|
旧值大量是 10–11.5px(按 1440 宽屏定的),在 2K/4K 与系统缩放 125% 下发虚。
|
||||||
@@ -2266,7 +2257,8 @@
|
|||||||
#iwb-editor-overlay .iwb-editor-left .iwb-editor-zoom .iwb-editor-zoom-val,
|
#iwb-editor-overlay .iwb-editor-left .iwb-editor-zoom .iwb-editor-zoom-val,
|
||||||
#iwb-editor-overlay .iwb-editor-left .iwb-editor-zoom .iwb-editor-zoom-fit { font-size: 12px; }
|
#iwb-editor-overlay .iwb-editor-left .iwb-editor-zoom .iwb-editor-zoom-fit { font-size: 12px; }
|
||||||
|
|
||||||
/* 调色面板本体 */
|
/* 调色面板本体(v1.20:去色已下移到色块网格,这里只剩 tab 需要放大字号;
|
||||||
#iwb-editor-overlay .iwb-color-pop-tab,
|
去色是 20px 格子,高度必须跟色块一致,别被这条统一字号的规则顶成 26px) */
|
||||||
#iwb-editor-overlay .iwb-color-pop-none { font-size: 12.5px; height: 26px; }
|
#iwb-editor-overlay .iwb-color-pop-tab { font-size: 12.5px; height: 26px; }
|
||||||
|
#iwb-editor-overlay .iwb-color-pop-none { width: 20px; height: 20px; }
|
||||||
#iwb-editor-overlay .iwb-editor-color-pop .iwb-editor-color-hex-input { font-size: 13px; }
|
#iwb-editor-overlay .iwb-editor-color-pop .iwb-editor-color-hex-input { font-size: 13px; }
|
||||||
@@ -10,33 +10,52 @@ import { S, runtime } from './state.js'
|
|||||||
import { bindEvents } from './events.js'
|
import { bindEvents } from './events.js'
|
||||||
|
|
||||||
|
|
||||||
// ============ 调色面板(两处共用) ============
|
// ============ 调色面板(工具栏弹层) ============
|
||||||
/**
|
/**
|
||||||
* v1.16:调色面板从「只能弹层」变成「右栏常驻 + 弹层保留」,两处用同一份 DOM。
|
* v1.19:右栏常驻面板删掉,只剩工具栏弹层这一份(钉住后它本来就是常开的)。
|
||||||
*
|
* 仍抽成函数而不是写在模板里:这套控件有 4 组联动(tab 高亮、SV/色相指示点、
|
||||||
* 为什么抽成函数而不是复制两段 HTML:这套控件有 4 组联动(tab 高亮、SV/色相指示点、
|
* HEX 回填、常用色/最近色的 active 圈),events.js#updateColorUI 按
|
||||||
* HEX 回填、常用色/最近色的 active 圈),复制两段 = 以后每加一种颜色语义都要改两遍,
|
* `[data-color-surface]` 逐个刷 —— 留着这层抽象,将来若再加一处面板不用重写联动。
|
||||||
* 漏一处就是「一边改了另一边不变」。同一份结构 + 按 `[data-color-surface]` 遍历,
|
|
||||||
* 才可能保证一致(events.js#updateColorUI 就是按 surface 逐个刷的)。
|
|
||||||
*
|
|
||||||
* 布局差异全部交给 CSS:弹层是横排一行,右栏窄,改成竖排(picker 全宽、色块自动换行)。
|
|
||||||
*/
|
*/
|
||||||
|
/* 15 个常用色 + 第一格「去色」= 色板里 8 列 × 2 行(v1.20)。
|
||||||
|
排布刻意成对:第一行是 7 个饱和亮色(红橙黄绿青蓝粉)+ 去色打头,
|
||||||
|
第二行是 4 个中性色(白/浅灰/中灰/黑)+ 4 个同色系「深一档」,
|
||||||
|
深红/深绿/深蓝/深紫 在浅色底图上比亮色稳,做描边不刺眼。
|
||||||
|
亮紫 #aa44ff 让位给第一格的「去色」(v1.20,用户 2026-11-10:去色放常用色第一个)——
|
||||||
|
紫色还留着深一档的 #6b4fbb,色相不缺,8×2 的网格也不用改成 3 行。 */
|
||||||
const COMMON_COLORS = [
|
const COMMON_COLORS = [
|
||||||
'#ff4444', '#ff8a00', '#ffd400', '#4cd964', '#00bfa5', '#4488ff',
|
'#ff4444', '#ff8a00', '#ffd400', '#4cd964', '#00bfa5', '#4488ff', '#ff66aa',
|
||||||
'#aa44ff', '#ff66aa', '#ffffff', '#d0d0d0', '#808080', '#000000'
|
'#ffffff', '#d0d0d0', '#808080', '#000000', '#c0392b', '#0f9d58', '#1677ff', '#6b4fbb'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/** 色板面板(v1.19 起只有工具栏弹层一份,右栏常驻面板已删)
|
||||||
|
*
|
||||||
|
* 头部一行:调哪个槽(描边/填充/底色)│ 吸管 + 色值 │ 图钉
|
||||||
|
* 把「吸管 + 色值」提到头部,是为了让下面整块高度都留给色块:
|
||||||
|
* 常用色 2 排 + 最近色 2 排,一屏就能点到,不用滚动、也不用二次点开。
|
||||||
|
*
|
||||||
|
* v1.20(用户 2026-11-10):头部不再随上下文增减控件。
|
||||||
|
* 原因是文字工具会多出「底色」tab,头部一行本来就贴着 440 的极限,
|
||||||
|
* 再去掉/加上「去色」就会把色值框和吸管挤变形(甚至整颗按钮被 flex 抵没)。
|
||||||
|
* 现在「去色」下移到常用色网格的第一格 —— 位置永远固定,不可用时只是变灰 + disabled,
|
||||||
|
* 头部元素因此全是定宽,切工具时头部不再重排。
|
||||||
|
*/
|
||||||
function colorSurfaceHtml() {
|
function colorSurfaceHtml() {
|
||||||
return `
|
return `
|
||||||
<div class="iwb-color-pop-head">
|
<div class="iwb-color-pop-head">
|
||||||
<button type="button" class="iwb-color-pop-tab active" data-color-slot="stroke" title="正在调描边色(形状描边 / 画笔 / 文字色)"><i></i><span class="iwb-color-pop-tab-label">描边</span></button>
|
<button type="button" class="iwb-color-pop-tab active" data-color-slot="stroke" title="正在调描边色(形状描边 / 画笔 / 文字色)"><i></i><span class="iwb-color-pop-tab-label">描边</span></button>
|
||||||
<button type="button" class="iwb-color-pop-tab" data-color-slot="fill" title="正在调填充色(形状内部颜色 / 文字描边色)"><i></i><span class="iwb-color-pop-tab-label">填充</span></button>
|
<button type="button" class="iwb-color-pop-tab" data-color-slot="fill" title="正在调填充色(形状内部颜色 / 文字描边色)"><i></i><span class="iwb-color-pop-tab-label">填充</span></button>
|
||||||
<button type="button" class="iwb-color-pop-tab" data-color-slot="bg" hidden title="正在调文本框底色(垫在文字下面)"><i></i><span class="iwb-color-pop-tab-label">底色</span></button>
|
<button type="button" class="iwb-color-pop-tab" data-color-slot="bg" hidden title="正在调文本框底色(垫在文字下面)"><i></i><span class="iwb-color-pop-tab-label">底色</span></button>
|
||||||
<button type="button" class="iwb-color-pop-none" data-color-none="1" title="无填充:形状内部透明,只留描边"><span></span>无</button>
|
<span class="iwb-color-pop-bar"></span>
|
||||||
|
<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" spellcheck="false" autocomplete="off" title="十六进制颜色,回车生效">
|
||||||
|
<span class="iwb-color-pop-tools">
|
||||||
|
<span class="iwb-color-pop-bar"></span>
|
||||||
<!-- 钉住(v1.18,用户 2026-11-10):调色常常要连着改好几处,每次点开色板太碎。
|
<!-- 钉住(v1.18,用户 2026-11-10):调色常常要连着改好几处,每次点开色板太碎。
|
||||||
钉住后点画布 / 点别处都不收起,只有再点一次图钉、按 Esc、或点吸管才收。
|
钉住后点画布 / 点别处都不收起,只有再点一次图钉、按 Esc、或点吸管才收。
|
||||||
图标是竖向图钉(头朝上),激活态整颗变琥珀色。 -->
|
图标是竖向图钉(头朝上),激活态整颗变琥珀色。 -->
|
||||||
<button type="button" class="iwb-color-pop-pin" data-action="pinColorPop" aria-pressed="false" 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="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button>
|
<button type="button" class="iwb-color-pop-pin" data-action="pinColorPop" aria-pressed="false" 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="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="iwb-color-pop-body">
|
<div class="iwb-color-pop-body">
|
||||||
<div class="iwb-color-pop-picker">
|
<div class="iwb-color-pop-picker">
|
||||||
@@ -44,17 +63,18 @@ import { bindEvents } from './events.js'
|
|||||||
<div class="iwb-color-hue"><span></span></div>
|
<div class="iwb-color-hue"><span></span></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="iwb-color-pop-sep"></span>
|
<span class="iwb-color-pop-sep"></span>
|
||||||
<!-- 右侧竖列(v1.18):设置 → 常用色 → 最近,三块上下叠,块间用 1px 细线分隔,
|
<!-- 色块区(v1.19):常用色 8×2 在上、最近色 8×2 在下,中间 1px 细线分隔。
|
||||||
不再写「常用色 / 最近」小标题 —— 标题各占一行,是这块面板最浪费的高度。
|
不写「常用色 / 最近」小标题 —— 每个色块的 title 已经写明是哪一个,
|
||||||
右栏常驻面板复用同一份 DOM,那边用 display:contents 拆掉这一层,走自己的竖排。 -->
|
而标题要各占一行,是这块面板最浪费的高度(v1.18 已这么定,v1.19 沿用)。 -->
|
||||||
<div class="iwb-color-pop-side">
|
<div class="iwb-color-pop-side">
|
||||||
<div class="iwb-color-pop-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" spellcheck="false" autocomplete="off" title="十六进制颜色,回车生效">
|
|
||||||
</div>
|
|
||||||
<div class="iwb-color-group">
|
<div class="iwb-color-group">
|
||||||
<span class="iwb-color-group-label">常用色</span>
|
<span class="iwb-color-group-label">常用色</span>
|
||||||
<div class="iwb-editor-color-swatches">
|
<div class="iwb-editor-color-swatches">
|
||||||
|
<!-- 去色(v1.20,用户 2026-11-10):原来是头部一颗带文字的按钮,现在占常用色第一格。
|
||||||
|
好处有二:① 位置永远固定,切到文字/箭头这类「去不掉色」的上下文只是变灰,
|
||||||
|
不会整颗消失;② 头部腾出一颗按钮的宽度,文字工具多出「底色」tab 也挤不坏色值框。
|
||||||
|
含义随当前槽变(无描边 / 无填充 / 无底色),title 在 updateColorUI 里刷。 -->
|
||||||
|
<button type="button" class="iwb-color-pop-none" data-color-none="1" title="去色:当前这一项不上色(描边/填充/底色按上下文透明)"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="m5.6 5.6 12.8 12.8"/></svg></button>
|
||||||
${COMMON_COLORS.map(c => `<button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="${c}" style="background:${c}" title="${c}"></button>`).join('')}
|
${COMMON_COLORS.map(c => `<button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="${c}" style="background:${c}" title="${c}"></button>`).join('')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -236,19 +256,11 @@ import { bindEvents } from './events.js'
|
|||||||
<!-- v1.16:侧栏宽度拖拽手柄。贴在侧栏左边缘(它在画布右侧),
|
<!-- v1.16:侧栏宽度拖拽手柄。贴在侧栏左边缘(它在画布右侧),
|
||||||
双击复位。宽度写进 CSS 变量 --iwb-side-w,由 --iwb-side-w 统一裁各条 width 规则。 -->
|
双击复位。宽度写进 CSS 变量 --iwb-side-w,由 --iwb-side-w 统一裁各条 width 规则。 -->
|
||||||
<div class="iwb-editor-side-resizer" data-side-resizer="1" title="拖动调整侧栏宽度,双击复位"></div>
|
<div class="iwb-editor-side-resizer" data-side-resizer="1" title="拖动调整侧栏宽度,双击复位"></div>
|
||||||
<!-- 调色面板(v1.16):从弹层搬进来常驻一份,弹层保留。
|
<!-- 右栏常驻调色面板已删(v1.19,用户 2026-11-10:「右边栏的调色模块就可以去掉了」)。
|
||||||
两处是同一份 DOM(dom.js#colorSurfaceHtml),靠 data-color-surface 区分与遍历,
|
理由:弹层钉住之后它一直是开着的,右栏那份同样内容只是在跟弹层抢注意力,
|
||||||
不存在「一边改了另一边不变」。顶部色格 = 当前元素可调的颜色项,
|
还白占一块最显眼的位置。颜色只剩弹层一处(modal 末尾 .iwb-editor-color-pop),
|
||||||
跟随选中对象变化:形状=描边/填充,文字=文字/描边/底色,箭头=只要描边。 -->
|
右栏现在从「图片调节」直接开始。 -->
|
||||||
<section class="iwb-editor-colors" data-color-surface="side">
|
|
||||||
<div class="iwb-editor-colors-head">
|
|
||||||
<span class="iwb-editor-colors-title">颜色</span>
|
|
||||||
<span class="iwb-editor-colors-hint" title="点上面的色格选择要调哪个颜色">点色格切换</span>
|
|
||||||
</div>
|
|
||||||
${colorSurfaceHtml()}
|
|
||||||
</section>
|
|
||||||
<!-- 调色板已迁到工具栏弹层(v1.3,用户裁定 2026-11-05):
|
|
||||||
侧栏只留快速效果 + 缩放;色板 DOM 在 modal 末尾的 .iwb-editor-color-pop -->
|
|
||||||
<!-- 图片调节(v1.15):连续调色,作用于当前位图图层(默认原图)。
|
<!-- 图片调节(v1.15):连续调色,作用于当前位图图层(默认原图)。
|
||||||
行由 adjust.js#mountAdjustPanel() 按 ADJUST_DEFS 生成 —— 参数表只维护一份,
|
行由 adjust.js#mountAdjustPanel() 按 ADJUST_DEFS 生成 —— 参数表只维护一份,
|
||||||
不在 DOM 里再抄一遍(这个项目已经因为「同一个概念两处各写一份」栽过几次)。
|
不在 DOM 里再抄一遍(这个项目已经因为「同一个概念两处各写一份」栽过几次)。
|
||||||
|
|||||||
@@ -1055,21 +1055,28 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
|||||||
// 描边格:文字的「描边」是第二格(上面已处理),文字色/单槽上下文不允许「无」
|
// 描边格:文字的「描边」是第二格(上面已处理),文字色/单槽上下文不允许「无」
|
||||||
if (!isFill && !isBg) tab.classList.toggle('is-none', !isText && sl.strokeOn === false)
|
if (!isFill && !isBg) tab.classList.toggle('is-none', !isText && sl.strokeOn === false)
|
||||||
})
|
})
|
||||||
// 「无」:形状/钢笔 = 无描边或无填充;文字描边 = 描边宽度 0;文字底色 = 关掉底色块
|
// 「去色」:形状/钢笔 = 无描边或无填充;文字描边 = 描边宽度 0;文字底色 = 关掉底色块
|
||||||
// (文字色与箭头单槽没有「无」—— 去掉就等于把对象删了,不该给这个按钮)
|
// v1.20(用户 2026-11-10):它现在是常用色网格的第一格,**永远显示**。
|
||||||
// v1.16:右栏与弹层各有一个「无」,必须按集合刷,否则只有先出现的那个对
|
// 文字色 / 箭头这类「去掉就等于删掉对象」的上下文,改成置灰 + disabled,而不是整颗消失 ——
|
||||||
|
// 消失会让色板每切一次工具就重排一次,位置记不住。
|
||||||
const onBg = S.colorTarget === 'bg' && isText
|
const onBg = S.colorTarget === 'bg' && isText
|
||||||
const onFill = S.colorTarget === 'fill' && second
|
const onFill = S.colorTarget === 'fill' && second
|
||||||
const onStroke = S.colorTarget === 'stroke' && !isText && strokeSlotCanBeNone()
|
const onStroke = S.colorTarget === 'stroke' && !isText && strokeSlotCanBeNone()
|
||||||
const showNone = onBg || onFill || onStroke
|
const noneUsable = onBg || onFill || onStroke
|
||||||
runtime.el.querySelectorAll('[data-color-none]').forEach(noneBtn => {
|
runtime.el.querySelectorAll('[data-color-none]').forEach(noneBtn => {
|
||||||
noneBtn.hidden = !showNone
|
noneBtn.hidden = false
|
||||||
noneBtn.classList.toggle('active', showNone && (onBg ? !sl.bgOn : (onFill ? !sl.fillOn : !sl.strokeOn)))
|
noneBtn.disabled = !noneUsable
|
||||||
noneBtn.title = onBg
|
noneBtn.classList.toggle('is-disabled', !noneUsable)
|
||||||
? '无底色:文字后面完全透明'
|
noneBtn.classList.toggle('active', noneUsable && (onBg ? !sl.bgOn : (onFill ? !sl.fillOn : !sl.strokeOn)))
|
||||||
|
noneBtn.title = noneUsable
|
||||||
|
? (onBg
|
||||||
|
? '去色:文字后面完全透明(无底色)'
|
||||||
: (onStroke
|
: (onStroke
|
||||||
? (sl.strokeOn === false ? '当前已是无描边;点选颜色可恢复描边' : '无描边:去掉形状外框,只留内部填充')
|
? (sl.strokeOn === false ? '当前已是无描边;点选颜色可恢复描边' : '去色:去掉形状外框,只留内部填充')
|
||||||
: (isText ? '无描边:把描边宽度置 0,只留文字本身' : '无填充:形状内部透明,只留描边'))
|
: (isText ? '去色:把描边宽度置 0,只留文字本身' : '去色:形状内部透明,只留描边')))
|
||||||
|
: (isText && S.colorTarget === 'stroke'
|
||||||
|
? '去色不可用:文字色去掉就等于把文字删了,要隐藏文字请用「清空标注」'
|
||||||
|
: '去色不可用:这一格只有一种颜色,去掉就没有了')
|
||||||
})
|
})
|
||||||
|
|
||||||
const cur = activeColor()
|
const cur = activeColor()
|
||||||
@@ -1079,7 +1086,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
|||||||
if (on) matchPreset = true
|
if (on) matchPreset = true
|
||||||
s.classList.toggle('active', on)
|
s.classList.toggle('active', on)
|
||||||
})
|
})
|
||||||
// v1.16:hex / 调色器在两处面板各有一份 → 一律按集合刷
|
// hex / 调色器按集合刷(现在只有弹层一处,写法保持不变以免将来加面板时漏刷)
|
||||||
runtime.el.querySelectorAll('.iwb-editor-color-hex').forEach(el => { el.textContent = cur.toUpperCase() })
|
runtime.el.querySelectorAll('.iwb-editor-color-hex').forEach(el => { el.textContent = cur.toUpperCase() })
|
||||||
runtime.el.querySelectorAll('.iwb-editor-color-hex-input').forEach(inp => {
|
runtime.el.querySelectorAll('.iwb-editor-color-hex-input').forEach(inp => {
|
||||||
if (document.activeElement !== inp) inp.value = cur.toUpperCase()
|
if (document.activeElement !== inp) inp.value = cur.toUpperCase()
|
||||||
@@ -2320,10 +2327,9 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 调色面板(v1.3 弹层 → v1.16 弹层 + 右栏常驻):
|
/** 调色面板(v1.3 弹层 → v1.16 弹层 + 右栏常驻 → v1.19 只剩弹层):
|
||||||
* 两处是同一份 DOM(dom.js#colorSurfaceHtml),按 [data-color-surface] 逐个绑定。
|
* 结构来自 dom.js#colorSurfaceHtml,按 [data-color-surface] 逐个绑定。
|
||||||
* 每个 surface 各自持有一份 HSV 拖拽状态,但取值一律从 activeColor() 现算,
|
* 每个 surface 各自持有一份 HSV 拖拽状态,但取值一律从 activeColor() 现算。 */
|
||||||
* 所以「在右栏取色、再去弹层拖 SV」不会跳色。 */
|
|
||||||
function bindColorPanel() {
|
function bindColorPanel() {
|
||||||
const pop = runtime.el.querySelector('.iwb-editor-color-pop')
|
const pop = runtime.el.querySelector('.iwb-editor-color-pop')
|
||||||
const colorBtns = [...runtime.el.querySelectorAll('[data-action="toggleColorPop"]')]
|
const colorBtns = [...runtime.el.querySelectorAll('[data-action="toggleColorPop"]')]
|
||||||
@@ -2333,7 +2339,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
|||||||
})
|
})
|
||||||
if (pop) {
|
if (pop) {
|
||||||
// 点外面关闭:必须用捕获阶段 —— 画布的 mousedown 会 preventDefault,
|
// 点外面关闭:必须用捕获阶段 —— 画布的 mousedown 会 preventDefault,
|
||||||
// 冒泡阶段拿不到「点了外面」这件事。右栏面板常驻,不参与关闭。
|
// 冒泡阶段拿不到「点了外面」这件事。
|
||||||
// 钉住时一律不关:这就是「钉住」的全部意义(要收就再点一次图钉,或按 Esc)。
|
// 钉住时一律不关:这就是「钉住」的全部意义(要收就再点一次图钉,或按 Esc)。
|
||||||
document.addEventListener('mousedown', (e) => {
|
document.addEventListener('mousedown', (e) => {
|
||||||
if (S.colorPopPinned) return
|
if (S.colorPopPinned) return
|
||||||
@@ -2376,7 +2382,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
|||||||
const palettePick = surface.querySelector('[data-action="palettePick"]')
|
const palettePick = surface.querySelector('[data-action="palettePick"]')
|
||||||
if (palettePick) {
|
if (palettePick) {
|
||||||
palettePick.addEventListener('mousedown', (e) => e.stopPropagation())
|
palettePick.addEventListener('mousedown', (e) => e.stopPropagation())
|
||||||
// 取色要回画布点,弹层必须先收起,否则它会挡住取样点(右栏面板在画布外,不挡)
|
// 取色要回画布点,弹层必须先收起,否则它会挡住取样点
|
||||||
palettePick.addEventListener('click', () => { closeColorPop(); setTool('picker') })
|
palettePick.addEventListener('click', () => { closeColorPop(); setTool('picker') })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* recent-colors.js - 最近使用颜色(v1.9)
|
/* recent-colors.js - 最近使用颜色(v1.9)
|
||||||
*
|
*
|
||||||
* 只依赖 state.js(叶子模块):tools.js 在改色时调用 rememberColor(),
|
* 只依赖 state.js(叶子模块):tools.js 在改色时调用 rememberColor(),
|
||||||
* color pop 打开时 renderRecentColors() 把最近 6 个色块铺出来。
|
* color pop 打开时 renderRecentColors() 把最近的色块铺出来。
|
||||||
* 持久化走宿主 ctx.settings(小 KV,不放像素,符合宿主存储约定)。
|
* 持久化走宿主 ctx.settings(小 KV,不放像素,符合宿主存储约定)。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
import { S, runtime } from './state.js'
|
import { S, runtime } from './state.js'
|
||||||
|
|
||||||
// v1.18:上限从 8 收到 6 —— 色板弹层右列改成 6 列网格(和「常用色」同一套),
|
// v1.19:上限 6 → 16。色板弹层改成 8 列网格,16 个正好铺满两排
|
||||||
// 6 个正好一行;8 个会折成第二行,把整块面板撑高 23px,和「更紧凑」的目标相反。
|
// (v1.18 为「更紧凑」收到 6,是因为当时只有一排的空间;吸管+色值移到头部后省出这一排)。
|
||||||
const MAX = 6
|
const MAX = 16
|
||||||
const KEY = 'recentColors'
|
const KEY = 'recentColors'
|
||||||
|
|
||||||
function valid(hex) {
|
function valid(hex) {
|
||||||
@@ -47,7 +47,6 @@ import { S, runtime } from './state.js'
|
|||||||
|
|
||||||
export function renderRecentColors() {
|
export function renderRecentColors() {
|
||||||
if (!runtime.el) return
|
if (!runtime.el) return
|
||||||
// v1.16:右栏常驻面板与工具栏弹层各有一份,按集合刷
|
|
||||||
const wraps = runtime.el.querySelectorAll('.iwb-editor-recent-colors')
|
const wraps = runtime.el.querySelectorAll('.iwb-editor-recent-colors')
|
||||||
if (!wraps.length) return
|
if (!wraps.length) return
|
||||||
const list = S.recentColors || []
|
const list = S.recentColors || []
|
||||||
@@ -57,8 +56,7 @@ export function renderRecentColors() {
|
|||||||
wraps.forEach(wrap => {
|
wraps.forEach(wrap => {
|
||||||
wrap.innerHTML = html
|
wrap.innerHTML = html
|
||||||
wrap.hidden = !list.length
|
wrap.hidden = !list.length
|
||||||
// v1.16:右栏给了一组加了「最近」小标题,没有最近色时整组一起藏,
|
// 没有最近色时整组一起藏,否则下面留一块空白,看起来像没加载出来
|
||||||
// 否则标题下面留一块空白,看起来像没加载出来。
|
|
||||||
const group = wrap.closest('.iwb-color-group')
|
const group = wrap.closest('.iwb-color-group')
|
||||||
if (group) group.hidden = !list.length
|
if (group) group.hidden = !list.length
|
||||||
})
|
})
|
||||||
|
|||||||
+33
-2302
File diff suppressed because it is too large.
Load diff
@@ -183,10 +183,24 @@ if (!SKIP_PASTE) {
|
|||||||
(await page.locator('.iwb-editor-header .iwb-editor-commands').count()) === 0,
|
(await page.locator('.iwb-editor-header .iwb-editor-commands').count()) === 0,
|
||||||
'layerBtn=' + await page.locator('.iwb-editor-layer-btn').count())
|
'layerBtn=' + await page.locator('.iwb-editor-layer-btn').count())
|
||||||
|
|
||||||
const toolsTail = await page.evaluate(() => Array.from(document.querySelectorAll('.iwb-editor-tools > *'))
|
// v1.18(用户 2026-11-10):撤销 / 重做 / 还原 从顶栏搬到工具条最右,
|
||||||
.slice(-2).map((n) => n.dataset.action || n.className))
|
// 「适应窗口 / 收起侧栏」退到它前面两位。这里断言「末尾是撤销组、视图按钮在其前」
|
||||||
check('工具栏最右两个按钮是「适应窗口 / 收起侧栏」',
|
// —— 光看版本号挡不住产物没重建。
|
||||||
JSON.stringify(toolsTail) === JSON.stringify(['zoomFit', 'togglePanels']), JSON.stringify(toolsTail))
|
const toolsOrder = await page.evaluate(() => {
|
||||||
|
const kids = Array.from(document.querySelectorAll('.iwb-editor-tools > *'))
|
||||||
|
const acts = kids.filter((n) => n.dataset && n.dataset.action).map((n) => n.dataset.action)
|
||||||
|
const hist = kids[kids.length - 1]
|
||||||
|
return {
|
||||||
|
tail: acts.slice(-2),
|
||||||
|
lastIsHistory: Boolean(hist && hist.classList.contains('iwb-editor-history')),
|
||||||
|
histActs: [...(hist ? hist.querySelectorAll('[data-action]') : [])].map((b) => b.dataset.action),
|
||||||
|
headerHasHistory: Boolean(document.querySelector('.iwb-editor-header .iwb-editor-history')),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
check('工具栏最右是「撤销/重做/还原」组(视图按钮在其前)',
|
||||||
|
JSON.stringify(toolsOrder.tail) === JSON.stringify(['zoomFit', 'togglePanels']) &&
|
||||||
|
toolsOrder.lastIsHistory && toolsOrder.histActs.join(',') === 'undo,redo,reset' &&
|
||||||
|
!toolsOrder.headerHasHistory, JSON.stringify(toolsOrder))
|
||||||
|
|
||||||
const before = await panelSeq()
|
const before = await panelSeq()
|
||||||
const activeName = await page.evaluate(() => document.querySelector('.iwb-editor-layer-list .iwb-layer-item.active .iwb-layer-name')?.textContent)
|
const activeName = await page.evaluate(() => document.querySelector('.iwb-editor-layer-list .iwb-layer-item.active .iwb-layer-name')?.textContent)
|
||||||
@@ -217,20 +231,50 @@ if (!SKIP_PASTE) {
|
|||||||
(await page.locator('.iwb-editor-adj-target').textContent()) !== '无图层',
|
(await page.locator('.iwb-editor-adj-target').textContent()) !== '无图层',
|
||||||
await page.locator('.iwb-editor-adj-target').textContent())
|
await page.locator('.iwb-editor-adj-target').textContent())
|
||||||
|
|
||||||
// v1.16:右栏常驻调色面板 + 可拖宽度。真站里 DOM 与 CSS 是分别打包的,
|
// v1.19:右栏常驻调色面板已删(用户 2026-11-10),颜色只剩工具栏弹层一处。
|
||||||
// 只验面板在不在、拖宽后宽度有没有真的变 —— 样式漏打包时这里会直接露出来。
|
// 真站里 DOM 与 CSS 分别打包,这里同时验「右栏干净」和「弹层头部一行 / 16 色 8 列」——
|
||||||
const sideColor = await page.evaluate(() => {
|
// 样式漏打包时,头部会退回竖排或色块掉成 6 列,这条会直接露出来。
|
||||||
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
|
const sideColor = await page.evaluate(() => ({
|
||||||
if (!side) return null
|
hasSide: Boolean(document.querySelector('.iwb-editor-left [data-color-surface]')),
|
||||||
|
firstSection: (document.querySelector('.iwb-editor-left > section') || {}).className || '',
|
||||||
|
}))
|
||||||
|
check('右栏调色模块已删(第一个模块是图片调节)',
|
||||||
|
sideColor.hasSide === false && /iwb-editor-adj/.test(sideColor.firstSection),
|
||||||
|
JSON.stringify(sideColor))
|
||||||
|
|
||||||
|
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
|
||||||
|
await page.waitForTimeout(240)
|
||||||
|
const popShape = await page.evaluate(() => {
|
||||||
|
const pop = document.querySelector('.iwb-editor-color-pop')
|
||||||
|
if (!pop) return null
|
||||||
|
const r = (el) => el.getBoundingClientRect()
|
||||||
|
const head = r(pop.querySelector('.iwb-color-pop-head'))
|
||||||
|
const items = [pop.querySelector('[data-action="palettePick"]'),
|
||||||
|
pop.querySelector('.iwb-editor-color-hex-input'),
|
||||||
|
pop.querySelector('[data-action="pinColorPop"]')].map((el) => {
|
||||||
|
const b = r(el)
|
||||||
|
return { c: b.top + b.height / 2, l: b.left, r: b.right }
|
||||||
|
})
|
||||||
|
const sw = [...pop.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]')]
|
||||||
|
const grid = pop.querySelector('.iwb-editor-color-swatches')
|
||||||
return {
|
return {
|
||||||
tabs: side.querySelectorAll('.iwb-color-pop-tab').length,
|
w: Math.round(r(pop).width),
|
||||||
swatches: side.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]').length,
|
sameRow: items.every((it) =>
|
||||||
sv: !!side.querySelector('.iwb-color-sv')
|
Math.abs(it.c - (head.top + head.height / 2)) < 3 && it.l >= head.left - 1 && it.r <= head.right + 1),
|
||||||
|
common: sw.length,
|
||||||
|
cols: new Set(sw.map((b) => Math.round(r(b).left))).size,
|
||||||
|
swatch: sw.length ? Math.round(r(sw[0]).width) : 0,
|
||||||
|
// v1.20:去色占常用色第一格(20px 同尺寸、第一排最左)
|
||||||
|
noneFirst: grid.children[0] === pop.querySelector('[data-color-none]'),
|
||||||
|
cells: grid.children.length,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
check('右栏常驻调色面板(色格切换 + 调色器 + 12 个常用色)',
|
check('色板弹层:头部一行(吸管 / 色值 / 图钉同排)+ 去色占常用色第一格 + 15 色 8 列',
|
||||||
Boolean(sideColor) && sideColor.tabs === 3 && sideColor.swatches === 12 && sideColor.sv,
|
Boolean(popShape) && popShape.sameRow && popShape.noneFirst && popShape.cells === 16 &&
|
||||||
JSON.stringify(sideColor))
|
popShape.common === 15 && popShape.cols === 8 && popShape.swatch === 20 && popShape.w === 440,
|
||||||
|
JSON.stringify(popShape))
|
||||||
|
await page.keyboard.press('Escape')
|
||||||
|
await page.waitForTimeout(140)
|
||||||
|
|
||||||
const sideBefore = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
|
const sideBefore = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
|
||||||
const sideGrip = await page.locator('.iwb-editor-side-resizer').boundingBox()
|
const sideGrip = await page.locator('.iwb-editor-side-resizer').boundingBox()
|
||||||
@@ -261,7 +305,8 @@ if (!SKIP_PASTE) {
|
|||||||
await page.waitForTimeout(250)
|
await page.waitForTimeout(250)
|
||||||
const noneOnStroke = await page.evaluate(() => {
|
const noneOnStroke = await page.evaluate(() => {
|
||||||
const n = document.querySelector('.iwb-editor-color-pop [data-color-none]')
|
const n = document.querySelector('.iwb-editor-color-pop [data-color-none]')
|
||||||
return Boolean(n) && !n.hidden
|
// v1.20:去色不再 hidden,改用 disabled 表达「这个上下文不能去色」
|
||||||
|
return Boolean(n) && Boolean(n.offsetParent) && !n.disabled
|
||||||
})
|
})
|
||||||
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
|
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
|
||||||
await page.waitForTimeout(300)
|
await page.waitForTimeout(300)
|
||||||
|
|||||||
@@ -139,13 +139,16 @@ check('打开编辑器默认只有「原图」1 层,且状态栏不再写「
|
|||||||
JSON.stringify((await dbg()).layers.map(l => l.name)))
|
JSON.stringify((await dbg()).layers.map(l => l.name)))
|
||||||
|
|
||||||
// v1.3(用户裁定 2026-11-05):调色板从侧栏搬进工具栏弹层,侧栏只剩缩放
|
// v1.3(用户裁定 2026-11-05):调色板从侧栏搬进工具栏弹层,侧栏只剩缩放
|
||||||
check('调色板已搬进工具栏:侧栏只剩缩放,SV/色相/推荐色都在弹层里',
|
// v1.19(用户 2026-11-10):右栏那份常驻调色面板删掉,颜色只剩弹层一处
|
||||||
|
check('调色板只在工具栏弹层:右栏没有调色模块,SV/色相/去色 + 15 个常用色都在弹层里',
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
const q = (s) => Boolean(document.querySelector(s))
|
const q = (s) => Boolean(document.querySelector(s))
|
||||||
return !q('.iwb-editor-left .iwb-editor-color-panel') &&
|
return !q('.iwb-editor-left [data-color-surface]') && !q('.iwb-editor-left .iwb-editor-colors') &&
|
||||||
q('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]') &&
|
q('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]') &&
|
||||||
q('.iwb-editor-color-pop .iwb-color-sv') && q('.iwb-editor-color-pop .iwb-color-hue') &&
|
q('.iwb-editor-color-pop .iwb-color-sv') && q('.iwb-editor-color-pop .iwb-color-hue') &&
|
||||||
document.querySelectorAll('.iwb-editor-color-pop .iwb-editor-color-panel-swatch').length === 12 &&
|
// v1.20:去色进网格占第一格,所以 data-panel-color 只剩 15 个(+ 去色 = 16 格)
|
||||||
|
document.querySelectorAll('.iwb-editor-color-pop .iwb-editor-color-swatches [data-panel-color]').length === 15 &&
|
||||||
|
q('.iwb-editor-color-pop .iwb-editor-color-swatches [data-color-none]') &&
|
||||||
q('.iwb-editor-zoom') &&
|
q('.iwb-editor-zoom') &&
|
||||||
!q('.iwb-editor-brush-size') && !q('.iwb-editor-brush-num') &&
|
!q('.iwb-editor-brush-size') && !q('.iwb-editor-brush-num') &&
|
||||||
document.querySelectorAll('.iwb-editor-brush-preset').length === 0
|
document.querySelectorAll('.iwb-editor-brush-preset').length === 0
|
||||||
@@ -193,44 +196,120 @@ check('色板弹层默认收起;点工具栏色点弹出、且整块在视口
|
|||||||
return inView && !(await pop.isVisible()) ? true : 'box=' + JSON.stringify(box)
|
return inView && !(await pop.isVisible()) ? true : 'box=' + JSON.stringify(box)
|
||||||
})())
|
})())
|
||||||
|
|
||||||
// ---------- v1.18 色板弹层:钉住 + 右列竖排(用户 2026-11-10) ----------
|
// ---------- v1.18 / v1.19 / v1.20 色板弹层布局(用户 2026-11-10) ----------
|
||||||
// 需求原话:「加一个钉住,在需要调色的时候不用每次都要点开」「右边的数值、常用色、最近色
|
// v1.18:「加钉住」「三项不写标题、用细横线分割」
|
||||||
// 竖向排」「顺序改为设置、常用色、最近,这三项不用标题,用细横线分割」。
|
// v1.19:「去色放钉住左边、竖线分割」「吸色与色值放在钉住那一排」「宽度再多一点,
|
||||||
|
// 颜色一排 8 个,常用色多加 4 个」「最近色放两排」
|
||||||
|
// v1.20:文字工具多出「底色」tab 时头部挤爆,把「去色」整颗抵没了 ——
|
||||||
|
// 改成去色占常用色第一格(永远在,不可用只置灰),头部元素全部定宽。
|
||||||
await page.locator('.iwb-editor-tool[data-tool="marquee"]').click() // 用选择工具点画布,不落像素
|
await page.locator('.iwb-editor-tool[data-tool="marquee"]').click() // 用选择工具点画布,不落像素
|
||||||
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
|
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
|
||||||
await page.waitForTimeout(140)
|
await page.waitForTimeout(140)
|
||||||
const popLayout = await page.evaluate(() => {
|
const popLayout = await page.evaluate(() => {
|
||||||
const pop = document.querySelector('.iwb-editor-color-pop')
|
const pop = document.querySelector('.iwb-editor-color-pop')
|
||||||
const picker = pop.querySelector('.iwb-color-pop-picker')
|
|
||||||
const side = pop.querySelector('.iwb-color-pop-side')
|
|
||||||
const fields = pop.querySelector('.iwb-color-pop-fields')
|
|
||||||
const groups = [...side.querySelectorAll('.iwb-color-group')]
|
|
||||||
const r = (el) => el.getBoundingClientRect()
|
const r = (el) => el.getBoundingClientRect()
|
||||||
const pr = r(picker)
|
const none = pop.querySelector('[data-color-none]')
|
||||||
const sr = r(side)
|
const grid = pop.querySelector('.iwb-editor-color-swatches')
|
||||||
const fr = r(fields)
|
const picker = r(pop.querySelector('.iwb-color-pop-picker'))
|
||||||
const g0 = r(groups[0])
|
const side = r(pop.querySelector('.iwb-color-pop-side'))
|
||||||
// 「最近」组在没有历史色时整块 hidden,rect 全是 0 —— 不能拿它参与几何比较
|
const headEl = pop.querySelector('.iwb-color-pop-head')
|
||||||
const g1el = groups[1]
|
const head = r(headEl)
|
||||||
const g1 = g1el && !g1el.hidden ? r(g1el) : null
|
const eye = pop.querySelector('[data-action="palettePick"]')
|
||||||
return {
|
const hex = pop.querySelector('.iwb-editor-color-hex-input')
|
||||||
|
const pin = pop.querySelector('[data-action="pinColorPop"]')
|
||||||
|
const sw = [...pop.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]')]
|
||||||
|
// 去色现在是常用色网格的第一格:位置固定、尺寸和其它色块一致
|
||||||
|
const noneFirstCell = grid.children[0] === none
|
||||||
|
const noneSameSize = Math.abs(r(none).width - r(sw[0]).width) < 1 &&
|
||||||
|
Math.abs(r(none).height - r(sw[0]).height) < 1
|
||||||
|
const noneRow1 = Math.round(r(none).top) === Math.round(r(sw[0]).top) &&
|
||||||
|
Math.round(r(none).left) < Math.round(r(sw[0]).left)
|
||||||
|
// 头部一行:吸管 / 色值 / 图钉 的竖直中心都必须落在头部这条线上
|
||||||
|
const cy = (el) => r(el).top + r(el).height / 2
|
||||||
|
const headOneRow = [eye, hex, pin].every((el) =>
|
||||||
|
Math.abs(cy(el) - (head.top + head.height / 2)) < 3 &&
|
||||||
|
r(el).left >= head.left - 1 && r(el).right <= head.right + 1)
|
||||||
|
// 定宽验收:文字工具会多出「底色」tab,头部宽度必须不变形 ——
|
||||||
|
// 色值框宽度与图钉右边缘在「两 tab / 三 tab」两种上下文下要完全一致,
|
||||||
|
// 这条就是用户截图那次 bug 的回归断言(当时去色被 flex 抵掉、色值框从 150 缩到 147)。
|
||||||
|
const hexW2 = Math.round(r(hex).width)
|
||||||
|
const pinR2 = Math.round(r(pin).right)
|
||||||
|
const bgTab = pop.querySelector('.iwb-color-pop-tab[data-color-slot="bg"]')
|
||||||
|
const bgWasHidden = bgTab.hidden
|
||||||
|
if (bgWasHidden) bgTab.hidden = false
|
||||||
|
const hexW3 = Math.round(r(hex).width)
|
||||||
|
const pinR3 = Math.round(r(pin).right)
|
||||||
|
// 注意用元素本身读 scrollWidth/clientWidth —— DOMRect 上没有这两个属性,写 head.scrollWidth
|
||||||
|
// 会拿到 undefined,比较恒为 false(本次就是这样白跑了两轮)
|
||||||
|
const headFitsThreeTabs = headEl.scrollWidth <= headEl.clientWidth + 1 && r(pin).right <= head.right + 1
|
||||||
|
const headDbg = {
|
||||||
|
client: headEl.clientWidth, scroll: headEl.scrollWidth,
|
||||||
|
tabs: [...pop.querySelectorAll('.iwb-color-pop-tab')].map((t) => Math.round(r(t).width)),
|
||||||
|
hex: hexW3, popW: Math.round(r(pop).width),
|
||||||
|
headRight: Math.round(head.right), pinR: pinR3,
|
||||||
|
}
|
||||||
|
if (bgWasHidden) bgTab.hidden = true
|
||||||
|
const row1 = sw.slice(0, 7).map((b) => Math.round(r(b).top))
|
||||||
|
const row2 = sw.slice(7).map((b) => Math.round(r(b).top))
|
||||||
|
// 「最近」没有历史色时整组(含外层 group)都是 hidden,量不出网格;
|
||||||
|
// 这里临时铺满 16 个量完再还原 —— 只解 wrap 的 hidden 不够,外层还压着一层
|
||||||
|
const rec = pop.querySelector('.iwb-editor-recent-colors')
|
||||||
|
const recGroup = rec.closest('.iwb-color-group')
|
||||||
|
const recWasHidden = rec.hidden
|
||||||
|
const grpWasHidden = Boolean(recGroup && recGroup.hidden)
|
||||||
|
if (recWasHidden) {
|
||||||
|
rec.hidden = false
|
||||||
|
if (recGroup) recGroup.hidden = false
|
||||||
|
rec.innerHTML = '<button class="iwb-editor-color-panel-swatch"></button>'.repeat(16)
|
||||||
|
}
|
||||||
|
const recRows = new Set([...rec.querySelectorAll('.iwb-editor-color-panel-swatch')]
|
||||||
|
.map((b) => Math.round(r(b).top))).size
|
||||||
|
const recCols = new Set([...rec.querySelectorAll('.iwb-editor-color-panel-swatch')]
|
||||||
|
.map((b) => Math.round(r(b).left))).size
|
||||||
|
if (recWasHidden) {
|
||||||
|
rec.innerHTML = ''
|
||||||
|
rec.hidden = true
|
||||||
|
if (grpWasHidden && recGroup) recGroup.hidden = true
|
||||||
|
}
|
||||||
|
const out = {
|
||||||
w: Math.round(r(pop).width),
|
w: Math.round(r(pop).width),
|
||||||
h: Math.round(r(pop).height),
|
h: Math.round(r(pop).height),
|
||||||
sideInRight: Math.round(sr.left) >= Math.round(pr.right), // 右列在取色器右边
|
headOneRow,
|
||||||
threeStacked: fr.bottom <= g0.top + 1 && (!g1 || g0.bottom <= g1.top + 1), // 设置→常用→最近 自上而下
|
headRows: [head.top, head.bottom, head.left, head.right].map(Math.round),
|
||||||
sameColumn: Math.abs(fr.left - g0.left) < 2 && (!g1 || Math.abs(g0.left - g1.left) < 2),
|
items: [eye, hex, pin].map((el) => [r(el).top, r(el).bottom, r(el).left, r(el).right].map(Math.round)),
|
||||||
dividers: groups.map((g) => getComputedStyle(g).borderTopWidth),
|
sideInRight: Math.round(side.left) >= Math.round(picker.right),
|
||||||
|
noneFirstCell, noneSameSize, noneRow1,
|
||||||
|
headFitsThreeTabs, headFixed: hexW2 === hexW3 && pinR2 === pinR3,
|
||||||
|
hexW: [hexW2, hexW3], pinR: [pinR2, pinR3], headDbg,
|
||||||
|
common: sw.length,
|
||||||
|
// 8 列 × 2 行:13 个常用色 + 第一格去色 = 16 格,两排各 8
|
||||||
|
twoRows: row1.length === 7 && row2.length === 8 &&
|
||||||
|
new Set(row1).size === 1 && new Set(row2).size === 1 && row1[0] < row2[0] &&
|
||||||
|
grid.children.length === 16,
|
||||||
|
cols: new Set(sw.map((b) => Math.round(r(b).left))).size,
|
||||||
|
recRows, recCols,
|
||||||
|
dividers: [...pop.querySelectorAll('.iwb-color-pop-side > * + *')].map((g) => getComputedStyle(g).borderTopWidth),
|
||||||
labelsVisible: [...pop.querySelectorAll('.iwb-color-group-label')].filter((l) => l.offsetParent !== null).length,
|
labelsVisible: [...pop.querySelectorAll('.iwb-color-group-label')].filter((l) => l.offsetParent !== null).length,
|
||||||
swatch: Math.round(r(pop.querySelector('.iwb-editor-color-panel-swatch')).width),
|
swatch: Math.round(r(sw[0]).width),
|
||||||
}
|
}
|
||||||
|
return out
|
||||||
})
|
})
|
||||||
check('色板右列竖排:设置 → 常用色 → 最近 同一列,1px 细线分隔且没有小标题',
|
check('色板头部一行装完:吸管 + 色值 + 图钉同一排,且加「底色」tab 后色值框与图钉位置纹丝不动',
|
||||||
popLayout.sideInRight && popLayout.threeStacked && popLayout.sameColumn &&
|
popLayout.headOneRow && popLayout.headFitsThreeTabs && popLayout.headFixed,
|
||||||
|
JSON.stringify(popLayout))
|
||||||
|
check('「去色」是常用色的第一格(20px 同尺寸、第一排最左),不再挂在头部',
|
||||||
|
popLayout.noneFirstCell && popLayout.noneSameSize && popLayout.noneRow1,
|
||||||
|
JSON.stringify({ first: popLayout.noneFirstCell, size: popLayout.noneSameSize, row: popLayout.noneRow1, sw: popLayout.swatch }))
|
||||||
|
check('常用色 8 列 × 2 行(去色 + 15 色 = 16 格),最近色也是 8 列两排,块间 1px 细线且无小标题',
|
||||||
|
popLayout.common === 15 && popLayout.twoRows && popLayout.cols === 8 &&
|
||||||
|
popLayout.recCols === 8 && popLayout.recRows === 2 &&
|
||||||
popLayout.labelsVisible === 0 && popLayout.dividers.every((d) => d === '1px'),
|
popLayout.labelsVisible === 0 && popLayout.dividers.every((d) => d === '1px'),
|
||||||
JSON.stringify(popLayout))
|
JSON.stringify(popLayout))
|
||||||
check('竖排后弹层比横排版更紧凑(宽度收窄、总高不超过 175px)',
|
check('色块区在取色器右侧,弹层宽高在预期区间(比 v1.18 的 380×153 宽一档)',
|
||||||
popLayout.w < 460 && popLayout.h <= 175, 'w=' + popLayout.w + ' h=' + popLayout.h)
|
popLayout.sideInRight && popLayout.w >= 410 && popLayout.w <= 470 && popLayout.h <= 178 &&
|
||||||
// 开发用:ANNOT_SHOT=/tmp/pop.png 出一张色板弹层截图(验证 v1.18 布局)
|
popLayout.swatch === 20,
|
||||||
|
'w=' + popLayout.w + ' h=' + popLayout.h + ' swatch=' + popLayout.swatch)
|
||||||
|
// 开发用:ANNOT_SHOT=/tmp/pop.png 出一张色板弹层截图(验证布局)
|
||||||
if (process.env.ANNOT_SHOT) await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT })
|
if (process.env.ANNOT_SHOT) await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT })
|
||||||
|
|
||||||
const pinBtn = page.locator('.iwb-editor-color-pop [data-action="pinColorPop"]')
|
const pinBtn = page.locator('.iwb-editor-color-pop [data-action="pinColorPop"]')
|
||||||
@@ -2064,12 +2143,35 @@ const popTextTarget = await page.evaluate(() => {
|
|||||||
fillActive: tab.classList.contains('active'),
|
fillActive: tab.classList.contains('active'),
|
||||||
fillLabel: tab.querySelector('.iwb-color-pop-tab-label').textContent,
|
fillLabel: tab.querySelector('.iwb-color-pop-tab-label').textContent,
|
||||||
bgVisible: !bgTab.hidden,
|
bgVisible: !bgTab.hidden,
|
||||||
noneVisible: !pop.querySelector('[data-color-none]').hidden
|
// v1.20:去色不再 hidden,改成「在不在 + 能不能用」
|
||||||
|
noneVisible: !!pop.querySelector('[data-color-none]').offsetParent,
|
||||||
|
noneUsable: !pop.querySelector('[data-color-none]').disabled
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
check('点文字的「描边」格:色板目标是描边(tab 写「描边」),底色 tab 同时可选',
|
check('点文字的「描边」格:色板目标是描边(tab 写「描边」),底色 tab 同时可选,去色可用',
|
||||||
popTextTarget.open && popTextTarget.fillActive && popTextTarget.fillLabel === '描边' &&
|
popTextTarget.open && popTextTarget.fillActive && popTextTarget.fillLabel === '描边' &&
|
||||||
popTextTarget.bgVisible && popTextTarget.noneVisible, JSON.stringify(popTextTarget))
|
popTextTarget.bgVisible && popTextTarget.noneVisible && popTextTarget.noneUsable,
|
||||||
|
JSON.stringify(popTextTarget))
|
||||||
|
|
||||||
|
// v1.20(用户 2026-11-10 截图):文字色这一格去不掉色,但按钮必须**留在原位变灰**,
|
||||||
|
// 不能整颗消失 —— 消失会让色板每切一次工具就重排,位置记不住。
|
||||||
|
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
const noneDisabledOnTextColor = await page.evaluate(() => {
|
||||||
|
const n = document.querySelector('.iwb-editor-color-pop [data-color-none]')
|
||||||
|
return {
|
||||||
|
visible: !!n.offsetParent, disabled: n.disabled, dim: Number(getComputedStyle(n).opacity),
|
||||||
|
title: n.title, bgTabStillHidden: document.querySelector('.iwb-color-pop-tab[data-color-slot="bg"]').hidden
|
||||||
|
}
|
||||||
|
})
|
||||||
|
check('文字色上下文:去色仍在第一格、只是置灰 disabled(说明原因),不整颗消失',
|
||||||
|
noneDisabledOnTextColor.visible && noneDisabledOnTextColor.disabled &&
|
||||||
|
noneDisabledOnTextColor.dim < 0.6 && /去色不可用/.test(noneDisabledOnTextColor.title),
|
||||||
|
JSON.stringify(noneDisabledOnTextColor))
|
||||||
|
// 开发用:ANNOT_SHOT3=/tmp/pop-text.png 出「文字工具三 tab + 去色置灰」的效果图(用户截图那个场景)
|
||||||
|
if (process.env.ANNOT_SHOT3) await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT3 })
|
||||||
|
await page.locator('.iwb-editor-color-btn[data-color-slot="fill"]').click()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
|
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
|
||||||
@@ -2354,6 +2456,23 @@ await page.locator('.iwb-editor-color-pop [data-panel-color="#ffd400"]').first()
|
|||||||
await page.waitForTimeout(200)
|
await page.waitForTimeout(200)
|
||||||
const recents = (await dbg()).recentColors
|
const recents = (await dbg()).recentColors
|
||||||
const recentsInPop = await page.locator('.iwb-editor-color-pop .iwb-editor-recent-colors [data-panel-color]').count()
|
const recentsInPop = await page.locator('.iwb-editor-color-pop .iwb-editor-recent-colors [data-panel-color]').count()
|
||||||
|
// 开发用:ANNOT_SHOT2=/tmp/pop-full.png 出一张「去色可见 + 最近色铺满两排」的完整效果图。
|
||||||
|
// 最近色要长期用才攒得满,这里临时补到 16 个纯为出图,不改 S.recentColors / settings。
|
||||||
|
if (process.env.ANNOT_SHOT2) {
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const rec = document.querySelector('.iwb-editor-color-pop .iwb-editor-recent-colors')
|
||||||
|
const group = rec.closest('.iwb-color-group')
|
||||||
|
const list = ['#ffd400', '#e34d59', '#1677ff', '#0f9d58', '#6b4fbb', '#c0392b',
|
||||||
|
'#ff8a00', '#4cd964', '#00bfa5', '#4488ff', '#aa44ff', '#ff66aa',
|
||||||
|
'#d0d0d0', '#808080', '#ffffff', '#000000']
|
||||||
|
rec.innerHTML = list.map((c) =>
|
||||||
|
`<button type="button" class="iwb-editor-color-panel-swatch" data-panel-color="${c}" style="background:${c}" title="最近使用 ${c}"></button>`).join('')
|
||||||
|
rec.hidden = false
|
||||||
|
if (group) group.hidden = false
|
||||||
|
})
|
||||||
|
await page.waitForTimeout(120)
|
||||||
|
await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT2 })
|
||||||
|
}
|
||||||
await page.keyboard.press('Escape')
|
await page.keyboard.press('Escape')
|
||||||
await page.waitForTimeout(120)
|
await page.waitForTimeout(120)
|
||||||
check('选过的颜色进入「最近使用」并出现在色板弹层',
|
check('选过的颜色进入「最近使用」并出现在色板弹层',
|
||||||
@@ -2494,11 +2613,13 @@ const popTarget = await page.evaluate(() => {
|
|||||||
return {
|
return {
|
||||||
open: !pop.hidden,
|
open: !pop.hidden,
|
||||||
fillActive: pop.querySelector('.iwb-color-pop-tab[data-color-slot="fill"]').classList.contains('active'),
|
fillActive: pop.querySelector('.iwb-color-pop-tab[data-color-slot="fill"]').classList.contains('active'),
|
||||||
noneVisible: !pop.querySelector('[data-color-none]').hidden
|
noneVisible: !!pop.querySelector('[data-color-none]').offsetParent,
|
||||||
|
noneUsable: !pop.querySelector('[data-color-none]').disabled
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
check('点填充槽打开色板:目标是填充,并出现「无」按钮',
|
check('点填充槽打开色板:目标是填充,去色在第一格且可用',
|
||||||
popTarget.open && popTarget.fillActive && popTarget.noneVisible, JSON.stringify(popTarget))
|
popTarget.open && popTarget.fillActive && popTarget.noneVisible && popTarget.noneUsable,
|
||||||
|
JSON.stringify(popTarget))
|
||||||
|
|
||||||
// 用一个画布上不会出现的怪色(#a014b2)验收:12 个推荐色在前面用例里都用过,
|
// 用一个画布上不会出现的怪色(#a014b2)验收:12 个推荐色在前面用例里都用过,
|
||||||
// 拿黄色/绿色统计会数到别的图形,永远清不到 0。
|
// 拿黄色/绿色统计会数到别的图形,永远清不到 0。
|
||||||
@@ -2658,7 +2779,8 @@ const selectedShapeState = () => page.evaluate(() => {
|
|||||||
color: s && s.color, fillColor: s && s.fillColor,
|
color: s && s.color, fillColor: s && s.fillColor,
|
||||||
strokeBtnNone: !!btn && btn.classList.contains('is-none'),
|
strokeBtnNone: !!btn && btn.classList.contains('is-none'),
|
||||||
optOff: !!opt && opt.classList.contains('is-off'),
|
optOff: !!opt && opt.classList.contains('is-off'),
|
||||||
noneHidden: !none || none.hidden,
|
// v1.20:去色永远在,只是不可用时 disabled(灰色),所以断言的是「能不能用」不是「在不在」
|
||||||
|
noneDisabled: !none || none.disabled,
|
||||||
noneActive: !!none && none.classList.contains('active')
|
noneActive: !!none && none.classList.contains('active')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -2684,7 +2806,9 @@ const magentaBefore = await magentaPerCanvas()
|
|||||||
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
|
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
|
||||||
await page.waitForTimeout(220)
|
await page.waitForTimeout(220)
|
||||||
const noneShownOnStroke = await page.evaluate(() =>
|
const noneShownOnStroke = await page.evaluate(() =>
|
||||||
!document.querySelector('.iwb-editor-color-pop [data-color-none]').hidden)
|
!document.querySelector('.iwb-editor-color-pop [data-color-none]').disabled)
|
||||||
|
// 开发用:ANNOT_SHOT4=/tmp/pop-none.png 出「去色可用态」的效果图(形状描边上下文)
|
||||||
|
if (process.env.ANNOT_SHOT4) await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT4 })
|
||||||
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
|
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
|
||||||
await page.waitForTimeout(320)
|
await page.waitForTimeout(320)
|
||||||
const noStroke = await selectedShapeState()
|
const noStroke = await selectedShapeState()
|
||||||
@@ -2761,8 +2885,8 @@ await page.waitForTimeout(280)
|
|||||||
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
|
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
|
||||||
await page.waitForTimeout(220)
|
await page.waitForTimeout(220)
|
||||||
const openPen = await selectedShapeState()
|
const openPen = await selectedShapeState()
|
||||||
check('未闭合钢笔不给「无描边」(去掉等于把这条线删了)',
|
check('未闭合钢笔不给「无描边」(去掉等于把这条线删了):去色留在原位但置灰',
|
||||||
openPen.type === 'pen' && openPen.closed === false && openPen.noneHidden === true,
|
openPen.type === 'pen' && openPen.closed === false && openPen.noneDisabled === true,
|
||||||
JSON.stringify(openPen))
|
JSON.stringify(openPen))
|
||||||
|
|
||||||
// ---- 一边无色也能交换(用户反馈的第二个问题)----
|
// ---- 一边无色也能交换(用户反馈的第二个问题)----
|
||||||
@@ -2810,40 +2934,40 @@ check('右侧栏出现「图片调节」,11 项齐全且顺序固定',
|
|||||||
adjRowCount === 11 && adjNames.join('/') === '曝光/明度/对比度/阴影/高光/色相/饱和度/温度/色调/锐度/清晰度',
|
adjRowCount === 11 && adjNames.join('/') === '曝光/明度/对比度/阴影/高光/色相/饱和度/温度/色调/锐度/清晰度',
|
||||||
'rows=' + adjRowCount + ' ' + adjNames.join('/'))
|
'rows=' + adjRowCount + ' ' + adjNames.join('/'))
|
||||||
|
|
||||||
// ---------- v1.16:右栏常驻调色面板 / 两处同步 / 可拖宽度 / 字号 ----------
|
// ---------- v1.19:右栏调色模块删除(用户 2026-11-10)/ 可拖宽度 / 字号 ----------
|
||||||
const sideSurface = await page.evaluate(() => {
|
const sideFirst = await page.evaluate(() => {
|
||||||
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
|
const aside = document.querySelector('.iwb-editor-left')
|
||||||
if (!side) return null
|
const firstSection = aside && aside.querySelector(':scope > section')
|
||||||
const tabs = [...side.querySelectorAll('.iwb-color-pop-tab')]
|
|
||||||
return {
|
return {
|
||||||
tabs: tabs.length,
|
hasColor: Boolean(aside && aside.querySelector('[data-color-surface]')),
|
||||||
visibleTabs: tabs.filter(t => !t.hidden).length,
|
first: firstSection ? firstSection.className : '',
|
||||||
swatches: side.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]').length,
|
popCount: document.querySelectorAll('.iwb-editor-color-pop').length,
|
||||||
sv: !!side.querySelector('.iwb-color-sv'),
|
|
||||||
hue: !!side.querySelector('.iwb-color-hue'),
|
|
||||||
hex: !!side.querySelector('.iwb-editor-color-hex-input')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
check('右栏有常驻调色面板:可调颜色项 + 调色器 + 12 个常用色',
|
check('右栏调色模块已删:侧栏第一个模块是「图片调节」,颜色只剩弹层一处',
|
||||||
Boolean(sideSurface) && sideSurface.tabs === 3 && sideSurface.visibleTabs >= 1 &&
|
sideFirst.hasColor === false && /iwb-editor-adj/.test(sideFirst.first) && sideFirst.popCount === 1,
|
||||||
sideSurface.swatches === 12 && sideSurface.sv && sideSurface.hue && sideSurface.hex,
|
JSON.stringify(sideFirst))
|
||||||
JSON.stringify(sideSurface))
|
|
||||||
|
|
||||||
// 在右栏点常用色 → 弹层里同一色块也必须高亮(两处共用一份颜色状态)
|
// 弹层里选常用色:色块 active 圈 / HEX 输入 / 工具栏色点三处必须同时变
|
||||||
await page.locator('.iwb-editor-left [data-color-surface="side"] [data-panel-color="#00bfa5"]').click()
|
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
|
||||||
await page.waitForTimeout(220)
|
await page.waitForTimeout(120)
|
||||||
|
await page.locator('.iwb-editor-color-pop .iwb-editor-color-swatches [data-panel-color="#00bfa5"]').click()
|
||||||
|
await page.waitForTimeout(200)
|
||||||
const colorSync = await page.evaluate(() => {
|
const colorSync = await page.evaluate(() => {
|
||||||
// 只看「常用色」网格:最近使用里同色也会高亮,那是正常的两处提示,不该算进断言
|
const active = [...document.querySelectorAll('.iwb-editor-color-pop .iwb-editor-color-swatches [data-panel-color]')]
|
||||||
const activeIn = (root) => [...root.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]')]
|
|
||||||
.filter(b => b.classList.contains('active')).map(b => b.dataset.panelColor)
|
.filter(b => b.classList.contains('active')).map(b => b.dataset.panelColor)
|
||||||
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
|
return {
|
||||||
const pop = document.querySelector('.iwb-editor-color-pop')
|
active,
|
||||||
return { side: activeIn(side), pop: activeIn(pop), color: window.__iwbEditor.__debug().color }
|
hex: document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input').value,
|
||||||
|
color: window.__iwbEditor.__debug().color,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
check('右栏选色后弹层同一色块同步高亮(不是两套各管各的)',
|
check('弹层选色:常用色高亮 + HEX 回填 + 主色统一(三处不是各说各话)',
|
||||||
colorSync.side.length === 1 && colorSync.side[0] === '#00bfa5' &&
|
colorSync.active.length === 1 && colorSync.active[0] === '#00bfa5' &&
|
||||||
colorSync.pop.length === 1 && colorSync.pop[0] === '#00bfa5' && colorSync.color === '#00bfa5',
|
colorSync.hex.toLowerCase() === '#00bfa5' && colorSync.color === '#00bfa5',
|
||||||
JSON.stringify(colorSync))
|
JSON.stringify(colorSync))
|
||||||
|
await page.keyboard.press('Escape')
|
||||||
|
await page.waitForTimeout(90)
|
||||||
|
|
||||||
// 拖右栏宽度:侧栏在画布右侧,指针左移 80px ⇒ 宽 80px
|
// 拖右栏宽度:侧栏在画布右侧,指针左移 80px ⇒ 宽 80px
|
||||||
const sideW0 = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
|
const sideW0 = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
|
||||||
|
|||||||
Reference in new issue
Block a user