You've already forked Nano-Banana-AI-Image-Editor
更新描述文档;
修复了若干错误;
This commit is contained in:
@@ -200,7 +200,7 @@ export const HistoryPanel: React.FC<{
|
||||
}, [displayGenerations, displayEdits, getBlob, decodedImages]);
|
||||
|
||||
// 获取上传后的图片链接
|
||||
const getUploadedImageUrl = (generationOrEdit: any, index: number) => {
|
||||
const getUploadedImageUrl = (generationOrEdit: Generation | Edit, index: number) => {
|
||||
if (generationOrEdit.uploadResults && generationOrEdit.uploadResults[index]) {
|
||||
const uploadResult = generationOrEdit.uploadResults[index];
|
||||
if (uploadResult.success && uploadResult.url) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
||||
import { Stage, Layer, Image as KonvaImage, Line } from 'react-konva';
|
||||
import type { KonvaEventObject } from 'konva/lib/Node';
|
||||
import type { Stage as StageType } from 'konva/lib/Stage';
|
||||
import { useAppStore } from '../store/useAppStore';
|
||||
import { Button } from './ui/Button';
|
||||
import { ZoomIn, ZoomOut, RotateCcw, Download } from 'lucide-react';
|
||||
@@ -24,7 +25,7 @@ export const ImageCanvas: React.FC = () => {
|
||||
showPromptPanel
|
||||
} = useAppStore();
|
||||
|
||||
const stageRef = useRef<any>(null);
|
||||
const stageRef = useRef<StageType>(null);
|
||||
const [image, setImage] = useState<HTMLImageElement | null>(null);
|
||||
const [stageSize, setStageSize] = useState({ width: 800, height: 600 });
|
||||
const [isDrawing, setIsDrawing] = useState(false);
|
||||
|
||||
@@ -85,12 +85,16 @@ const ImagePreview: React.FC<{
|
||||
onDragStart={(e) => onDragStart && onDragStart(e, index)}
|
||||
onDragOver={(e) => {
|
||||
e.preventDefault();
|
||||
onDragOver && onDragOver(e, index);
|
||||
if (onDragOver) {
|
||||
onDragOver(e, index);
|
||||
}
|
||||
}}
|
||||
onDragEnd={(e) => onDragEnd && onDragEnd(e)}
|
||||
onDrop={(e) => {
|
||||
e.preventDefault();
|
||||
onDrop && onDrop(e, index);
|
||||
if (onDrop) {
|
||||
onDrop(e, index);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<img
|
||||
@@ -351,6 +355,7 @@ export const PromptComposer: React.FC = () => {
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('生成失败:', error);
|
||||
// 如果仍在连续生成模式下,继续重试
|
||||
if (useAppStore.getState().isContinuousGenerating) {
|
||||
console.log('生成失败,正在重试...');
|
||||
@@ -450,7 +455,7 @@ export const PromptComposer: React.FC = () => {
|
||||
e.dataTransfer.setData('text/plain', index.toString());
|
||||
};
|
||||
|
||||
const handleDragOverPreview = (e: React.DragEvent<HTMLDivElement>, _index: number) => {
|
||||
const handleDragOverPreview = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'move';
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ export interface ToastProps {
|
||||
|
||||
export const Toast: React.FC<ToastProps> = ({ id, message, type, details, onClose, onHoverChange }) => {
|
||||
const [showDetails, setShowDetails] = useState(false);
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isExiting, setIsExiting] = useState(false);
|
||||
const hoverTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
@@ -39,14 +38,12 @@ export const Toast: React.FC<ToastProps> = ({ id, message, type, details, onClos
|
||||
hoverTimeoutRef.current = null;
|
||||
}
|
||||
|
||||
setIsHovered(true);
|
||||
onHoverChange?.(true);
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
// Set a timeout to mark as not hovered after 1 second
|
||||
hoverTimeoutRef.current = setTimeout(() => {
|
||||
setIsHovered(false);
|
||||
onHoverChange?.(false);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user