diff --git a/src/components/ComparePanel.tsx b/src/components/ComparePanel.tsx new file mode 100644 index 0000000..6ac1e20 --- /dev/null +++ b/src/components/ComparePanel.tsx @@ -0,0 +1,126 @@ +import { useRef } from 'react'; +import { ImagePlus, X, ZoomIn, ZoomOut, RotateCcw } from 'lucide-react'; +import { Button } from '@/components/ui/button'; +import { useModelStore } from '@/stores/useModelStore'; +import { useState } from 'react'; + +export function ComparePanel() { + const { compareImage, setCompareImage } = useModelStore(); + const fileRef = useRef(null); + const [zoom, setZoom] = useState(1); + + const handleFile = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (!file) return; + const url = URL.createObjectURL(file); + setCompareImage(url); + setZoom(1); + }; + + if (!compareImage) { + return ( +
+
+ +

+ Foto Real da Peça +

+

+ Carregue uma foto para comparar com o modelo 3D +

+ +
+ +
+ ); + } + + return ( +
+ {/* Toolbar */} +
+ + Foto Real + +
+ + + {Math.round(zoom * 100)}% + + + + + +
+
+ + {/* Image */} +
+ Foto real da peça +
+ + +
+ ); +} diff --git a/src/pages/Viewer.tsx b/src/pages/Viewer.tsx index bfaa738..d095d00 100644 --- a/src/pages/Viewer.tsx +++ b/src/pages/Viewer.tsx @@ -1,5 +1,5 @@ import { useNavigate } from 'react-router-dom'; -import { ArrowLeft, Glasses, Box, Ruler, FileText } from 'lucide-react'; +import { ArrowLeft, Glasses, Box, Ruler, FileText, Columns2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useModelStore } from '@/stores/useModelStore'; import { ModelViewerCanvas } from '@/components/three/ModelViewer'; @@ -8,6 +8,7 @@ import { InspectionChecklist } from '@/components/InspectionChecklist'; import { FineTuningControls } from '@/components/FineTuningControls'; import { MeasurementsList } from '@/components/MeasurementsList'; import { ScreenshotGallery } from '@/components/ScreenshotGallery'; +import { ComparePanel } from '@/components/ComparePanel'; import { useEffect } from 'react'; import { toast } from 'sonner'; import { ScrollArea } from '@/components/ui/scroll-area'; @@ -15,7 +16,7 @@ import { Separator } from '@/components/ui/separator'; const Viewer = () => { const navigate = useNavigate(); - const { model, xrSupported } = useModelStore(); + const { model, xrSupported, compareMode, setCompareMode } = useModelStore(); useEffect(() => { if (!model) { @@ -49,23 +50,41 @@ const Viewer = () => { - +
+ + +
{/* 3D Canvas with floating controls */} -
+
+ {/* Compare panel */} + {compareMode && ( +
+ +
+ )} + {/* Side panel */}