You've already forked Nano-Banana-AI-Image-Editor
优化 调整了历史记录预览窗口的实现
This commit is contained in:
@@ -9,7 +9,10 @@ import { useIndexedDBListener } from '../hooks/useIndexedDBListener';
|
||||
import { DayPicker } from 'react-day-picker';
|
||||
import zhCN from 'react-day-picker/dist/locale/zh-CN';
|
||||
|
||||
export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, title: string, width?: number, height?: number} | null) => void }> = ({ setHoveredImage }) => {
|
||||
export const HistoryPanel: React.FC<{
|
||||
setHoveredImage: (image: {url: string, title: string, width?: number, height?: number} | null) => void,
|
||||
setPreviewPosition?: (position: {x: number, y: number} | null) => void
|
||||
}> = ({ setHoveredImage, setPreviewPosition }) => {
|
||||
const {
|
||||
currentProject,
|
||||
canvasImage,
|
||||
@@ -534,6 +537,10 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
width: img.width,
|
||||
height: img.height
|
||||
});
|
||||
// 传递鼠标位置信息给App组件
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition({ x: e.clientX, y: e.clientY });
|
||||
}
|
||||
};
|
||||
img.onerror = (error) => {
|
||||
console.error('图像加载失败:', error);
|
||||
@@ -544,6 +551,10 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
width: 0,
|
||||
height: 0
|
||||
});
|
||||
// 传递鼠标位置信息给App组件
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition({ x: e.clientX, y: e.clientY });
|
||||
}
|
||||
};
|
||||
img.src = imageUrl;
|
||||
}
|
||||
@@ -553,6 +564,9 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
setHoveredImage(null);
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition(null);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{(() => {
|
||||
@@ -631,6 +645,10 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
width: img.width,
|
||||
height: img.height
|
||||
});
|
||||
// 传递鼠标位置信息给App组件
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition({ x: e.clientX, y: e.clientY });
|
||||
}
|
||||
};
|
||||
img.onerror = (error) => {
|
||||
console.error('图像加载失败:', error);
|
||||
@@ -641,6 +659,10 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
width: 0,
|
||||
height: 0
|
||||
});
|
||||
// 传递鼠标位置信息给App组件
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition({ x: e.clientX, y: e.clientY });
|
||||
}
|
||||
};
|
||||
img.src = imageUrl;
|
||||
}
|
||||
@@ -650,6 +672,9 @@ export const HistoryPanel: React.FC<{ setHoveredImage: (image: {url: string, tit
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
setHoveredImage(null);
|
||||
if (setPreviewPosition) {
|
||||
setPreviewPosition(null);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{(() => {
|
||||
|
||||
Reference in New Issue
Block a user