fix(image-annotate): 1.2.7 首笔自动建层缺视图样式导致第一笔错位(补 updateLayerCanvasStyles) + PS 画笔大小快捷键 [/]
This commit is contained in:
1 parent
9e50697dd6
commit
a1c3a40f17
6 files changed
+48
-7
No files matched your search
@@ -46,9 +46,9 @@ import { bindEvents } from './events.js'
|
||||
<button class="iwb-editor-tool" data-tool="marquee" title="选框 (M):拖出矩形/椭圆选区,松手后旁边出现操作条;Shift+M 切换矩形/椭圆"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4 3"><rect x="3" y="4" width="18" height="16" rx="1"/></svg></button>
|
||||
<button class="iwb-editor-tool" data-tool="lasso" title="套索 (L):按住拖动自由圈选,松手闭合"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12c0-4 3.6-7 8-7s8 3 8 7-3.6 7-8 7c-2 0-3.8-.6-5.2-1.6"/><path d="M6.8 17.4 4 20l1.2-3.2"/><circle cx="20" cy="19" r="2"/></svg></button>
|
||||
|
||||
<button class="iwb-editor-tool active" data-tool="brush" title="画笔 (B)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/></svg></button>
|
||||
<button class="iwb-editor-tool active" data-tool="brush" title="画笔 (B):] 增大 / [ 减小笔刷"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/></svg></button>
|
||||
|
||||
<button class="iwb-editor-tool" data-tool="eraser" title="橡皮 (E):擦除当前活跃图层的内容,与画笔共用大小/硬度/透明度"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg></button>
|
||||
<button class="iwb-editor-tool" data-tool="eraser" title="橡皮 (E):] 增大 / [ 减小笔刷;擦除当前活跃图层,与画笔共用大小/硬度/透明度"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg></button>
|
||||
|
||||
<button class="iwb-editor-tool" data-tool="pen" title="钢笔 (P):点击添加节点,双击或 Enter 完成自定义形状"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 19 7-7 3 3-7 7-3-3z"/><path d="m18 13-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="m2 2 7.586 7.586"/><circle cx="11" cy="11" r="2"/></svg></button>
|
||||
|
||||
|
||||
@@ -1738,6 +1738,16 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
return
|
||||
}
|
||||
|
||||
// PS:] 增大 / [ 减小画笔大小(画笔与橡皮共用,光标环即时反馈)
|
||||
if (!mod && !e.altKey && (e.key === '[' || e.key === ']')) {
|
||||
e.preventDefault()
|
||||
const step = S.brushSize >= 64 ? 8 : S.brushSize >= 24 ? 4 : S.brushSize >= 8 ? 2 : 1
|
||||
S.brushSize = clamp(S.brushSize + (e.key === ']' ? step : -step), 1, 300)
|
||||
syncOptionBar()
|
||||
updateCursor()
|
||||
return
|
||||
}
|
||||
|
||||
// 视图:Ctrl+0 适应窗口 / Ctrl+1 100% / Ctrl+± 缩放(PS 习惯)
|
||||
if (mod && !e.shiftKey && e.key === '0') { e.preventDefault(); setZoomFit(); return }
|
||||
if (mod && !e.shiftKey && e.key === '1') { e.preventDefault(); setZoomActual(); return }
|
||||
|
||||
@@ -347,6 +347,10 @@ export function setActiveLayer(id) {
|
||||
}
|
||||
S.layers.push(layer)
|
||||
reorderLayerCanvas()
|
||||
// 新 canvas 必须立刻套上当前视图的显示尺寸/偏移,否则它会以原始像素尺寸
|
||||
// 贴在 stack 原点 —— 表现就是「第一笔画在错误的位置,滚轮缩放后才正常」
|
||||
// (addBlankLayer 一直有这步,这里漏了。2026-11-04 用户反馈)
|
||||
updateLayerCanvasStyles()
|
||||
setActiveLayer(id)
|
||||
renderLayerPanel()
|
||||
return layer
|
||||
|
||||
Reference in new issue
Block a user