Create professional demos and 3D mockups in seconds, directly in your browser
feat: add Double iPhone 13 Pro model and update related configurations
CristianOlivera18ef71cace8bb
diff --git a/app/components/ui/editor/DoubleIPhone3DViewer.tsx b/app/components/ui/editor/DoubleIPhone3DViewer.tsxnew file mode 100644index 0000000..f910dce--- /dev/null+++ b/app/components/ui/editor/DoubleIPhone3DViewer.tsx@@ -0,0 +1,494 @@+"use client";++import { Canvas, useThree, useFrame } from "@react-three/fiber";+import { PerspectiveCamera, Environment, OrbitControls } from "@react-three/drei";+import { useEffect, useRef, useState, Suspense, useCallback, useLayoutEffect } from "react";+import * as THREE from "three";+import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";+import {+ PHONE_W,+ PHONE_H,+ createCoverScreenCanvas,+ applyCropToImage,+ type ImageMaskConfigLike,+ parseShadowColor,+} from "@/lib/phone3d.utils";+import type { OrbitControls as OrbitControlsType } from 'three-stdlib';+import { ControlsPopup } from "@/components/ui/ControlsPopup";+import { EnvironmentPreset, ViewerControls3D } from "@/lib/viewer-controls3d";++export interface DoubleIPhone3DApi {+ renderAt: (width: number, height: number) => void;+ restorePreview: () => void;+ hasBuiltInShadow: boolean;+}++interface Props {+ imageUrl?: string | null;+ imageMaskConfig?: ImageMaskConfigLike | null;+ cropArea?: { x: number; y: number; width: number; height: number } | null;+ initialRotationX?: number;+ initialRotationY?: number;+ initialRotationZ?: number;+ onRotationChange?: (rx: number, ry: number) => void;+ onMount?: (canvas: HTMLCanvasElement) => void;+ onApi?: (api: DoubleIPhone3DApi | null) => void;+ scale?: number;+ zoom?: number;+ shadowIntensity?: number;+ shadowColor?: string;+ videoElement?: HTMLVideoElement | null;+}++const DEG = Math.PI / 180;+const PLACEHOLDER_PHONE_URL = "/images/mockups-3d/placeholder-phone.avif";+const MODEL_URL = "/models/double_iphone_13_pro.glb";++let cachedDoublePhonePromise: Promise<THREE.Group> | null = null;++function loadDoubleIPhoneGltf(): Promise<THREE.Group> {+ if (!cachedDoublePhonePromise) {+ cachedDoublePhonePromise = new Promise((resolve, reject) => {+ new GLTFLoader().load(MODEL_URL, (gltf) => resolve(gltf.scene), undefined, reject);+ });+ }+ return cachedDoublePhonePromise;+}++function ModelScene({+ imageUrl,+ imageMaskConfig,+ cropArea,+ initialRotationX = -58.23,+ initialRotationY = -29,+ initialRotationZ = 0,+ onRotationChange,+ rootRef,+ cameraRef,+ zoom = 1,+ onApi,+ onLoaded,+ videoElement,+}: Props & {+ rootRef: React.MutableRefObject<THREE.Group | null>;+ cameraRef: React.MutableRefObject<THREE.PerspectiveCamera | null>;+ onLoaded?: () => void;+}) {+ const { gl, scene, camera } = useThree();+ const orbitRef = useRef<OrbitControlsType | null>(null);+ const screenMatRef = useRef<THREE.MeshBasicMaterial | null>(null);+ const videoTextureRef = useRef<THREE.VideoTexture | null>(null);+ const [modelGroup, setModelGroup] = useState<THREE.Group | null>(null);++ const lastLoadedUrlRef = useRef<string | null>(null);+ const lastLoadedCropKeyRef = useRef<string | null>(null);++ const onApiRef = useRef(onApi);+ useLayoutEffect(() => {+ onApiRef.current = onApi;+ });++ const { autoRotate, rotationSpeed, glow, environment } = ViewerControls3D({+ defaultEnvironment: "studio",+ defaultGlow: 3.0,+ });++ useFrame(() => {+ if (videoElement && videoTextureRef.current) {+ videoTextureRef.current.needsUpdate = true;+ }+ });++ useEffect(() => {+ const capturedOnApi = onApiRef.current;+ const RENDER_PIXEL_RATIO = 2;++ const api: DoubleIPhone3DApi = {+ renderAt: (w, h) => {+ const cam = cameraRef.current ?? camera;+ if (!cam) return;+ const maxTexSize = gl.capabilities.maxTextureSize || 4096;+ 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);+ },+ restorePreview: () => {+ const cam = cameraRef.current ?? camera;+ 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(3);+ gl.setSize(freshW, freshH, false);+ },+ hasBuiltInShadow: true,+ };++ capturedOnApi?.(api);+ return () => capturedOnApi?.(null);+ }, [gl, scene, camera, cameraRef]);++ const applyTexture = useCallback(() => {+ if (videoElement) return;+ const mat = screenMatRef.current;+ if (!mat) return;++ const cropKey = cropArea ? JSON.stringify(cropArea) : null;+ const targetImgUrl = imageUrl || PLACEHOLDER_PHONE_URL;++ if (+ lastLoadedUrlRef.current === targetImgUrl &&+ lastLoadedCropKeyRef.current === cropKey &&+ mat.map !== null+ ) {+ return;+ }++ const img = new Image();+ img.crossOrigin = "anonymous";+ img.onload = () => {+ const currentMat = screenMatRef.current;+ if (!currentMat) return;++ const TARGET_W = 1080;+ const TARGET_H = 2340;++ const sourceImg = cropArea ? applyCropToImage(img, cropArea) : img;+ const cover = createCoverScreenCanvas(sourceImg, TARGET_W, TARGET_H, 0, imageMaskConfig);++ if (currentMat.map) {+ currentMat.map.dispose();+ }++ const tex = new THREE.CanvasTexture(cover);+ tex.flipY = true;+ tex.colorSpace = THREE.SRGBColorSpace;+ tex.generateMipmaps = true;+ tex.minFilter = THREE.LinearMipmapLinearFilter;+ tex.magFilter = THREE.LinearFilter;+ tex.wrapS = THREE.ClampToEdgeWrapping;+ tex.wrapT = THREE.ClampToEdgeWrapping;+ tex.anisotropy = gl.capabilities.getMaxAnisotropy();++ currentMat.map = tex;+ currentMat.color.set(0xffffff);+ currentMat.needsUpdate = true;++ lastLoadedUrlRef.current = targetImgUrl;+ lastLoadedCropKeyRef.current = cropKey;+ };+ img.onerror = () => {+ if (mat.map) mat.map.dispose();+ mat.color.set(0x111111);+ mat.needsUpdate = true;+ };+ img.src = targetImgUrl;+ }, [imageUrl, imageMaskConfig, cropArea, gl, videoElement]);++ const applyVideoTextureIfReady = useCallback(() => {+ const mat = screenMatRef.current;+ const tex = videoTextureRef.current;++ if (mat && tex) {+ if (mat.map && mat.map !== tex) {+ mat.map.dispose();+ }+ tex.flipY = false;+ tex.needsUpdate = true;+ mat.map = tex;+ mat.color.set(0xffffff);+ mat.needsUpdate = true;+ }+ }, []);++ useEffect(() => {+ if (!videoElement) {+ if (videoTextureRef.current) {+ videoTextureRef.current.dispose();+ videoTextureRef.current = null;+ }+ return;+ }++ const tex = new THREE.VideoTexture(videoElement);+ tex.flipY = false;+ tex.colorSpace = THREE.SRGBColorSpace;+ tex.generateMipmaps = true;+ tex.minFilter = THREE.LinearMipmapLinearFilter;+ tex.magFilter = THREE.LinearFilter;+ tex.wrapS = THREE.ClampToEdgeWrapping;+ tex.wrapT = THREE.ClampToEdgeWrapping;++ if (videoTextureRef.current) {+ videoTextureRef.current.dispose();+ }+ videoTextureRef.current = tex;++ applyVideoTextureIfReady();++ return () => {+ if (videoTextureRef.current === tex) {+ videoTextureRef.current = null;+ }+ tex.dispose();+ };+ }, [videoElement, applyVideoTextureIfReady]);++ const applyTextureRef = useRef(applyTexture);+ useEffect(() => {+ applyTextureRef.current = applyTexture;+ }, [applyTexture]);++ useEffect(() => {+ applyTexture();+ }, [applyTexture]);++ useEffect(() => {+ let isMounted = true;++ const finalizeSetup = (group: THREE.Group) => {+ if (!isMounted) return;+ setModelGroup(group);+ setTimeout(() => {+ if (!isMounted) return;+ applyTextureRef.current();+ onLoaded?.();+ }, 50);+ };++ loadDoubleIPhoneGltf().then((loadedScene) => {+ const group = loadedScene.clone(true);++ const camZ = 1.5;+ const box = new THREE.Box3().setFromObject(group);+ const center = box.getCenter(new THREE.Vector3());+ const size = box.getSize(new THREE.Vector3());+ const halfH = camZ * Math.tan((40 / 2) * DEG);+ const sf = (halfH * 2 * 0.55) / size.y;++ group.scale.setScalar(sf);+ group.position.copy(center).negate().multiplyScalar(sf);++ const basicMat = new THREE.MeshBasicMaterial({+ color: 0x111111,+ side: THREE.FrontSide,+ transparent: false,+ depthTest: true,+ depthWrite: true,+ });++ screenMatRef.current = basicMat;+ applyVideoTextureIfReady();++ group.traverse((child) => {+ if (child instanceof THREE.Mesh) {+ if (child.name === "Object_13" || child.name === "Object_26") {+ child.material = basicMat;+ }+ }+ });++ finalizeSetup(group);+ });++ return () => {+ isMounted = false;+ };+ }, []);++ const prevRotationRef = useRef<{ x: number; y: number } | null>(null);++ useEffect(() => {+ if (+ prevRotationRef.current?.x === initialRotationX &&+ prevRotationRef.current?.y === initialRotationY+ ) {+ return;+ }++ const id = setTimeout(() => {+ const orbit = orbitRef.current;+ if (!orbit) return;++ const radius = 1.5 / zoom;+ const phi = Math.PI / 2 - initialRotationX * DEG;+ const theta = initialRotationY * DEG;++ orbit.object.position.setFromSphericalCoords(radius, phi, theta);+ orbit.update();++ prevRotationRef.current = { x: initialRotationX, y: initialRotationY };+ }, 0);++ return () => clearTimeout(id);+ }, [initialRotationX, initialRotationY, zoom]);++ useEffect(() => {+ if (rootRef.current) {+ // Aplicamos el valor Z de la UI al eje Y del modelo+ rootRef.current.rotation.y = initialRotationZ * DEG;+ }+ }, [initialRotationZ]);++ return (+ <>+ <PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={[0, 0, 1.5 / zoom]} />+ <OrbitControls+ ref={orbitRef}+ enableZoom={false}+ enablePan={false}+ enableDamping+ dampingFactor={0.08}+ autoRotate={autoRotate}+ autoRotateSpeed={rotationSpeed}+ onEnd={() => {+ const orbit = orbitRef.current;+ if (!orbit || !onRotationChange) return;+ const ry = orbit.getAzimuthalAngle() * (180 / Math.PI);+ const rx = (Math.PI / 2 - orbit.getPolarAngle()) * (180 / Math.PI);+ onRotationChange(rx, ry);+ }}+ />+ <Environment preset={environment as EnvironmentPreset} environmentIntensity={glow} background={false} />++ <ambientLight intensity={0.3} />+ <directionalLight position={[3, 6, 5]} intensity={0.6} />+ <directionalLight position={[-4, -2, 3]} intensity={0.25} color="#c8d8ff" />+ <directionalLight position={[0, -5, 5]} intensity={0.35} />++ <group ref={rootRef} rotation={[0, initialRotationZ * DEG, 0]}>+ {modelGroup && <primitive object={modelGroup} />}+ </group>+ </>+ );+}++function CanvasWithLoader(+ props: Props & {+ rootRef: React.MutableRefObject<THREE.Group | null>;+ cameraRef: React.MutableRefObject<THREE.PerspectiveCamera | null>;+ }+) {+ const [loaded, setLoaded] = useState(false);+ const handleLoaded = useCallback(() => setLoaded(true), []);++ return (+ <>+ <Canvas+ style={{ width: "100%", height: "100%", overflow: "visible" }}+ gl={{+ antialias: true,+ alpha: true,+ preserveDrawingBuffer: true,+ powerPreference: "high-performance",+ failIfMajorPerformanceCaveat: false,+ }}+ dpr={3}+ onCreated={({ gl, scene }) => {+ gl.outputColorSpace = THREE.SRGBColorSpace;+ gl.toneMapping = THREE.NeutralToneMapping;+ gl.toneMappingExposure = 1.0;+ scene.environmentIntensity = 1.6;+ props.onMount?.(gl.domElement);+ }}+ >+ <Suspense fallback={null}>+ <ModelScene {...props} onLoaded={handleLoaded} />+ </Suspense>+ </Canvas>+ {!loaded && (+ <div+ className="absolute inset-0 flex items-center justify-center pointer-events-none"+ style={{ zIndex: 4 }}+ >+ <div className="w-6 h-6 border-2 border-white/20 border-t-white/60 rounded-full animate-spin" />+ </div>+ )}+ </>+ );+}++export function DoubleIPhone3DViewer(props: Props) {+ const { scale = 1, shadowIntensity = 0, shadowColor = "#000000" } = props;++ 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 hasShadow = t > 0.01;++ return (+ <>+ <ControlsPopup />+ <div+ style={{+ display: "inline-block",+ transformOrigin: "top center",+ width: PHONE_W,+ height: PHONE_H + (hasShadow ? computedBlur * 0.8 : 0),+ marginTop: "220px",+ marginLeft: "140px",+ }}+ >+ <div style={{ position: "relative", width: PHONE_W, height: PHONE_H }}>+ {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",+ }}+ />+ )}++ <div+ style={{+ position: "absolute",+ inset: "-400px",+ 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",+ transition: "filter 0.15s ease",+ pointerEvents: "auto",+ }}+ onPointerDown={() => setGrabbing(true)}+ onPointerUp={() => setGrabbing(false)}+ onPointerLeave={() => setGrabbing(false)}+ >+ <CanvasWithLoader {...props} rootRef={rootRef} cameraRef={cameraRef} />+ </div>+ </div>+ </div>+ </>+ );+}\ No newline at end of filediff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsxindex b21bc42..d8fa0a4 100644--- a/app/components/ui/editor/MockupMenu.tsx+++ b/app/components/ui/editor/MockupMenu.tsx@@ -210,10 +210,13 @@ export function MockupMenu({if (!isSameDevice || isUnposed) {setImagePhoneX(0);setImagePhoneY(0);- setImagePhoneScale(0.8);+ setImagePhoneScale(0.9);if (id === "iphone-13-pro-max") {setImagePhoneRotX(-58.23);setImagePhoneRotY(-29.82);+ } else if (id === "double_iphone_13_pro") {+ setImagePhoneRotX(-30.23);+ setImagePhoneRotY(-60.82);} else if (id === "laptop") {setImagePhoneRotX(43.23);setImagePhoneRotY(-37.82);diff --git a/app/contexts/Mockup3dContext.tsx b/app/contexts/Mockup3dContext.tsxindex 0c164dd..df136ea 100644--- a/app/contexts/Mockup3dContext.tsx+++ b/app/contexts/Mockup3dContext.tsx@@ -16,13 +16,14 @@ interface Mockup3dState {setImagePhoneActive: (v: boolean) => void;/** X offset (px) from canvas center */imagePhoneX: number;- setImagePhoneX: (v: number) => void;+ setImagePhoneX: (v: number | ((prev: number) => number)) => void;+/** Y offset (px) from canvas center */imagePhoneY: number;- setImagePhoneY: (v: number) => void;+ setImagePhoneY: (v: number | ((prev: number) => number)) => void;/** Canvas-level scale of the phone mockup */imagePhoneScale: number;- setImagePhoneScale: (v: number) => void;+ setImagePhoneScale: (v: number | ((prev: number) => number)) => void;/** Persisted 3D rotation offset (degrees) from user drag */imagePhoneRotX: number;setImagePhoneRotX: (v: number) => void;@@ -35,8 +36,8 @@ interface Mockup3dState {imagePhonePerspective: number;setImagePhonePerspective: (v: number) => void;/** Which 3D device model is active: the default phone JSON, iPhone 15 Pro Max, Samsung S25 Ultra, or single macOS laptop */- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop';- setImagePhoneDevice: (d: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop') => void;+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';+ setImagePhoneDevice: (d: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop') => void;imagePhonePresetId: string;setImagePhonePresetId: (id: string) => void;/** Laptop opening animation progress (0 = closed, 1 = fully open) */@@ -65,7 +66,7 @@ export function Mockup3dProvider({ children }: { children: ReactNode }) {const [imagePhoneRotY, setImagePhoneRotY] = useState(0);const [imagePhoneRotZ, setImagePhoneRotZ] = useState(0);const [imagePhonePerspective, setImagePhonePerspective] = useState(600);- const [imagePhoneDevice, setImagePhoneDevice] = useState<'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop'>('phone');+ const [imagePhoneDevice, setImagePhoneDevice] = useState<'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop'>('phone');const [imagePhonePresetId, setImagePhonePresetId] = useState('front');const [imagePhoneOpening, setImagePhoneOpening] = useState(1);const [imagePhoneShadow, setImagePhoneShadow] = useState(0.6);diff --git a/hooks/useImageProjects.ts b/hooks/useImageProjects.tsindex a025e41..79703f2 100644--- a/hooks/useImageProjects.ts+++ b/hooks/useImageProjects.ts@@ -50,7 +50,7 @@ interface ImageProjectState {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';imagePhoneOpening: number;imagePhoneShadow: number;imagePhoneShadowColor: string;diff --git a/lib/phone3d.utils.ts b/lib/phone3d.utils.tsindex 7794885..41c29c1 100644--- a/lib/phone3d.utils.ts+++ b/lib/phone3d.utils.ts@@ -9,18 +9,19 @@ export const RENDER_W = PHONE_W * RENDER_MULTIPLIER;export const RENDER_H = PHONE_H * RENDER_MULTIPLIER;export const DEVICE_3D_DIMENSIONS: Record<string, { width: number; height: number }> = {- 'phone': { width: PHONE_W, height: PHONE_H },- 'iphone': { width: PHONE_W, height: PHONE_H },- 'iphone-13-pro-max': { width: 480, height: 1000 },- 'samsung': { width: PHONE_W, height: PHONE_H },- 'laptop': { width: 1500, height: 1035 },+ 'phone': { width: PHONE_W, height: PHONE_H },+ 'iphone': { width: PHONE_W, height: PHONE_H },+ 'iphone-13-pro-max': { width: 480, height: 1000 },+ 'double_iphone_13_pro': { width: 960, height: 2000 },+ 'samsung': { width: PHONE_W, height: PHONE_H },+ 'laptop': { width: 1500, height: 1035 },};// Camera settings (based on appscreen-main reference: fov=20, position=[-3,-1,4])export const CAM_FOV = 20;export const CAM_Z = 6;-export type DeviceKey = "iphone" | "samsung" | "phone";+export type DeviceKey = "iphone" | "samsung" | "phone" | "double_iphone_13_pro";export interface DeviceConfig {modelUrl: string | null;@@ -38,6 +39,13 @@ export const deviceConfigs: Record<DeviceKey, DeviceConfig> = {screenOffset: { x: 0.027, y: 0.745, z: 0.098 },cornerRadiusFactor: 0.16,},+ double_iphone_13_pro: {+ modelUrl: "/models/double-iphone-13-pro.glb",+ aspectRatio: 1290 / 2796,+ screenHeightFactor: 0.826,+ screenOffset: { x: 0.027, y: 0.745, z: 0.098 },+ cornerRadiusFactor: 0.16,+ },samsung: {modelUrl: "/models/samsung-galaxy-s25-ultra.glb",aspectRatio: 1440 / 3120,@@ -81,13 +89,13 @@ export function createCoverScreenCanvas(): HTMLCanvasElement {let srcW: number, srcH: number;if (source instanceof HTMLImageElement) {- srcW = source.naturalWidth || source.width || 1;+ srcW = source.naturalWidth || source.width || 1;srcH = source.naturalHeight || source.height || 1;} else if (source instanceof HTMLVideoElement) {- srcW = source.videoWidth || 1;+ srcW = source.videoWidth || 1;srcH = source.videoHeight || 1;} else {- srcW = source.width || 1;+ srcW = source.width || 1;srcH = source.height || 1;}@@ -98,7 +106,7 @@ export function createCoverScreenCanvas(const offsetY = (targetH - drawH) / 2;const canvas = document.createElement("canvas");- canvas.width = targetW;+ canvas.width = targetW;canvas.height = targetH;const ctx = canvas.getContext("2d")!;ctx.imageSmoothingEnabled = true;@@ -137,10 +145,10 @@ export function createCoverScreenCanvas(ctx.fillRect(0, 0, targetW, targetH);ctx.globalCompositeOperation = "source-over";};- if (maskConfig.top) drawGradient(180, maskConfig.top.from, maskConfig.top.to ?? 100);- if (maskConfig.bottom) drawGradient(0, maskConfig.bottom.from, maskConfig.bottom.to ?? 100);- if (maskConfig.left) drawGradient(90, maskConfig.left.from, maskConfig.left.to ?? 100);- if (maskConfig.right) drawGradient(270, maskConfig.right.from, maskConfig.right.to ?? 100);+ if (maskConfig.top) drawGradient(180, maskConfig.top.from, maskConfig.top.to ?? 100);+ if (maskConfig.bottom) drawGradient(0, maskConfig.bottom.from, maskConfig.bottom.to ?? 100);+ if (maskConfig.left) drawGradient(90, maskConfig.left.from, maskConfig.left.to ?? 100);+ if (maskConfig.right) drawGradient(270, maskConfig.right.from, maskConfig.right.to ?? 100);if (maskConfig.angle !== undefined) {drawGradient(maskConfig.angle, maskConfig.angleFrom ?? 0, maskConfig.angleTo ?? 100);}@@ -219,19 +227,19 @@ export function applyCropToImage(): HTMLCanvasElement {let srcW: number, srcH: number;if (source instanceof HTMLImageElement) {- srcW = source.naturalWidth || source.width || 1;+ srcW = source.naturalWidth || source.width || 1;srcH = source.naturalHeight || source.height || 1;} else if (source instanceof HTMLVideoElement) {- srcW = source.videoWidth || 1;+ srcW = source.videoWidth || 1;srcH = source.videoHeight || 1;} else {- srcW = source.width || 1;+ srcW = source.width || 1;srcH = source.height || 1;}const isFullCrop = !cropArea|| (cropArea.x <= 0 && cropArea.y <= 0- && cropArea.width >= 100 && cropArea.height >= 100);+ && cropArea.width >= 100 && cropArea.height >= 100);if (isFullCrop) {const out = document.createElement("canvas");out.width = srcW;diff --git a/public/images/mockups-3d/double-iphone-13pro.avif b/public/images/mockups-3d/double-iphone-13pro.avifnew file mode 100644index 0000000..dfcaedeBinary files /dev/null and b/public/images/mockups-3d/double-iphone-13pro.avif differdiff --git a/public/models/double_iphone_13_pro.glb b/public/models/double_iphone_13_pro.glbnew file mode 100644index 0000000..b1332abBinary files /dev/null and b/public/models/double_iphone_13_pro.glb differdiff --git a/public/videos/mockups-3d/double-iphone-13pro.mp4 b/public/videos/mockups-3d/double-iphone-13pro.mp4new file mode 100644index 0000000..c2d9581Binary files /dev/null and b/public/videos/mockups-3d/double-iphone-13pro.mp4 differdiff --git a/types/editor-state.types.ts b/types/editor-state.types.tsindex 5a58628..2449952 100644--- a/types/editor-state.types.ts+++ b/types/editor-state.types.ts@@ -45,7 +45,7 @@ export interface EditorState {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';imagePhonePresetId: string;imagePhoneOpening: number;imagePhoneShadow: number;diff --git a/types/image-project.types.ts b/types/image-project.types.tsindex e13a863..48dfb76 100644--- a/types/image-project.types.ts+++ b/types/image-project.types.ts@@ -50,7 +50,7 @@ export interface ImageProject {imagePhoneRotY: number;imagePhoneRotZ: number;imagePhonePerspective: number;- imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'samsung' | 'laptop';+ imagePhoneDevice: 'phone' | 'iphone' | 'iphone-13-pro-max' | 'double_iphone_13_pro' | 'samsung' | 'laptop';imagePhoneOpening: number;imagePhoneShadow: number;imagePhoneShadowColor: string;diff --git a/types/mockup.types.ts b/types/mockup.types.tsindex ebca609..0889c11 100644--- a/types/mockup.types.ts+++ b/types/mockup.types.ts@@ -88,49 +88,58 @@ export const HANDLE_R = 9;export type MenuPage = "home" | "detail-2d" | "detail-3d";export const IMAGE_DEVICE_TEMPLATES = [- {- id: "iphone-13-pro-max",- title: "iPhone 13 Pro",- accentColor: "#7C7C85",- icon: "simple-icons:apple",- modelUrl: "/models/apple_iphone_13_pro_max.glb",- posterUrl: encodeURI("/images/mockups-3d/iphone-13pro.avif"),- videoUrl: encodeURI("/videos/mockups-3d/iphone-13pro.mp4"),- },- {- id: "iphone",- title: "iPhone 15 Pro",- accentColor: "#A8A8B0",- icon: "simple-icons:apple",- modelUrl: "/models/iphone-15-pro-max.glb",- posterUrl: encodeURI("/images/mockups-3d/iphone-15pro.avif"),- videoUrl: encodeURI("/videos/mockups-3d/iphone-15pro.mp4"),- },- {- id: "samsung",- title: "Samsung S25",- accentColor: "#1428A0",- icon: "simple-icons:samsung",- modelUrl: "/models/samsung-galaxy-s25-ultra.glb",- posterUrl: encodeURI("/images/mockups-3d/sansung-s25.avif"),- videoUrl: encodeURI("/videos/mockups-3d/sansung-s25.mp4"),- },- {- id: "phone",- title: "Phone",- accentColor: "#00A3FF",- icon: "lineicons:phone",- modelUrl: "/models/phone-gltf.glb",- posterUrl: encodeURI("/images/mockups-3d/phone.avif"),- videoUrl: encodeURI("/videos/mockups-3d/phone.mp4"),- },- {- id: "laptop",- title: "macOS Laptop",- accentColor: "#CECFD3",- icon: "ph:laptop-bold",- modelUrl: "/models/mac-book.glb",- posterUrl: encodeURI("/images/mockups-3d/macos-laptop.avif"),- videoUrl: encodeURI("/videos/mockups-3d/macos-laptop.mp4"),- },+ {+ id: "iphone-13-pro-max",+ title: "iPhone 13 Pro",+ accentColor: "#B9D5FD",+ icon: "simple-icons:apple",+ modelUrl: "/models/apple_iphone_13_pro_max.glb",+ posterUrl: encodeURI("/images/mockups-3d/iphone-13pro.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/iphone-13pro.mp4"),+ },+ {+ id: "double_iphone_13_pro",+ title: "Double iPhone 13 Pro",+ accentColor: "#F6B397",+ icon: "simple-icons:apple",+ modelUrl: "/models/double_iphone_13_pro.glb",+ posterUrl: encodeURI("/images/mockups-3d/double-iphone-13pro.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/double-iphone-13pro.mp4"),+ },+ {+ id: "iphone",+ title: "iPhone 15 Pro",+ accentColor: "#A8A8B0",+ icon: "simple-icons:apple",+ modelUrl: "/models/iphone-15-pro-max.glb",+ posterUrl: encodeURI("/images/mockups-3d/iphone-15pro.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/iphone-15pro.mp4"),+ },+ {+ id: "samsung",+ title: "Samsung S25",+ accentColor: "#1428A0",+ icon: "simple-icons:samsung",+ modelUrl: "/models/samsung-galaxy-s25-ultra.glb",+ posterUrl: encodeURI("/images/mockups-3d/sansung-s25.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/sansung-s25.mp4"),+ },+ {+ id: "phone",+ title: "Phone",+ accentColor: "#00A3FF",+ icon: "lineicons:phone",+ modelUrl: "/models/phone-gltf.glb",+ posterUrl: encodeURI("/images/mockups-3d/phone.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/phone.mp4"),+ },+ {+ id: "laptop",+ title: "macOS Laptop",+ accentColor: "#CECFD3",+ icon: "ph:laptop-bold",+ modelUrl: "/models/mac-book.glb",+ posterUrl: encodeURI("/images/mockups-3d/macos-laptop.avif"),+ videoUrl: encodeURI("/videos/mockups-3d/macos-laptop.mp4"),+ },] as const;\ No newline at end of file