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 */}
-