Skip to content

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

feat: add wallpaper visibility toggle and related handlers in editor components

CristianOlivera15d1dbb290553
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index 6c35ff9..045bea9 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -100,6 +100,7 @@ export default function Editor() {
}, [redo]);
const [undoRedoVersion, setUndoRedoVersion] = useState(-1);
+ const [wallpaperShowAll, setWallpaperShowAll] = useState(false);
// Image state for photo mode
const [imageUrl, setImageUrl] = useState<string | null>(null);
@@ -3204,6 +3205,8 @@ export default function Editor() {
onUploadImageToHistory={handleUploadImageToHistory}
elementsTextTabTrigger={elementsTextTabTrigger}
mediaType={isPhotoMode ? "image" : "video"}
+ wallpaperShowAll={wallpaperShowAll}
+ onWallpaperShowAllChange={setWallpaperShowAll}
/>
</Suspense>
</motion.div>
@@ -3477,6 +3480,8 @@ export default function Editor() {
onToggleMuteOriginalAudio={handleToggleMuteOriginalAudio}
onMasterVolumeChange={handleMasterVolumeChange}
videoDuration={videoDuration}
+ wallpaperShowAll={wallpaperShowAll}
+ onWallpaperShowAllChange={setWallpaperShowAll}
/>
<Suspense fallback={null}>
diff --git a/app/components/ui/WalpaperSections.tsx b/app/components/ui/WalpaperSections.tsx
index f3157b6..9047d0e 100644
--- a/app/components/ui/WalpaperSections.tsx
+++ b/app/components/ui/WalpaperSections.tsx
@@ -15,6 +15,8 @@ interface WallpaperGridProps {
selectedIndex?: number;
onSelect?: (index: number) => void;
onUnsplashSelect?: (url: string) => void;
+ showAll?: boolean;
+ onShowAllChange?: (value: boolean) => void;
}
export function OptionsGrid({ selectedIndex = -1, onSelect, onUnsplashSelect }: WallpaperGridProps) {
@@ -25,9 +27,8 @@ export function OptionsGrid({ selectedIndex = -1, onSelect, onUnsplashSelect }:
<TooltipAction label={t("options.none")}>
<button
onClick={() => onSelect?.(-1)}
- className={`aspect-square squircle-element cursor-pointer transition-all flex items-center justify-center relative overflow-hidden ${
- selectedIndex === -1 ? "ring-2 ring-white/90 shadow-lg shadow-black/40" : "hover:ring-2 ring-white/60"
- }`}
+ className={`aspect-square squircle-element cursor-pointer transition-all flex items-center justify-center relative overflow-hidden ${selectedIndex === -1 ? "ring-2 ring-white/90 shadow-lg shadow-black/40" : "hover:ring-2 ring-white/60"
+ }`}
style={{
backgroundImage: "linear-gradient(45deg,#444 25%,transparent 25%),linear-gradient(-45deg,#444 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#444 75%),linear-gradient(-45deg,transparent 75%,#444 75%)",
backgroundSize: "12px 12px",
@@ -46,7 +47,7 @@ export function OptionsGrid({ selectedIndex = -1, onSelect, onUnsplashSelect }:
function CategoryPopover({ category, selectedIndex, onSelect }: { category: WallpaperCategory; selectedIndex: number; onSelect?: (index: number) => void; }) {
const [open, setOpen] = useState(false);
const t = useTranslations("wallpapers");
-
+
const categoryName = t(`categories.${category.id}`);
return (
@@ -129,8 +130,12 @@ function SecondaryCategoryGrid({ category, selectedIndex, onSelect }: { category
);
}
-export function WallpaperCatalogGrid({ selectedIndex = -1, onSelect }: WallpaperGridProps) {
- const [showAll, setShowAll] = useState(false);
+export function WallpaperCatalogGrid({
+ selectedIndex = -1,
+ onSelect,
+ showAll = false,
+ onShowAllChange,
+}: WallpaperGridProps) {
const t = useTranslations("wallpapers");
const primary = WALLPAPER_CATEGORIES.filter((c) => c.primary);
@@ -144,7 +149,7 @@ export function WallpaperCatalogGrid({ selectedIndex = -1, onSelect }: Wallpaper
{secondary.length > 0 && (
<motion.button
- onClick={() => setShowAll((v) => !v)}
+ onClick={() => onShowAllChange?.(!showAll)}
className="flex items-center justify-center gap-1.5 text-[10px] uppercase tracking-widest text-white/60 hover:text-white font-bold transition-colors"
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
@@ -169,9 +174,8 @@ function WallpaperThumb({ item, isSelected, onSelect }: { item: WallpaperItem; i
return (
<button
onClick={() => onSelect?.(item.index)}
- className={`aspect-square squircle-element cursor-pointer transition-all bg-cover bg-center border ${
- isSelected ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"
- }`}
+ className={`aspect-square squircle-element cursor-pointer transition-all bg-cover bg-center border ${isSelected ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"
+ }`}
style={{ backgroundImage: `url('${item.previewUrl}')` }}
aria-label={item.filename}
aria-pressed={isSelected}
@@ -184,9 +188,8 @@ function WallpaperThumbProgressive({ item, isSelected, onSelect }: { item: Wallp
return (
<button
onClick={() => onSelect?.(item.index)}
- className={`aspect-square squircle-element cursor-pointer transition-all bg-cover bg-center border overflow-hidden relative ${
- isSelected ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"
- }`}
+ className={`aspect-square squircle-element cursor-pointer transition-all bg-cover bg-center border overflow-hidden relative ${isSelected ? "ring-2 ring-white/90 border-white/40 shadow-md shadow-black/50" : "border-white/10 hover:border-white/30 hover:ring-1 ring-white/20"
+ }`}
aria-label={item.filename}
aria-pressed={isSelected}
>
@@ -196,9 +199,8 @@ function WallpaperThumbProgressive({ item, isSelected, onSelect }: { item: Wallp
decoding="async"
loading="lazy"
onLoad={() => setIsLoaded(true)}
- className={`w-full h-full object-cover transition-all duration-500 ease-out ${
- isLoaded ? "opacity-100 blur-none scale-100" : "opacity-0 blur-sm scale-105"
- }`}
+ className={`w-full h-full object-cover transition-all duration-500 ease-out ${isLoaded ? "opacity-100 blur-none scale-100" : "opacity-0 blur-sm scale-105"
+ }`}
/>
</button>
);
diff --git a/app/components/ui/editor/ControlPanel.tsx b/app/components/ui/editor/ControlPanel.tsx
index 95e42cb..9f3becc 100644
--- a/app/components/ui/editor/ControlPanel.tsx
+++ b/app/components/ui/editor/ControlPanel.tsx
@@ -60,6 +60,8 @@ export function ControlPanel({
backgroundColorCss,
onBackgroundTabChange,
onWallpaperSelect,
+ wallpaperShowAll = false,
+ onWallpaperShowAllChange,
onBackgroundBlurChange,
onPaddingChange,
onRoundedCornersChange,
@@ -213,6 +215,8 @@ export function ControlPanel({
<WallpaperCatalogGrid
selectedIndex={selectedWallpaper}
onSelect={onWallpaperSelect}
+ showAll={wallpaperShowAll}
+ onShowAllChange={onWallpaperShowAllChange}
onUnsplashSelect={(url) => {
onWallpaperSelect?.(-2);
onImageSelect?.(url);
diff --git a/app/components/ui/editor/Mockup3dMenu.tsx b/app/components/ui/editor/Mockup3dMenu.tsx
index 3b578a0..c0a55b5 100644
--- a/app/components/ui/editor/Mockup3dMenu.tsx
+++ b/app/components/ui/editor/Mockup3dMenu.tsx
@@ -291,6 +291,8 @@ export function Mockup3dMenu({
} else if (imagePhoneDevice === "double_iphone_13_pro") {
setImagePhoneRotX(-30.23);
setImagePhoneRotY(-60.82);
+ } else if (imagePhoneDevice === "iphone-13-pro-max") {
+ setImagePhoneScale(1.2);
} else {
setImagePhoneShadow(0.4);
}
diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsx
index 02283ca..31a7e4c 100644
--- a/app/components/ui/editor/MockupMenu.tsx
+++ b/app/components/ui/editor/MockupMenu.tsx
@@ -153,6 +153,7 @@ export function MockupMenu({
if (id === "iphone-13-pro-max") {
setImagePhoneRotX(-58.23);
setImagePhoneRotY(-29.82);
+ setImagePhoneScale(1.2);
} else if (id === "double_iphone_13_pro") {
setImagePhoneRotX(-30.23);
setImagePhoneRotY(-60.82);
@@ -314,8 +315,8 @@ export function MockupMenu({
<button
type="button"
className={`group relative flex items-center gap-3 p-2 squircle-element border transition-all w-full h-35 ${mockupId !== "none"
- ? "bg-blue-500/10 border-blue-500/40 text-blue-300"
- : "bg-white/3 border-white/[0.07] text-white/40 hover:border-white/20"
+ ? "bg-blue-500/10 border-blue-500/40 text-blue-300"
+ : "bg-white/3 border-white/[0.07] text-white/40 hover:border-white/20"
}`}
aria-label={t("windowType")}
aria-haspopup="dialog"
@@ -358,8 +359,8 @@ export function MockupMenu({
key={cat.id}
onClick={() => handleCategoryChange(cat.id)}
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[10px] font-medium uppercase tracking-wider transition-all ${selectedCategory === cat.id
- ? "bg-blue-500/20 text-blue-400 border border-blue-500/40"
- : "bg-white/5 text-white/50 hover:text-white/70 border border-transparent hover:border-white/10"
+ ? "bg-blue-500/20 text-blue-400 border border-blue-500/40"
+ : "bg-white/5 text-white/50 hover:text-white/70 border border-transparent hover:border-white/10"
}`}
>
<Icon icon={cat.icon} width="12" />
diff --git a/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx b/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx
index 31e18fe..abc7328 100644
--- a/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx
+++ b/app/components/ui/editor/mockups-3d/IPhone13ProMax3DViewer.tsx
@@ -1,8 +1,7 @@
"use client";
-
import { Canvas, useThree, useFrame } from "@react-three/fiber";
import { PerspectiveCamera, useGLTF, Environment, OrbitControls, ContactShadows } from "@react-three/drei";
-import { useEffect, useRef, useState, Suspense, useLayoutEffect } from "react";
+import { useEffect, useRef, useState, Suspense, useLayoutEffect, useMemo } from "react";
import * as THREE from "three";
import { createCoverScreenCanvas, applyCropToImage, parseShadowColor, type ImageMaskConfigLike } from "@/lib/phone3d.utils";
import type { OrbitControls as OrbitControlsType } from 'three-stdlib';
@@ -145,7 +144,6 @@ function ModelScene({
materials: GLTFMaterials;
};
const { nodes, materials } = gltf;
-
const orbitRef = useRef<OrbitControlsType | null>(null);
const lastLoadedImageUrlRef = useRef<string | null>(null);
const lastLoadedMaskKeyRef = useRef<string | null>(null);
@@ -167,7 +165,6 @@ function ModelScene({
useEffect(() => {
const capturedOnApi = onApiRef.current;
const RENDER_PIXEL_RATIO = 2;
-
const api: IPhone13ProMax3DApi = {
renderAt: (w, h) => {
const cam = cameraRef.current ?? camera;
@@ -176,13 +173,10 @@ function ModelScene({
const maxDim = Math.floor(maxTexSize / RENDER_PIXEL_RATIO) - 1;
const safeW = Math.max(1, Math.min(Math.round(w), maxDim));
const safeH = Math.max(1, Math.min(Math.round(h), maxDim));
-
(cam as THREE.PerspectiveCamera).aspect = safeW / safeH;
(cam as THREE.PerspectiveCamera).updateProjectionMatrix();
-
gl.setPixelRatio(RENDER_PIXEL_RATIO);
gl.setSize(safeW, safeH, false);
-
if (videoTextureRef.current) videoTextureRef.current.needsUpdate = true;
gl.render(scene, cam);
},
@@ -191,16 +185,13 @@ function ModelScene({
if (!cam) return;
const freshW = gl.domElement.clientWidth;
const freshH = gl.domElement.clientHeight;
-
(cam as THREE.PerspectiveCamera).aspect = freshW / freshH;
(cam as THREE.PerspectiveCamera).updateProjectionMatrix();
-
gl.setPixelRatio(window.devicePixelRatio > 1 ? 2 : 1);
gl.setSize(freshW, freshH, false);
},
hasBuiltInShadow: true,
};
-
capturedOnApi?.(api);
return () => capturedOnApi?.(null);
}, [gl, scene, camera, cameraRef]);
@@ -223,7 +214,6 @@ function ModelScene({
}
return;
}
-
const tex = new THREE.VideoTexture(videoElement);
tex.flipY = true;
tex.colorSpace = THREE.SRGBColorSpace;
@@ -232,12 +222,10 @@ function ModelScene({
tex.magFilter = THREE.LinearFilter;
tex.wrapS = THREE.ClampToEdgeWrapping;
tex.wrapT = THREE.ClampToEdgeWrapping;
-
if (videoTextureRef.current) {
videoTextureRef.current.dispose();
}
videoTextureRef.current = tex;
-
const applyVideoTex = () => {
const mat = wallpaperMatRef.current;
if (!mat) return;
@@ -248,9 +236,7 @@ function ModelScene({
mat.color.set(0xffffff);
mat.needsUpdate = true;
};
-
applyVideoTex();
-
return () => {
if (videoTextureRef.current === tex) {
videoTextureRef.current = null;
@@ -263,14 +249,11 @@ function ModelScene({
const mat = wallpaperMatRef.current;
if (!mat) return;
if (videoElement) return;
-
const maskKey = imageMaskConfig ? JSON.stringify(imageMaskConfig) : null;
const cropKey = cropArea ? JSON.stringify(cropArea) : null;
-
if (!imageUrl) {
const placeholderKey = `__placeholder__:${PLACEHOLDER_PHONE_URL}`;
if (lastLoadedImageUrlRef.current === placeholderKey) return;
-
const img = new Image();
img.crossOrigin = "anonymous";
img.onload = () => {
@@ -306,14 +289,11 @@ function ModelScene({
img.src = PLACEHOLDER_PHONE_URL;
return;
}
-
if (
lastLoadedImageUrlRef.current === imageUrl &&
lastLoadedMaskKeyRef.current === maskKey &&
lastLoadedCropKeyRef.current === cropKey
- )
- return;
-
+ ) return;
const img = new Image();
img.crossOrigin = "anonymous";
img.onload = () => {
@@ -351,29 +331,23 @@ function ModelScene({
}, []);
const prevRotationRef = useRef<{ x: number; y: number } | null>(null);
-
useEffect(() => {
if (
prevRotationRef.current?.x === initialRotationX &&
prevRotationRef.current?.y === initialRotationY
- )
- return;
-
+ ) return;
const id = setTimeout(() => {
const orbit = orbitRef.current;
if (!orbit) return;
-
const DEG = Math.PI / 180;
const radius = 1.5;
const phi = Math.PI / 2 - initialRotationX * DEG;
const theta = initialRotationY * DEG;
-
orbit.object.position.setFromSphericalCoords(radius, phi, theta);
orbit.update();
invalidate();
prevRotationRef.current = { x: initialRotationX, y: initialRotationY };
}, 0);
-
return () => clearTimeout(id);
}, [initialRotationX, initialRotationY, zoom]);
@@ -387,22 +361,53 @@ function ModelScene({
const shadowT = Math.max(0, Math.min(1, shadowIntensity));
const showContactShadow = shadowT > 0.01;
- const contactOpacity = shadowT * 0.45;
- // Sombra proyectada — más larga, con dirección, más sutil
- const castOpacity = shadowT * 0.55;
- const contactBlur = 1.5 + shadowT * 1.5;
+
+ const customShadowTexture = useMemo(() => {
+ const canvas = document.createElement("canvas");
+ canvas.width = 512;
+ canvas.height = 512;
+ const ctx = canvas.getContext("2d");
+
+ if (ctx) {
+ ctx.fillStyle = "black";
+ ctx.fillRect(0, 0, 512, 512);
+
+ ctx.shadowColor = "white";
+ ctx.shadowBlur = 45;
+ ctx.fillStyle = "white";
+
+ const w = 150;
+ const h = 300;
+ const x = 256 - w / 2;
+ const y = 256 - h / 2;
+ const r = 32;
+
+ ctx.beginPath();
+ ctx.moveTo(x + r, y);
+ ctx.lineTo(x + w - r, y);
+ ctx.quadraticCurveTo(x + w, y, x + w, y + r);
+ ctx.lineTo(x + w, y + h - r);
+ ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
+ ctx.lineTo(x + r, y + h);
+ ctx.quadraticCurveTo(x, y + h, x, y + h - r);
+ ctx.lineTo(x, y + r);
+ ctx.quadraticCurveTo(x, y, x + r, y);
+ ctx.closePath();
+
+ ctx.fill();
+
+ ctx.shadowBlur = 0;
+ ctx.fill();
+ }
+
+ const texture = new THREE.CanvasTexture(canvas);
+ texture.needsUpdate = true;
+ return texture;
+ }, []);
return (
<>
- <PerspectiveCamera
- ref={cameraRef}
- makeDefault
- fov={40}
- near={0.01}
- far={100}
- position={DEFAULT_CAMERA_POS}
- zoom={zoom}
- />
+ <PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={DEFAULT_CAMERA_POS} zoom={zoom} />
<Environment files={HDRI_FILES[environment as EnvironmentPreset]} environmentIntensity={glow} background={false} />
<OrbitControls
ref={orbitRef}
@@ -422,73 +427,69 @@ function ModelScene({
/>
<ambientLight intensity={0.3} />
<directionalLight
- position={[3, 6, 5]}
+ position={[4, 6, 5]}
intensity={0.6}
- castShadow
- shadow-mapSize={[2048, 2048]}
- shadow-camera-near={0.1}
- shadow-camera-far={10}
- shadow-camera-left={-1.5}
- shadow-camera-right={1.5}
- shadow-camera-top={1.5}
- shadow-camera-bottom={-1.5}
- shadow-bias={-0.0015}
- shadow-normalBias={0.02}
/>
<directionalLight position={[-4, -2, 3]} intensity={0.25} color="#c8d8ff" />
<directionalLight position={[0, -5, 5]} intensity={0.35} />
+
{showContactShadow && (
- <>
- {/* Capa 1: sombra proyectada real, con dirección, del shadow map */}
- <mesh position={[0, -0.55, 0]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow>
- <planeGeometry args={[10, 10]} />
- <shadowMaterial transparent opacity={castOpacity} color={shadowColor} />
- </mesh>
- {/* Capa 2: AO de contacto, corta y muy oscura, justo bajo el modelo.
- Offset de +1mm en Y respecto al plano de arriba para evitar z-fighting
- entre ambos planos coplanares. */}
- <ContactShadows
- position={[0, -0.549, 0]}
- opacity={contactOpacity}
- scale={3}
- blur={contactBlur}
- far={4}
+ <mesh
+ /* 1. POSICIÓN: [Izquierda/Derecha, Arriba/Abajo, Adelante/Atrás] */
+ position={[-0.00, -0.203, -0.156]}
+
+ /* 2. ROTACIÓN: [-Math.PI / 2, Inclinación, Giro en el piso] */
+ rotation={[-Math.PI / 2, 0, 0]}
+
+ /*
+ [Ancho, Largo/Profundidad, Z]
+ */
+ /* 3. DIMENSIONES: [Ancho de la silueta, Largo/Profundidad de la silueta, Grosor] */
+ scale={[0.55, 0.55, 1.5]}
+ >
+ <planeGeometry args={[1, 1]} />
+ <meshBasicMaterial
color={shadowColor}
- resolution={512}
+ transparent
+ opacity={shadowT * 0.7} /* Un poco más suave para que sea sutil */
+ alphaMap={customShadowTexture}
+ depthWrite={false}
/>
- </>
+ </mesh>
)}
- <group ref={rootRef} rotation={[0, Math.PI, 0]} scale={0.007} dispose={null}>
+
+ <group ref={rootRef} rotation={[0, Math.PI, 0]} scale={0.0040} dispose={null}>
<group scale={100}>
- <mesh castShadow receiveShadow geometry={nodes.Frame_Frame_0.geometry} material={materials.Frame} />
- <mesh castShadow receiveShadow geometry={nodes.Frame_Frame2_0.geometry} material={materials.Frame2} />
- <mesh castShadow receiveShadow geometry={nodes.Frame_Port_0.geometry} material={materials.Port} />
- <mesh castShadow receiveShadow geometry={nodes.Frame_Antenna_0.geometry} material={materials.Antenna} />
- <mesh castShadow receiveShadow geometry={nodes.Frame_Mic_0.geometry} material={materials.material} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Mic_0.geometry} material={materials.material} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Bezel_0.geometry} material={materials.Bezel} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Body_0.geometry} material={materials.Body} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Wallpaper_0.geometry} material={materials.Wallpaper} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Camera_Glass_0.geometry} material={materials.Camera_Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Lens_0.geometry} material={materials.Lens} />
- <mesh castShadow receiveShadow geometry={nodes.Body_Material_0.geometry} material={materials.Material} />
- <mesh castShadow receiveShadow geometry={nodes.Camera_Body_0.geometry} material={materials.Body} />
- <mesh castShadow receiveShadow geometry={nodes.Camera_Glass_0.geometry} material={materials.Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Camera_Camera_Frame001_0.geometry} material={materials["Camera_Frame.001"]} />
- <mesh castShadow receiveShadow geometry={nodes.Camera_Mic_0.geometry} material={materials.material} />
- <mesh castShadow receiveShadow geometry={nodes.Body001_Screen_Glass_0.geometry} material={materials.Screen_Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Button_Frame_0.geometry} material={materials.Frame} />
- <mesh castShadow receiveShadow geometry={nodes.Circle003_Frame_0.geometry} material={materials.Frame} />
- <mesh castShadow receiveShadow geometry={nodes.Apple_Logo_Logo_0.geometry} material={materials.Logo} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Body_0.geometry} material={materials.Body} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Gray_Glass_0.geometry} material={materials.Gray_Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Flash_0.geometry} material={materials.Flash} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Port_0.geometry} material={materials.Port} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Camera_Frame_0.geometry} material={materials.Camera_Frame} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Camera_Glass_0.geometry} material={materials.Camera_Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Lens_0.geometry} material={materials.Lens} />
- <mesh castShadow receiveShadow geometry={nodes.Camera001_Black_Glass_0.geometry} material={materials.Black_Glass} />
- <mesh castShadow receiveShadow geometry={nodes.Camera003_Material002_0.geometry} material={materials["Material.002"]} />
+ {/* La geometría del teléfono se mantiene exactamente igual */}
+ <mesh receiveShadow geometry={nodes.Frame_Frame_0.geometry} material={materials.Frame} />
+ <mesh receiveShadow geometry={nodes.Frame_Frame2_0.geometry} material={materials.Frame2} />
+ <mesh receiveShadow geometry={nodes.Frame_Port_0.geometry} material={materials.Port} />
+ <mesh receiveShadow geometry={nodes.Frame_Antenna_0.geometry} material={materials.Antenna} />
+ <mesh receiveShadow geometry={nodes.Frame_Mic_0.geometry} material={materials.material} />
+ <mesh receiveShadow geometry={nodes.Body_Mic_0.geometry} material={materials.material} />
+ <mesh receiveShadow geometry={nodes.Body_Bezel_0.geometry} material={materials.Bezel} />
+ <mesh receiveShadow geometry={nodes.Body_Body_0.geometry} material={materials.Body} />
+ <mesh receiveShadow geometry={nodes.Body_Wallpaper_0.geometry} material={materials.Wallpaper} />
+ <mesh receiveShadow geometry={nodes.Body_Camera_Glass_0.geometry} material={materials.Camera_Glass} />
+ <mesh receiveShadow geometry={nodes.Body_Lens_0.geometry} material={materials.Lens} />
+ <mesh receiveShadow geometry={nodes.Body_Material_0.geometry} material={materials.Material} />
+ <mesh receiveShadow geometry={nodes.Camera_Body_0.geometry} material={materials.Body} />
+ <mesh receiveShadow geometry={nodes.Camera_Glass_0.geometry} material={materials.Glass} />
+ <mesh receiveShadow geometry={nodes.Camera_Camera_Frame001_0.geometry} material={materials["Camera_Frame.001"]} />
+ <mesh receiveShadow geometry={nodes.Camera_Mic_0.geometry} material={materials.material} />
+ <mesh receiveShadow geometry={nodes.Body001_Screen_Glass_0.geometry} material={materials.Screen_Glass} />
+ <mesh receiveShadow geometry={nodes.Button_Frame_0.geometry} material={materials.Frame} />
+ <mesh receiveShadow geometry={nodes.Circle003_Frame_0.geometry} material={materials.Frame} />
+ <mesh receiveShadow geometry={nodes.Apple_Logo_Logo_0.geometry} material={materials.Logo} />
+ <mesh receiveShadow geometry={nodes.Camera001_Body_0.geometry} material={materials.Body} />
+ <mesh receiveShadow geometry={nodes.Camera001_Gray_Glass_0.geometry} material={materials.Gray_Glass} />
+ <mesh receiveShadow geometry={nodes.Camera001_Flash_0.geometry} material={materials.Flash} />
+ <mesh receiveShadow geometry={nodes.Camera001_Port_0.geometry} material={materials.Port} />
+ <mesh receiveShadow geometry={nodes.Camera001_Camera_Frame_0.geometry} material={materials.Camera_Frame} />
+ <mesh receiveShadow geometry={nodes.Camera001_Camera_Glass_0.geometry} material={materials.Camera_Glass} />
+ <mesh receiveShadow geometry={nodes.Camera001_Lens_0.geometry} material={materials.Lens} />
+ <mesh receiveShadow geometry={nodes.Camera001_Black_Glass_0.geometry} material={materials.Black_Glass} />
+ <mesh receiveShadow geometry={nodes.Camera003_Material002_0.geometry} material={materials["Material.002"]} />
</group>
</group>
</>
@@ -537,7 +538,6 @@ function CanvasWithLoader({
environment?: EnvironmentPreset;
}) {
const [loaded, setLoaded] = useState(false);
-
return (
<>
<Canvas
@@ -619,14 +619,11 @@ export function IPhone13ProMax3DViewer({
const rootRef = useRef<THREE.Group | null>(null);
const cameraRef = useRef<THREE.PerspectiveCamera | null>(null);
const [grabbing, setGrabbing] = useState(false);
-
const t = Math.max(0, Math.min(1, shadowIntensity));
const tEased = t * t;
const computedBlur = tEased * 60;
const computedOpacity = tEased * 0.7;
- const shadowRgba = shadowColor.startsWith("#")
- ? parseShadowColor(shadowColor, computedOpacity)
- : shadowColor;
+ const shadowRgba = shadowColor.startsWith("#") ? parseShadowColor(shadowColor, computedOpacity) : shadowColor;
const hasShadow = t > 0.01;
return (
@@ -637,8 +634,8 @@ export function IPhone13ProMax3DViewer({
transformOrigin: "top center",
width: 480,
height: 1000 + (hasShadow ? computedBlur * 0.8 : 0),
- marginTop: "200px",
- marginLeft: "170px",
+ marginBottom: "300px",
+ marginRight: "250px",
}}
>
<div style={{ position: "relative", width: 480, height: 1000 }}>
@@ -666,9 +663,7 @@ export function IPhone13ProMax3DViewer({
zIndex: 2,
overflow: "visible",
cursor: grabbing ? "grabbing" : "grab",
- filter: hasShadow
- ? `drop-shadow(0px ${(tEased * 22).toFixed(1)}px ${(tEased * 32).toFixed(1)}px ${shadowRgba})`
- : "none",
+ filter: "none",
transition: "filter 0.15s ease",
pointerEvents: "auto",
}}
diff --git a/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx b/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx
index 3e26145..43495f1 100644
--- a/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx
+++ b/app/components/ui/editor/mockups-3d/IPhone17ProMax3DViewer.tsx
@@ -112,7 +112,6 @@ function ModelScene({
if (child instanceof THREE.Mesh) {
if (child.name.includes("HkNSnYzBPABcqwM")) {
const targetMat = (child.material as THREE.MeshPhysicalMaterial).clone();
-
targetMat.normalMap = null;
targetMat.roughnessMap = null;
targetMat.metalnessMap = null;
@@ -366,7 +365,7 @@ function ModelScene({
)}
<group ref={rootRef} rotation={[0, 0, 0]} scale={1} dispose={null}>
- <primitive object={clonedScene} scale={5} rotation={[0, 0, 0]} castShadow receiveShadow />
+ <primitive object={clonedScene} scale={4.2} rotation={[0, 0, 0]} castShadow receiveShadow />
</group>
</>
);
@@ -490,7 +489,7 @@ export function IPhone17ProMax3DViewer({
return (
<>
- <div style={{ display: "inline-block", transformOrigin: "top center", width: 480, height: 1000 + (hasShadow ? computedBlur * 0.8 : 0), marginTop: "200px", marginLeft: "170px" }}>
+ <div style={{ display: "inline-block", transformOrigin: "top center", width: 480, height: 1000 + (hasShadow ? computedBlur * 0.8 : 0), marginTop: "100px", marginLeft: "170px" }}>
<div style={{ position: "relative", width: 480, height: 1000 }}>
{hasShadow && (
<div aria-hidden style={{ position: "absolute", bottom: -(computedBlur * 0.5), left: `${20 + tEased * 5}%`, width: `${60 - tEased * 10}%`, height: Math.max(4, computedBlur * 0.55), borderRadius: "50%", background: shadowRgba, filter: `blur(${Math.max(2, computedBlur * 0.6)}px)`, zIndex: 0, pointerEvents: "none" }} />
diff --git a/types/control-panel.types.ts b/types/control-panel.types.ts
index 3352332..f1aa35e 100644
--- a/types/control-panel.types.ts
+++ b/types/control-panel.types.ts
@@ -93,4 +93,6 @@ export interface ControlPanelProps {
onUploadImageToHistory?: (file: File) => void;
/** Which editor mode — determines which motion menu to show */
mediaType?: "video" | "image";
+ wallpaperShowAll?: boolean;
+ onWallpaperShowAllChange?: (value: boolean) => void;
}