feat(3d): make diagonal corner braces optional with toggle

This commit is contained in:
cyber committed 2026-11-16 08:48:38 -04:00
1 parent ad34497813
commit 18082438fa
1 file changed
+16 -3
+16 -3
View File
@@ -88,6 +88,7 @@ export default function FenceViewer3D() {
const [hasBarbedWire, setHasBarbedWire] = useState<boolean>(true);
const [hasConcertina, setHasConcertina] = useState<boolean>(false);
const [showRoll, setShowRoll] = useState<boolean>(true);
const [showBraces, setShowBraces] = useState<boolean>(false);
const [autoRotate, setAutoRotate] = useState<boolean>(false);
const [webGLError, setWebGLError] = useState<boolean>(false);
@@ -386,8 +387,8 @@ export default function FenceViewer3D() {
group.add(armMesh);
}
// Escoras nos cantos
if (idx === 0 || idx === posts.length - 1 || p.isCorner) {
// Escoras nos cantos e pontas (Contraventamento opcional)
if (showBraces && (idx === 0 || idx === posts.length - 1 || p.isCorner)) {
const braceLength = h * 0.95;
const braceGeo = new THREE.BoxGeometry(0.08, braceLength, 0.08);
const braceMesh = new THREE.Mesh(braceGeo, postMat);
@@ -556,7 +557,7 @@ export default function FenceViewer3D() {
group.add(rollGroup);
}
}, [fenceType, color, height, layout, hasBarbedWire, hasConcertina, showRoll]);
}, [fenceType, color, height, layout, hasBarbedWire, hasConcertina, showRoll, showBraces]);
const setCameraView = (type: "geral" | "detalhe" | "topo") => {
if (!cameraRef.current || !controlsRef.current) return;
@@ -934,6 +935,18 @@ export default function FenceViewer3D() {
Adicionar Concertina Perimetral
</span>
</label>
<label className="flex items-center gap-2.5 cursor-pointer">
<input
type="checkbox"
checked={showBraces}
onChange={(e) => setShowBraces(e.target.checked)}
className="w-4 h-4 rounded accent-[#a3c745] bg-zinc-900 border-zinc-700"
/>
<span className="text-xs text-zinc-300">
Exibir Escoras Diagonais (Contraventamento)
</span>
</label>
</div>
</div>