feat(image-annotate): v1.11.0 工具栏改为描边/填充双色槽,填充支持「无」
用户反馈:「工具栏的调色、描边、填充 3 个位置调色有问题,应该是 2 个调色,
就是描边与填充,但现在没跟工具栏的调色关联上」+「填色里还要一个取消颜色的按钮」。
问题是真的:工具栏只有一个色点(主色),选项栏另有两个色块。看起来三个调色口,
但工具栏那个**不参与填充**——填充只能在选项栏那个小色块里改,于是「填充跟工具栏
没关系」。颜色值本身也没错,错在入口分散、各自为政。
1) 工具栏改成「描边 + 填充」两个槽(PS 式前后色叠放,30px 位里两颗 19px)
- 描边槽 = S.color(同时是画笔色/文字色/形状描边色,仍是一个值)
- 填充槽 = 形状自己的 fillColor;null 时跟随描边色,右下角画蓝三角标出来
- S.colorTarget 记录「色板在调哪一格」,调色器/SV/hex/吸管/推荐色/最近色
全部经 applyPanelColor 按目标写,不再一律写主色
- 点另一个槽只换目标、不收起弹层,「描边改完顺手改填充」不用开关两次
- 选项栏 data-shape-color 两个色块与工具栏**双向同步**(都走 colorSlots())
2) colorSlots() 成为唯一取值处:工具栏色块、色板头部、hex、SV 标记全从它读,
避免上一版那类「同一个概念算两遍必然分叉」。syncOptionBar 收尾调 updateColorUI,
于是「选中对象 → 选项栏显示它的颜色 → 工具栏跟着换」自动成立。
3) 填充可以设「无」:色板里「无」(只在调填充时出现)把 fill 关掉,
形状内部透明只留描边,**颜色保留**(下次点颜色还是它)。
无填充时工具栏填充槽显示灰底红斜杠,不露颜色——露着上次的颜色会被当成
「现在填的就是它」。fillSlotOn() 判定当前上下文有没有填充概念:
箭头没内部、未闭合钢笔没面积、画笔/文字根本没有,这些情况只显示一格。
4) 槽位命名随工具变:文字工具下叫「文字」、画笔下叫「画笔」、形状下叫「描边」。
一律写「描边」会让文字工具下的用户以为这个颜色跟自己没关系。
harness 172 → 179 条全通(新增:两格都在且可见、点填充槽后目标是填充、
色板选色只进填充不动主色、无填充清空画面但保留颜色、无填充显示斜杠、
选项栏改色工具栏跟随、画笔只一格);validate 9/9。
harness 顺带修两处:toggleColorPop 选择器要指定槽位(现在有两个按钮);
无填充的像素断言改用画布上不存在的 #a014b2,否则会数到前面用例留下的图形。
This commit is contained in:
1 parent
b63771f6e4
commit
9c938887c1
9 files changed
+645
-138
No files matched your search
@@ -1713,26 +1713,85 @@
|
||||
================================================================ */
|
||||
.iwb-editor-modal { position: relative; }
|
||||
|
||||
.iwb-editor-canvas-wrap > .iwb-editor-tools .iwb-editor-color-btn {
|
||||
width: 32px; height: 32px; min-width: 32px; flex: 0 0 auto; padding: 0;
|
||||
border: 0; border-radius: 9px; background: #313244; cursor: pointer;
|
||||
/* ---- v1.11:工具栏颜色双槽(描边 + 填充) ----
|
||||
一个 30px 的按钮位上叠两颗:左上 19px 是描边,右下 19px 是填充。
|
||||
描边压在上面(最常用),填充露出右下角,一眼能看出是两格、谁是上级。
|
||||
只有「描边」概念的工具(画笔/文字/箭头)把填充槽藏起来,描边槽放大占满,
|
||||
不留一个空位让人猜。 */
|
||||
.iwb-editor-canvas-wrap > .iwb-editor-tools .iwb-editor-color-pair {
|
||||
position: relative; width: 30px; height: 30px; flex: 0 0 auto;
|
||||
}
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn {
|
||||
position: absolute; width: 19px; height: 19px; min-width: 0; padding: 0;
|
||||
border: 0; border-radius: 6px; background: #181825; cursor: pointer;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
box-shadow: 0 0 0 1.5px #585b70;
|
||||
}
|
||||
.iwb-editor-canvas-wrap > .iwb-editor-tools .iwb-editor-color-btn:hover,
|
||||
.iwb-editor-canvas-wrap > .iwb-editor-tools .iwb-editor-color-btn.active { background: #45475a; }
|
||||
.iwb-editor-color-btn i {
|
||||
width: 18px; height: 18px; border-radius: 50%; display: block; background: #ff4444;
|
||||
box-shadow: 0 0 0 2px #181825, 0 0 0 3px #585b70;
|
||||
.iwb-editor-color-pair [data-color-slot="stroke"] { left: 0; top: 0; z-index: 2; }
|
||||
.iwb-editor-color-pair [data-color-slot="fill"] { right: 0; bottom: 0; z-index: 1; }
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn:hover { box-shadow: 0 0 0 2px #89b4fa; }
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn.active { box-shadow: 0 0 0 2px #e8a735; }
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn i {
|
||||
width: 12px; height: 12px; border-radius: 3px; display: block;
|
||||
background-color: #ff4444; background-size: 100% 100%;
|
||||
}
|
||||
/* 无填充:不露颜色本身,画一道红斜杠 —— 留着上次的颜色会被当成「现在填的就是它」 */
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn.is-none i {
|
||||
background-color: #45475a !important;
|
||||
background-image: linear-gradient(135deg, transparent calc(50% - 1px), #f38ba8 calc(50% - 1px), #f38ba8 calc(50% + 1px), transparent calc(50% + 1px));
|
||||
}
|
||||
/* 填充色还在「跟随描边色」:右下角一个小三角,表示它不是自己指定的 */
|
||||
.iwb-editor-color-pair .iwb-editor-color-btn.is-follow::after {
|
||||
content: ''; position: absolute; right: 0; bottom: 0;
|
||||
border-left: 4px solid transparent; border-bottom: 4px solid #89b4fa;
|
||||
}
|
||||
.iwb-editor-color-pair[data-color-mode="single"] [data-color-slot="fill"] { display: none; }
|
||||
.iwb-editor-color-pair[data-color-mode="single"] [data-color-slot="stroke"] {
|
||||
left: 1px; top: 1px; width: 28px; height: 28px; border-radius: 8px;
|
||||
}
|
||||
.iwb-editor-color-pair[data-color-mode="single"] [data-color-slot="stroke"] i { width: 20px; height: 20px; border-radius: 6px; }
|
||||
|
||||
.iwb-editor-color-pop {
|
||||
position: absolute; z-index: 60; display: flex; align-items: center; gap: 10px;
|
||||
position: absolute; z-index: 60; display: flex; flex-direction: column; align-items: stretch; gap: 9px;
|
||||
padding: 10px 12px; border-radius: 12px;
|
||||
background: rgba(24, 24, 37, 0.97); border: 1px solid #313244;
|
||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
|
||||
-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
|
||||
}
|
||||
.iwb-editor-color-pop[hidden] { display: none; }
|
||||
/* 弹层头部:说明现在调的是描边还是填充,并可直接换;右侧是「无」(仅填充) */
|
||||
.iwb-color-pop-head { display: flex; align-items: center; gap: 6px; }
|
||||
.iwb-color-pop-tab {
|
||||
display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
|
||||
border: 1px solid transparent; border-radius: 7px; background: #232334;
|
||||
color: #a6adc8; font: 500 11.5px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
|
||||
cursor: pointer;
|
||||
}
|
||||
.iwb-color-pop-tab i {
|
||||
width: 11px; height: 11px; border-radius: 3px; display: block;
|
||||
background-color: #ff4444; background-size: 100% 100%;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
.iwb-color-pop-tab:hover { background: #313244; color: #cdd6f4; }
|
||||
.iwb-color-pop-tab.active { background: #313244; color: #fff; border-color: #e8a735; }
|
||||
.iwb-color-pop-tab.is-none i {
|
||||
background-color: #45475a !important;
|
||||
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-none {
|
||||
margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
|
||||
border: 1px dashed #585b70; border-radius: 7px; background: transparent; color: #a6adc8;
|
||||
font: 500 11.5px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; cursor: pointer;
|
||||
}
|
||||
.iwb-color-pop-none span {
|
||||
width: 11px; height: 11px; border-radius: 3px; display: block; background-color: #45475a;
|
||||
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: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-body { display: flex; align-items: center; gap: 10px; }
|
||||
.iwb-color-pop-picker { display: flex; gap: 8px; flex: 0 0 auto; }
|
||||
.iwb-editor-color-pop .iwb-color-sv { width: 180px; height: 104px; flex: 0 0 180px; }
|
||||
.iwb-editor-color-pop .iwb-color-hue { width: 16px; height: 104px; flex: 0 0 16px; }
|
||||
|
||||
Reference in new issue
Block a user