feat(image-annotate): v1.2.12 画笔/橡皮按住 Alt 临时吸色(PS 手感)
- 画笔或橡皮下按住 Alt 立即切吸管,点击取色后仍保持吸管(可连续取色),松开 Alt 回到原工具 - S.altPicker 标记区分「真按 I 切吸管」与临时吸管;exitPicker 在 altPicker 下只清缓存不退出 - 兜底:窗口 blur / 主动切别的工具都会结束临时吸管,避免工具卡在 picker - Alt keydown preventDefault(防 Windows 浏览器把单独 Alt 当菜单激活) - __debug 补 color / altPicker;harness 新增 Alt 吸色回归断言(116 项全绿)
This commit is contained in:
1 parent
c176744846
commit
3080916c62
8 files changed
+106
-12
No files matched your search
@@ -9,7 +9,7 @@
|
||||
var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
id: 'image-annotate',
|
||||
name: '标注 / 修图',
|
||||
version: '1.2.11',
|
||||
version: '1.2.12',
|
||||
apiVersion: 1,
|
||||
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
|
||||
settings: {
|
||||
@@ -39,6 +39,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
// 画笔透明度 0.05~1(一笔整体透明度,笔划内不叠加)
|
||||
prevTool: null,
|
||||
// 吸管工具激活前的工具(取色后切回)
|
||||
altPicker: false,
|
||||
// 按住 Alt 的临时吸管(画笔/橡皮下),松开 Alt 回到原工具
|
||||
pickerComposite: null,
|
||||
// 吸管取样用的合成画布缓存(切工具/画布变化时失效)
|
||||
rectFill: false,
|
||||
@@ -709,6 +711,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
if (tip) tip.style.display = "none";
|
||||
}
|
||||
function exitPicker() {
|
||||
if (S.altPicker) {
|
||||
S.pickerComposite = null;
|
||||
hidePickerTip();
|
||||
return;
|
||||
}
|
||||
S.tool = S.prevTool && S.prevTool !== "picker" ? S.prevTool : "brush";
|
||||
S.prevTool = null;
|
||||
const back = S.tool;
|
||||
@@ -728,6 +735,18 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
}
|
||||
renderObjects();
|
||||
}
|
||||
function beginAltPicker() {
|
||||
if (S.altPicker) return;
|
||||
if (S.tool !== "brush" && S.tool !== "eraser") return;
|
||||
if (S.isDrawing) return;
|
||||
S.altPicker = true;
|
||||
setTool("picker");
|
||||
}
|
||||
function endAltPicker() {
|
||||
if (!S.altPicker) return;
|
||||
S.altPicker = false;
|
||||
exitPicker();
|
||||
}
|
||||
function applyColorChange(color) {
|
||||
S.color = color;
|
||||
updateColorUI();
|
||||
@@ -747,6 +766,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
function setTool(tool) {
|
||||
if (S.placingImage) cancelImagePlacement();
|
||||
commitTextInput();
|
||||
if (tool !== "picker") S.altPicker = false;
|
||||
if (tool !== "select" && tool !== "pen") {
|
||||
S.penEditId = null;
|
||||
S.penDragPt = -1;
|
||||
@@ -2786,9 +2806,9 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
<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):] 增大 / [ 减小笔刷;按住 Alt 临时吸色"><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):] 增大 / [ 减小笔刷;擦除当前活跃图层,与画笔共用大小/硬度/透明度;按住 Alt 临时吸色"><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>
|
||||
|
||||
@@ -4278,6 +4298,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
updateCursor();
|
||||
}
|
||||
S._shiftDown = false;
|
||||
endAltPicker();
|
||||
});
|
||||
bindIf(".iwb-editor-modal", "mousedown", (e) => e.stopPropagation());
|
||||
}
|
||||
@@ -4488,6 +4509,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
}
|
||||
}
|
||||
if (e.key === "Shift") S._shiftDown = true;
|
||||
if (e.key === "Alt" && !e.ctrlKey && !e.metaKey) {
|
||||
e.preventDefault();
|
||||
beginAltPicker();
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter" && S.tool === "pen" && S.penPath) {
|
||||
e.preventDefault();
|
||||
commitPenPath();
|
||||
@@ -4711,6 +4737,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
}
|
||||
function onKeyup(e) {
|
||||
if (e.key === "Shift") S._shiftDown = false;
|
||||
if (e.key === "Alt") endAltPicker();
|
||||
if (e.code === "Space" && S.spaceDown) {
|
||||
S.spaceDown = false;
|
||||
updateCursor();
|
||||
@@ -6185,6 +6212,8 @@ var __IWB_ANNOTATE_MANIFEST__ = {
|
||||
var __debug = () => ({
|
||||
open: S.open,
|
||||
tool: S.tool,
|
||||
color: S.color,
|
||||
altPicker: !!S.altPicker,
|
||||
doc: { w: S.imgW, h: S.imgH },
|
||||
zoom: S.zoom,
|
||||
fit: { w: Math.round(S.fitW || 0), h: Math.round(S.fitH || 0) },
|
||||
|
||||
Reference in new issue
Block a user