fix(annotate): 丢 mouseup 后自愈收笔 + 失焦/指针取消复位交互状态(修「画一次后画布不响应」)v1.20.2

This commit is contained in:
qiqi committed 2026-11-17 17:21:24 +08:00
1 parent 9dd3b0985b
commit 329b4638c3
3 files changed
+63 -2

No files matched your search

+34 -1
View File
@@ -9,7 +9,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.20.1',
version: '1.20.2',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -4847,6 +4847,14 @@ var __IWB_ANNOTATE_MANIFEST__ = {
};
function onMouseMove(e) {
S._altDown = !!e.altKey;
if (S.isDrawing && e.buttons === 0) {
S.isDrawing = false;
const up = Object.prototype.hasOwnProperty.call(DRAW_UP_HANDLERS, S.tool) ? DRAW_UP_HANDLERS[S.tool] : null;
try {
if (up) up(getPos(e));
} catch (err) {
}
}
if (S.placingImage && S.placingHandle && S.placingStart) {
onPlacementDragMove(e);
return;
@@ -6875,6 +6883,26 @@ var __IWB_ANNOTATE_MANIFEST__ = {
renderLayerPanel();
finishCreateTool("shape", shape.id);
}
function resetPointerState() {
S.isDrawing = false;
S.marquee = null;
S.lassoPts = null;
S.textDrag = null;
S.bitmapDrag = null;
S.shapeDrag = null;
S.penDragPt = -1;
S.penDragPending = null;
S.placingHandle = null;
S.panning = false;
S.interaction = "idle";
if (S.strokeCanvas) S.strokeCanvas.style.display = "none";
document.body.style.cursor = "";
document.body.style.userSelect = "";
try {
renderObjects();
} catch (e) {
}
}
function bindCanvasEvents() {
if (S._canvasEventsBound) return;
S._canvasEventsBound = true;
@@ -6882,6 +6910,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
S.canvasStack.addEventListener("mousemove", onMouseMove);
S.canvasStack.addEventListener("mousemove", onCanvasHover);
window.addEventListener("mouseup", onMouseUp);
window.addEventListener("blur", resetPointerState);
document.addEventListener("pointercancel", resetPointerState);
document.addEventListener("visibilitychange", () => {
if (document.hidden) resetPointerState();
});
S.canvasStack.addEventListener("contextmenu", (e) => {
e.preventDefault();
if (S.open && !S.placingImage) showSelectionContext(e);