diff --git a/components/canvas/canvas-with-tools.tsx b/components/canvas/canvas-with-tools.tsx index 6cca719..c7fc75e 100644 --- a/components/canvas/canvas-with-tools.tsx +++ b/components/canvas/canvas-with-tools.tsx @@ -102,8 +102,8 @@ export function CanvasWithTools() { ctx.scale(zoom, zoom); ctx.translate(-width / 2, -height / 2); - // Draw checkerboard background - drawCheckerboard(ctx, 10, '#ffffff', '#e0e0e0'); + // Draw checkerboard background (only within canvas bounds) + drawCheckerboard(ctx, 10, '#ffffff', '#e0e0e0', width, height); // Draw background color if not transparent if (backgroundColor && backgroundColor !== 'transparent') { @@ -127,9 +127,9 @@ export function CanvasWithTools() { ctx.globalAlpha = 1; ctx.globalCompositeOperation = 'source-over'; - // Draw grid if enabled + // Draw grid if enabled (only within canvas bounds) if (showGrid) { - drawGrid(ctx, gridSize, 'rgba(0, 0, 0, 0.15)'); + drawGrid(ctx, gridSize, 'rgba(0, 0, 0, 0.15)', width, height); } // Draw selection if active (marching ants) @@ -172,7 +172,7 @@ export function CanvasWithTools() { const screenX = e.clientX - rect.left; const screenY = e.clientY - rect.top; - const canvasPos = screenToCanvas(screenX, screenY); + const canvasPos = screenToCanvas(screenX, screenY, rect.width, rect.height); // Check for panning if (e.button === 1 || (e.button === 0 && e.shiftKey)) { @@ -259,7 +259,7 @@ export function CanvasWithTools() { const screenX = e.clientX - rect.left; const screenY = e.clientY - rect.top; - const canvasPos = screenToCanvas(screenX, screenY); + const canvasPos = screenToCanvas(screenX, screenY, rect.width, rect.height); // Panning if (isPanning) { diff --git a/components/canvas/canvas-wrapper.tsx b/components/canvas/canvas-wrapper.tsx index 56ff1f4..16be9ae 100644 --- a/components/canvas/canvas-wrapper.tsx +++ b/components/canvas/canvas-wrapper.tsx @@ -51,8 +51,8 @@ export function CanvasWrapper() { ctx.scale(zoom, zoom); ctx.translate(-width / 2, -height / 2); - // Draw checkerboard background - drawCheckerboard(ctx, 10, '#ffffff', '#e0e0e0'); + // Draw checkerboard background (only within canvas bounds) + drawCheckerboard(ctx, 10, '#ffffff', '#e0e0e0', width, height); // Draw background color if not transparent if (backgroundColor && backgroundColor !== 'transparent') { @@ -76,9 +76,9 @@ export function CanvasWrapper() { ctx.globalAlpha = 1; ctx.globalCompositeOperation = 'source-over'; - // Draw grid if enabled + // Draw grid if enabled (only within canvas bounds) if (showGrid) { - drawGrid(ctx, gridSize, 'rgba(0, 0, 0, 0.15)'); + drawGrid(ctx, gridSize, 'rgba(0, 0, 0, 0.15)', width, height); } // Draw selection if active diff --git a/components/colors/color-panel.tsx b/components/colors/color-panel.tsx index b292781..3a76860 100644 --- a/components/colors/color-panel.tsx +++ b/components/colors/color-panel.tsx @@ -5,7 +5,7 @@ import { useColorStore } from '@/store/color-store'; import { useToolStore } from '@/store'; import { ColorPicker } from './color-picker'; import { ColorSwatches } from './color-swatches'; -import { ArrowLeftRight, Palette, Clock } from 'lucide-react'; +import { ArrowLeftRight, Palette, Clock, Grid3x3 } from 'lucide-react'; import { cn } from '@/lib/utils'; type Tab = 'picker' | 'swatches' | 'recent'; @@ -32,15 +32,10 @@ export function ColorPanel() { }; return ( -