From ca237f3ef39e3c0f1ddd756ff04081f9969ca81d Mon Sep 17 00:00:00 2001 From: Marcos Reifonas Date: Thu, 24 Sep 2026 21:41:09 +0000 Subject: [PATCH] fix: restaurar altura e expansao total do viewport 3D e ferramentas no Visualizador3D --- src/components/Layout.tsx | 2 +- src/components/viewer3d/ModelViewer3D.tsx | 11 ++++++++++- src/pages/Visualizador3D.tsx | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 0829529..a278e69 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -49,7 +49,7 @@ export const Layout = ({ children }: LayoutProps) => { {/* Conteúdo principal */} -
+
{children}
diff --git a/src/components/viewer3d/ModelViewer3D.tsx b/src/components/viewer3d/ModelViewer3D.tsx index cc6e449..d83e901 100644 --- a/src/components/viewer3d/ModelViewer3D.tsx +++ b/src/components/viewer3d/ModelViewer3D.tsx @@ -235,11 +235,12 @@ export const ModelViewer3D: React.FC = ({ }; animate(); - // 8. Resize Handler + // 8. Resize Handler com ResizeObserver para garantir cálculo perfeito de dimensões const handleResize = () => { if (!canvasContainerRef.current || !rendererRef.current) return; const w = canvasContainerRef.current.clientWidth; const h = canvasContainerRef.current.clientHeight; + if (w <= 0 || h <= 0) return; perspCamera.aspect = w / h; perspCamera.updateProjectionMatrix(); @@ -255,9 +256,17 @@ export const ModelViewer3D: React.FC = ({ }; window.addEventListener('resize', handleResize); + const resizeObserver = new ResizeObserver(() => { + handleResize(); + }); + if (canvasContainerRef.current) { + resizeObserver.observe(canvasContainerRef.current); + } + return () => { cancelAnimationFrame(animationFrameId); window.removeEventListener('resize', handleResize); + resizeObserver.disconnect(); themeObserver.disconnect(); renderer.dispose(); }; diff --git a/src/pages/Visualizador3D.tsx b/src/pages/Visualizador3D.tsx index aebf720..865a2ae 100644 --- a/src/pages/Visualizador3D.tsx +++ b/src/pages/Visualizador3D.tsx @@ -501,7 +501,7 @@ export default function Visualizador3D() { const hasSavedModel = Boolean(currentOFInfo?.ifc_url); return ( -
+
{/* Top Header Bar */}
{/* Left: Title, OF Selector & Phase Filter */} @@ -695,7 +695,7 @@ export default function Visualizador3D() {
{/* Main 3D Viewport */} -
+
{isLoadingModel && (