diff --git a/src/components/SceneModelList.tsx b/src/components/SceneModelList.tsx
index 0575237..fb14696 100644
--- a/src/components/SceneModelList.tsx
+++ b/src/components/SceneModelList.tsx
@@ -1,8 +1,16 @@
-import { Eye, EyeOff, Lock, Unlock, Copy, Trash2, Box, Layers } from 'lucide-react';
+import { Eye, EyeOff, Lock, Unlock, Copy, Trash2, Box, Layers, Check } from 'lucide-react';
import { Button } from '@/components/ui/button';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { useModelStore } from '@/stores/useModelStore';
import { toast } from 'sonner';
+const COLOR_PALETTE = [
+ '#ef4444', '#f97316', '#f59e0b', '#eab308', '#84cc16', '#22c55e',
+ '#10b981', '#14b8a6', '#06b6d4', '#0ea5e9', '#3b82f6', '#6366f1',
+ '#8b5cf6', '#a855f7', '#d946ef', '#ec4899', '#f43f5e', '#64748b',
+ '#ffffff', '#1f2937',
+];
+
interface SceneModelListProps {
compact?: boolean;
}
@@ -15,6 +23,7 @@ export function SceneModelList({ compact = false }: SceneModelListProps) {
const toggleVisible = useModelStore((s) => s.toggleModelVisible);
const toggleLocked = useModelStore((s) => s.toggleModelLocked);
const duplicate = useModelStore((s) => s.duplicateModel);
+ const setModelColor = useModelStore((s) => s.setModelColor);
const max = useModelStore((s) => s.maxModels);
if (models.length === 0) {
@@ -56,11 +65,47 @@ export function SceneModelList({ compact = false }: SceneModelListProps) {
}`}
onClick={() => setActive(m.id)}
>
-
+
+
+
+ e.stopPropagation()}
+ >
+
+ Cor da peça
+
+
+ {COLOR_PALETTE.map((c) => {
+ const selected = c.toLowerCase() === m.color.toLowerCase();
+ return (
+
+ );
+ })}
+
+
+
{m.fileName}
diff --git a/src/pages/Viewer.tsx b/src/pages/Viewer.tsx
index d1282ba..3c3f616 100644
--- a/src/pages/Viewer.tsx
+++ b/src/pages/Viewer.tsx
@@ -21,7 +21,7 @@ import { convertIFCtoGLB } from "@/lib/convertIFC";
const Viewer = () => {
const navigate = useNavigate();
- const { model, xrSupported, addModel, models, maxModels } = useModelStore();
+ const { model, xrSupported, addModel, models, maxModels, scaleRatio } = useModelStore();
const fileInputRef = useRef(null);
const [converting, setConverting] = useState(false);
@@ -177,7 +177,7 @@ const Viewer = () => {
-
+
diff --git a/src/stores/useModelStore.ts b/src/stores/useModelStore.ts
index c9ce865..328ba54 100644
--- a/src/stores/useModelStore.ts
+++ b/src/stores/useModelStore.ts
@@ -100,6 +100,7 @@ interface ModelStore {
setActiveModel: (id: string | null) => void;
toggleModelVisible: (id: string) => void;
toggleModelLocked: (id: string) => void;
+ setModelColor: (id: string, color: string) => void;
duplicateModel: (id: string) => void;
clearAllModels: () => void;
maxModels: number;
@@ -243,6 +244,10 @@ export const useModelStore = create((set, get) => ({
models: state.models.map(m => m.id === id ? { ...m, locked: !m.locked } : m),
})),
+ setModelColor: (id, color) => set((state) => ({
+ models: state.models.map(m => m.id === id ? { ...m, color } : m),
+ })),
+
duplicateModel: (id) => {
const state = get();
if (state.models.length >= MAX_MODELS) return;