Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

fix: remove inisual comments

CristianOlivera14033f0b21b0f
diff --git a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
index 7377b6d..002e7b8 100644
--- a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
+++ b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
@@ -267,15 +267,10 @@ function ModelScene({
img.src = imageUrl;
}, [imageUrl, imageMaskConfig, cropArea, gl, videoElement]);
- // Track previous rotation values to avoid resetting the camera when
- // the same values are passed back from OrbitControls onEnd callback.
- // Only reset when the parent intentionally changes the rotation (e.g. preset click).
- const prevRotationRef = useRef({ x: initialRotationX, y: initialRotationY });
-
+ const prevRotationRef = useRef<{ x: number; y: number } | null>(null);
useEffect(() => {
- // Skip if the rotation didn't actually change (e.g. OrbitControls
- // reported the same values back, or a parent re-render passed same props).
- if (prevRotationRef.current.x === initialRotationX && prevRotationRef.current.y === initialRotationY) return;
+ if (prevRotationRef.current?.x === initialRotationX &&
+ prevRotationRef.current?.y === initialRotationY) return;
const id = setTimeout(() => {
const orbit = orbitRef.current;
if (!orbit) return;
@@ -285,6 +280,7 @@ function ModelScene({
const theta = initialRotationY * DEG;
orbit.object.position.setFromSphericalCoords(radius, phi, theta);
orbit.update();
+
prevRotationRef.current = { x: initialRotationX, y: initialRotationY };
}, 0);
return () => clearTimeout(id);
@@ -478,7 +474,6 @@ export function IPhone13ProMax3DViewer({
return (
<>
- {/* 3. Renderizamos el panel extraído exactamente igual que en el otro componente */}
<ControlsPopup />
<div
diff --git a/app/components/ui/editor/Laptop3DViewer.tsx b/app/components/ui/editor/Laptop3DViewer.tsx
index 98628d3..586ec92 100644
--- a/app/components/ui/editor/Laptop3DViewer.tsx
+++ b/app/components/ui/editor/Laptop3DViewer.tsx
@@ -203,8 +203,6 @@ function ModelScene({
img.src = imageUrl;
}, [imageUrl, imageMaskConfig, cropArea, gl, videoElement]);
- // Helper: if a video texture is already created and a screen material
- // is now available, attach the texture to the material.
const applyVideoTextureIfReady = useCallback(() => {
const mat = screenMatRef.current;
const tex = videoTextureRef.current;
@@ -355,13 +353,9 @@ function ModelScene({
};
}, []);
- // Track previous rotation values to avoid resetting the camera when
- // the same values are passed back from OrbitControls onEnd callback.
const prevRotationRef = useRef({ x: initialRotationX, y: initialRotationY });
useEffect(() => {
- // Skip if the rotation didn't actually change (e.g. OrbitControls
- // reported the same values back, or a parent re-render passed same props).
if (prevRotationRef.current.x === initialRotationX && prevRotationRef.current.y === initialRotationY) return;
const orbit = orbitRef.current;
if (!orbit) return;
diff --git a/app/components/ui/editor/Phone3DViewer.tsx b/app/components/ui/editor/Phone3DViewer.tsx
index ea28a39..eefeab5 100644
--- a/app/components/ui/editor/Phone3DViewer.tsx
+++ b/app/components/ui/editor/Phone3DViewer.tsx
@@ -19,7 +19,6 @@ import {
} from "@/lib/phone3d.utils";
import type { OrbitControls as OrbitControlsType } from 'three-stdlib';
-// 1. Importamos tu popup y el nuevo custom hook
import { ControlsPopup } from "@/components/ui/ControlsPopup";
import { EnvironmentPreset, ViewerControls3D } from "@/lib/viewer-controls3d";
@@ -243,14 +242,11 @@ function ModelScene({
return;
}
- // Detectamos el dispositivo de forma síncrona usando la prop modelUrl directamente
const device = getDeviceFromModelUrl(modelUrl);
const isDefaultPhone = device === "phone";
const tex = new THREE.VideoTexture(videoElement);
- // SOLUCIÓN AL VIDEO AL REVÉS:
- // Si NO es el teléfono por defecto (es decir, es iPhone 15 o S25), flipY DEBE ser true
tex.flipY = !isDefaultPhone;
tex.colorSpace = THREE.SRGBColorSpace;