fix: image editor fit view incorrect, do not query gguf files when gguf unchecked

This commit is contained in:
jialin
2025-06-09 18:45:47 +08:00
parent e69b7dfd6a
commit 4dcb0bcfed
15 changed files with 158 additions and 91 deletions
+8 -3
View File
@@ -433,7 +433,6 @@ const CanvasImageEditor: React.FC<CanvasImageEditorProps> = forwardRef(
fitView();
setActiveScale(autoScale.current);
updateCursorSize();
redrawStrokes(strokesRef.current);
};
const handleBrushSizeChange = (value: number) => {
@@ -458,7 +457,14 @@ const CanvasImageEditor: React.FC<CanvasImageEditorProps> = forwardRef(
undo();
}
};
window.addEventListener('keydown', handleUndoShortcut);
return () => {
window.removeEventListener('keydown', handleUndoShortcut);
};
}, []);
useEffect(() => {
const handleMouseDown = (e: MouseEvent) => {
mouseDownState.current = true;
};
@@ -467,7 +473,6 @@ const CanvasImageEditor: React.FC<CanvasImageEditorProps> = forwardRef(
mouseDownState.current = false;
};
window.addEventListener('keydown', handleUndoShortcut);
// mouse down
window.addEventListener('mousedown', handleMouseDown);
@@ -475,7 +480,7 @@ const CanvasImageEditor: React.FC<CanvasImageEditorProps> = forwardRef(
window.addEventListener('mouseup', handleMouseUp);
return () => {
clearTimeout(timer.current);
window.removeEventListener('keydown', handleUndoShortcut);
window.removeEventListener('mousedown', handleMouseDown);
window.removeEventListener('mouseup', handleMouseUp);
};