diff --git a/client/src/components/canvas.tsx b/client/src/components/canvas.tsx index 8ec9277..d12b766 100644 --- a/client/src/components/canvas.tsx +++ b/client/src/components/canvas.tsx @@ -25,6 +25,7 @@ export function Canvas({ const [zoom, setZoom] = useState(1); const [pixelSize, setPixelSize] = useState(8); const [mouseCoords, setMouseCoords] = useState<{x: number, y: number} | null>(null); + const [previewPixel, setPreviewPixel] = useState<{x: number, y: number} | null>(null); // Create pixel map for O(1) lookup const pixelMap = new Map(); @@ -39,10 +40,14 @@ export function Canvas({ const handlePixelMouseEnter = (x: number, y: number) => { setMouseCoords({ x, y }); + if (!cooldownActive) { + setPreviewPixel({ x, y }); + } }; const handlePixelMouseLeave = () => { setMouseCoords(null); + setPreviewPixel(null); }; const handleZoomIn = () => { @@ -136,19 +141,24 @@ export function Canvas({ {Array.from({ length: canvasHeight }, (_, y) => Array.from({ length: canvasWidth }, (_, x) => { const pixelColor = pixelMap.get(`${x},${y}`) || "#FFFFFF"; + const isPreview = previewPixel && previewPixel.x === x && previewPixel.y === y; + const previewColor = isPreview && !cooldownActive ? selectedColor : pixelColor; + return (
handlePixelClick(x, y)} onMouseEnter={() => handlePixelMouseEnter(x, y)} @@ -178,6 +188,11 @@ export function Canvas({ Mouse: ({mouseCoords.x}, {mouseCoords.y})
)} + {previewPixel && !cooldownActive && ( +
+ Vorschau: {selectedColor} +
+ )} {/* Zoom Controls */} diff --git a/client/src/index.css b/client/src/index.css index e56af89..5545104 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -148,7 +148,7 @@ /* Optimierte Pixel-Hover-Effekte */ .pixel { - transition: transform 0.15s ease-out, box-shadow 0.15s ease-out; + transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, opacity 0.1s ease-out; } .pixel:hover { @@ -158,6 +158,18 @@ box-shadow: 0 0 8px rgba(255, 255, 255, 0.3); } +/* Pixel-Vorschau */ +.pixel-preview { + border: 2px solid rgba(255, 255, 255, 0.8); + box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); + animation: previewPulse 1s ease-in-out infinite alternate; +} + +@keyframes previewPulse { + 0% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); } + 100% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); } +} + /* Toast animations */ .toast-enter { animation: slideInRight 0.3s ease-out; diff --git a/exports/canvas-2025-08-18T12-40-19-350Z.svg b/exports/canvas-2025-08-18T12-40-19-350Z.svg new file mode 100644 index 0000000..d00a164 --- /dev/null +++ b/exports/canvas-2025-08-18T12-40-19-350Z.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/exports/canvas-2025-08-18T12-41-19-351Z.svg b/exports/canvas-2025-08-18T12-41-19-351Z.svg new file mode 100644 index 0000000..d00a164 --- /dev/null +++ b/exports/canvas-2025-08-18T12-41-19-351Z.svg @@ -0,0 +1 @@ + \ No newline at end of file