Skip to content

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

fix: moving components and puling mockup 3d on video

CristianOlivera14e51ff3a0090
diff --git a/app/components/ui/RecordingSetupDialog.tsx b/app/components/ui/RecordingSetupDialog.tsx
index b5d3280..0c57473 100644
--- a/app/components/ui/RecordingSetupDialog.tsx
+++ b/app/components/ui/RecordingSetupDialog.tsx
@@ -27,7 +27,7 @@ import {
type CameraShape,
type RecordingSetupConfig,
} from "@/types/camera.types";
-import { SliderControl } from "./SliderControl";
+import { SliderControl } from "../../../components/ui/SliderControl";
import { Toggle } from "@/components/ui/toggle";
import { BrowserPermissionUI } from "@/components/ui/BrowserPermissionUI";
import {
diff --git a/app/components/ui/editor/CameraMenu.tsx b/app/components/ui/editor/CameraMenu.tsx
index 5583247..019c70a 100644
--- a/app/components/ui/editor/CameraMenu.tsx
+++ b/app/components/ui/editor/CameraMenu.tsx
@@ -9,7 +9,7 @@ import {
type CameraCorner,
type CameraShape,
} from "@/types/camera.types";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { Toggle } from "@/components/ui/toggle";
interface Props {
diff --git a/app/components/ui/editor/ControlPanel.tsx b/app/components/ui/editor/ControlPanel.tsx
index 05711e6..d2892ea 100644
--- a/app/components/ui/editor/ControlPanel.tsx
+++ b/app/components/ui/editor/ControlPanel.tsx
@@ -2,8 +2,8 @@
import { Icon } from "@iconify/react";
import { motion } from "framer-motion";
-import { SliderControl } from "../SliderControl";
-import { TabButton } from "../TabButton";
+import { SliderControl } from "../../../../components/ui/SliderControl";
+import { TabButton } from "../../../../components/ui/TabButton";
import type { ControlPanelProps } from "@/types/control-panel.types";
import Link from "next/link";
import Image from "next/image";
diff --git a/app/components/ui/editor/CursorMenu.tsx b/app/components/ui/editor/CursorMenu.tsx
index 3fd8672..1aaa398 100644
--- a/app/components/ui/editor/CursorMenu.tsx
+++ b/app/components/ui/editor/CursorMenu.tsx
@@ -1,7 +1,7 @@
"use client";
import { Icon } from "@iconify/react";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { TooltipAction } from "@/components/ui/tooltip-action";
import type { CursorConfig, CursorStyle, ClickEffect, CursorRecordingData } from "@/types/cursor.types";
import { DEFAULT_CURSOR_CONFIG } from "@/types/cursor.types";
diff --git a/app/components/ui/editor/ElementsMenu.tsx b/app/components/ui/editor/ElementsMenu.tsx
index 838e8b4..2f0714f 100644
--- a/app/components/ui/editor/ElementsMenu.tsx
+++ b/app/components/ui/editor/ElementsMenu.tsx
@@ -3,7 +3,7 @@
import { Icon } from "@iconify/react";
import { useState, useEffect, useRef, startTransition, useCallback } from "react";
import { useTranslations } from "next-intl";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { SVG_CATEGORIES, IMAGE_CATEGORIES, PINNED_SVG_ITEMS, PINNED_IMAGE_ITEMS, getImagePreviewPath } from "@/lib/canvas-elements.config";
import { SvgElement, TextElement, ImageElement, ElementsMenuProps, PRESET_COLORS, TEXT_PRESETS, FONT_FAMILIES, FONT_WEIGHTS, UploadedImage, STORAGE_KEY, ACCEPTED_FORMATS, MAX_FILE_SIZE } from "@/types/canvas-elements.types";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
diff --git a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
index 6cece6f..7377b6d 100644
--- a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
+++ b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
@@ -267,7 +267,15 @@ 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 });
+
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 id = setTimeout(() => {
const orbit = orbitRef.current;
if (!orbit) return;
@@ -277,6 +285,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);
}, [initialRotationX, initialRotationY, zoom]);
@@ -291,12 +300,12 @@ function ModelScene({
return (
<>
<PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={[0, 0, 1.5 / zoom]} />
-
- <Environment
- preset={environment as EnvironmentPreset}
- environmentIntensity={glow}
+
+ <Environment
+ preset={environment as EnvironmentPreset}
+ environmentIntensity={glow}
/>
-
+
<OrbitControls
ref={orbitRef}
enableZoom={false}
@@ -313,12 +322,12 @@ function ModelScene({
onRotationChange(rx, ry);
}}
/>
-
+
<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, Math.PI, 0]} scale={0.01} dispose={null}>
<group scale={100}>
<mesh castShadow receiveShadow geometry={nodes.Frame_Frame_0.geometry} material={materials.Frame} />
diff --git a/app/components/ui/editor/ImageMaskEditor.tsx b/app/components/ui/editor/ImageMaskEditor.tsx
index 29d0d72..1b6c174 100644
--- a/app/components/ui/editor/ImageMaskEditor.tsx
+++ b/app/components/ui/editor/ImageMaskEditor.tsx
@@ -3,7 +3,7 @@
import { Icon } from "@iconify/react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import {
Popover,
PopoverTrigger,
diff --git a/app/components/ui/editor/Laptop3DViewer.tsx b/app/components/ui/editor/Laptop3DViewer.tsx
index 2c03218..98628d3 100644
--- a/app/components/ui/editor/Laptop3DViewer.tsx
+++ b/app/components/ui/editor/Laptop3DViewer.tsx
@@ -203,6 +203,21 @@ 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;
+ if (mat && tex) {
+ if (mat.map && mat.map !== tex) {
+ mat.map.dispose();
+ }
+ mat.map = tex;
+ mat.color.set(0xffffff);
+ mat.needsUpdate = true;
+ }
+ }, []);
+
useEffect(() => {
if (!videoElement) {
if (videoTextureRef.current) {
@@ -224,15 +239,7 @@ function ModelScene({
}
videoTextureRef.current = tex;
- const mat = screenMatRef.current;
- if (mat) {
- if (mat.map && mat.map !== tex) {
- mat.map.dispose();
- }
- mat.map = tex;
- mat.color.set(0xffffff);
- mat.needsUpdate = true;
- }
+ applyVideoTextureIfReady();
return () => {
if (videoTextureRef.current === tex) {
@@ -240,7 +247,7 @@ function ModelScene({
}
tex.dispose();
};
- }, [videoElement]);
+ }, [videoElement, applyVideoTextureIfReady]);
const applyTextureRef = useRef(applyTexture);
useEffect(() => {
@@ -270,6 +277,7 @@ function ModelScene({
toneMapped: false
});
screenMatRef.current = screenMaterial;
+ applyVideoTextureIfReady();
const textLoader = new THREE.TextureLoader();
const keyboardMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff, transparent: true, toneMapped: false });
@@ -347,7 +355,14 @@ 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;
@@ -356,6 +371,7 @@ function ModelScene({
const theta = initialRotationY * DEG;
orbit.object.position.setFromSphericalCoords(radius, phi, theta);
orbit.update();
+ prevRotationRef.current = { x: initialRotationX, y: initialRotationY };
}, [initialRotationX, initialRotationY, zoom]);
useEffect(() => {
diff --git a/app/components/ui/editor/Mockup2dMenu.tsx b/app/components/ui/editor/Mockup2dMenu.tsx
index 82cf2cb..4749217 100644
--- a/app/components/ui/editor/Mockup2dMenu.tsx
+++ b/app/components/ui/editor/Mockup2dMenu.tsx
@@ -2,7 +2,7 @@
import { useTranslations } from "next-intl";
import { Icon } from "@iconify/react";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { FRAME_COLORS, FRAME_COLORS_DARK, MockupConfig, MockupFeatures, getMockupFeatures } from "@/types/mockup.types";
import { MOCKUPS, MOCKUP_CATEGORIES } from "@/lib/mockup-data";
import { Button } from "@/components/ui/button";
diff --git a/app/components/ui/editor/Mockup3dMenu.tsx b/app/components/ui/editor/Mockup3dMenu.tsx
index 2fc12c4..ad27f4d 100644
--- a/app/components/ui/editor/Mockup3dMenu.tsx
+++ b/app/components/ui/editor/Mockup3dMenu.tsx
@@ -3,7 +3,7 @@
import { useRef, useState } from "react";
import { useTranslations } from "next-intl";
import { Icon } from "@iconify/react";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { HANDLE_R, ImageDeviceId, PAD_H, X_HALF, Y_HALF } from "@/types/mockup.types";
import { Button } from "@/components/ui/button";
import { DetailPageHeader } from "@/components/ui/DetailHeaderMenu";
diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsx
index 93e547a..ea10e50 100644
--- a/app/components/ui/editor/MockupMenu.tsx
+++ b/app/components/ui/editor/MockupMenu.tsx
@@ -485,8 +485,14 @@ export function MockupMenu({
{mockup.name}
</div>
{isActive && (
- <div className="absolute top-1.5 right-1.5 rounded-full shadow-[0_0_8px_rgba(96,165,250,0.7)] z-30">
- <Icon icon="icon-park-solid:check-one" width="14" className="text-blue-500" />
+ <div className="absolute top-1.5 right-1.5 rounded-full shadow-[0_0_8px_rgba(96,165,250,0.7)] z-30 flex items-center justify-center size-4">
+ <div className="absolute size-2 bg-white rounded-full z-0" />
+ <Icon
+ icon="icon-park-solid:check-one"
+ width="24"
+ height="24"
+ className="text-blue-500 relative z-10"
+ />
</div>
)}
</button>
diff --git a/app/components/ui/editor/Phone3DViewer.tsx b/app/components/ui/editor/Phone3DViewer.tsx
index c421303..b8f694a 100644
--- a/app/components/ui/editor/Phone3DViewer.tsx
+++ b/app/components/ui/editor/Phone3DViewer.tsx
@@ -96,7 +96,7 @@ function ModelScene({
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);
@@ -105,6 +105,7 @@ function ModelScene({
const lastLoadedCropKeyRef = useRef<string | null>(null);
const screenAspectRef = useRef<number>(0.459);
const flipYRef = useRef<boolean>(false);
+ const prevRotationRef = useRef({ x: initialRotationX, y: initialRotationY });
const { autoRotate, rotationSpeed, glow, environment } = ViewerControls3D();
@@ -214,6 +215,26 @@ function ModelScene({
img.src = imageUrl;
}, [imageUrl, imageMaskConfig, cropArea, modelUrl, 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();
+ }
+
+ const device = getDeviceFromModelUrl(modelUrl);
+ const isDefaultPhone = device === "phone";
+
+ tex.flipY = !isDefaultPhone;
+ tex.needsUpdate = true;
+
+ mat.map = tex;
+ mat.color.set(0xffffff);
+ mat.needsUpdate = true;
+ }
+ }, [modelUrl]);
+
useEffect(() => {
if (!videoElement) {
if (videoTextureRef.current) {
@@ -222,28 +243,29 @@ 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);
- tex.flipY = flipYRef.current;
+
+ // 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;
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;
-
- const mat = screenMatRef.current;
- if (mat) {
- if (mat.map && mat.map !== tex) {
- mat.map.dispose();
- }
- mat.map = tex;
- mat.color.set(0xffffff);
- mat.needsUpdate = true;
- }
+ applyVideoTextureIfReady();
return () => {
if (videoTextureRef.current === tex) {
@@ -251,7 +273,7 @@ function ModelScene({
}
tex.dispose();
};
- }, [videoElement]);
+ }, [videoElement, modelUrl, applyVideoTextureIfReady]);
const applyTextureRef = useRef(applyTexture);
useEffect(() => {
@@ -306,6 +328,7 @@ function ModelScene({
child.material = basicMat;
child.renderOrder = 10;
screenMatRef.current = basicMat;
+ applyVideoTextureIfReady();
} else if (mat.isMeshStandardMaterial) {
applyMetalMaterial(mat, matName);
}
@@ -327,6 +350,7 @@ function ModelScene({
const deviceConfig = deviceConfigs[device];
const planeH = 4.3 * deviceConfig.screenHeightFactor;
const planeW = planeH * deviceConfig.aspectRatio;
+ const cornerRadius = planeH * (deviceConfig.cornerRadiusFactor ?? 0);
const basicMat = new THREE.MeshBasicMaterial({
color: 0x111111,
side: THREE.FrontSide,
@@ -335,7 +359,33 @@ function ModelScene({
depthWrite: false,
});
screenMatRef.current = basicMat;
- const plane = new THREE.Mesh(new THREE.PlaneGeometry(planeW, planeH), basicMat);
+ applyVideoTextureIfReady();
+ const hw = planeW / 2;
+ const hh = planeH / 2;
+
+ const baseRadius = Math.min(cornerRadius, Math.min(hw, hh));
+
+ const REDUCTION_FACTOR = 0.40;
+ const r = baseRadius * REDUCTION_FACTOR;
+
+ const shape = new THREE.Shape();
+ shape.moveTo(-hw + r, -hh);
+ shape.lineTo(hw - r, -hh);
+ shape.quadraticCurveTo(hw, -hh, hw, -hh + r);
+ shape.lineTo(hw, hh - r);
+ shape.quadraticCurveTo(hw, hh, hw - r, hh);
+ shape.lineTo(-hw + r, hh);
+ shape.quadraticCurveTo(-hw, hh, -hw, hh - r);
+ shape.lineTo(-hw, -hh + r);
+ shape.quadraticCurveTo(-hw, -hh, -hw + r, -hh);
+ const plane = new THREE.Mesh(new THREE.ShapeGeometry(shape), basicMat);
+ const uvAttr = plane.geometry.getAttribute("uv") as THREE.BufferAttribute;
+ for (let i = 0; i < uvAttr.count; i++) {
+ const x = plane.geometry.getAttribute("position").getX(i);
+ const y = plane.geometry.getAttribute("position").getY(i);
+ uvAttr.setXY(i, (x + hw) / planeW, (y + hh) / planeH);
+ }
+ uvAttr.needsUpdate = true;
plane.position.set(deviceConfig.screenOffset.x, deviceConfig.screenOffset.y, deviceConfig.screenOffset.z);
plane.renderOrder = 10;
group.add(plane);
@@ -348,6 +398,13 @@ function ModelScene({
}, [modelUrl]);
useEffect(() => {
+ // Skip if values haven't changed (e.g. OrbitControls echoed back the
+ // same angles via onRotationChange → context → props round-trip).
+ if (
+ prevRotationRef.current.x === initialRotationX &&
+ prevRotationRef.current.y === initialRotationY
+ ) return;
+ prevRotationRef.current = { x: initialRotationX, y: initialRotationY };
const orbit = orbitRef.current;
if (!orbit) return;
const radius = 1.5 / zoom;
@@ -364,7 +421,7 @@ function ModelScene({
return (
<>
<PerspectiveCamera ref={cameraRef} makeDefault fov={40} near={0.01} far={100} position={[0, 0, 1.5 / zoom]} />
-
+
<OrbitControls
ref={orbitRef}
enableZoom={false}
@@ -382,10 +439,10 @@ function ModelScene({
}}
/>
- <Environment
- preset={environment as EnvironmentPreset}
- environmentIntensity={glow}
- background={false}
+ <Environment
+ preset={environment as EnvironmentPreset}
+ environmentIntensity={glow}
+ background={false}
/>
<ambientLight intensity={0.3} />
@@ -462,54 +519,63 @@ export function Phone3DViewer(props: Props) {
<>
<ControlsPopup />
+ {/*
+ * IMPORTANT: this wrapper must NOT add any layout footprint to the
+ * parent container. The parent overlay in VideoCanvas uses
+ * `translate(-50%, -50%)` which is relative to the element's own
+ * bounding box. By making this wrapper `position:absolute` with its
+ * own `translate(-50%,-50%)` we give the parent a zero-size anchor
+ * point and eliminate the jump caused by large margins / shadow
+ * height that used to inflate the parent box.
+ */}
<div
style={{
- display: "inline-block",
- transformOrigin: "top center",
+ position: "absolute",
+ top: 0,
+ left: 0,
+ transform: "translate(-50%, -50%)",
+ transformOrigin: "center center",
width: PHONE_W,
- height: PHONE_H + (hasShadow ? computedBlur * 0.8 : 0),
- marginTop: "220px",
- marginLeft: "140px",
+ height: PHONE_H,
+ pointerEvents: "none",
}}
>
- <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",
- }}
- />
- )}
-
+ {hasShadow && (
<div
+ aria-hidden
style={{
position: "absolute",
- inset: "-200px",
- 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",
+ 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",
}}
- onPointerDown={() => setGrabbing(true)}
- onPointerUp={() => setGrabbing(false)}
- onPointerLeave={() => setGrabbing(false)}
- >
- <CanvasWithLoader {...props} rootRef={rootRef} cameraRef={cameraRef} />
- </div>
+ />
+ )}
+
+ <div
+ style={{
+ position: "absolute",
+ inset: "-200px",
+ 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>
</>
diff --git a/app/components/ui/editor/PhotoEditorPlaceholder.tsx b/app/components/ui/editor/PhotoEditorPlaceholder.tsx
index 4498fe5..395f6f6 100644
--- a/app/components/ui/editor/PhotoEditorPlaceholder.tsx
+++ b/app/components/ui/editor/PhotoEditorPlaceholder.tsx
@@ -3,7 +3,7 @@
import { Icon } from "@iconify/react";
import { useTranslations } from "next-intl";
import { useState, useCallback } from "react";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import { Button } from "@/components/ui/button";
import { AspectRatioSelect } from "@/app/components/ui/AspectRatioSelect";
import { TooltipAction } from "@/components/ui/tooltip-action";
diff --git a/app/components/ui/editor/ToolsSidebar.tsx b/app/components/ui/editor/ToolsSidebar.tsx
index c2fdf7b..8637046 100644
--- a/app/components/ui/editor/ToolsSidebar.tsx
+++ b/app/components/ui/editor/ToolsSidebar.tsx
@@ -1,7 +1,7 @@
"use client";
import { Icon } from "@iconify/react";
-import { SidebarTool } from "../SidebarTool";
+import { SidebarTool } from "../../../../components/ui/SidebarTool";
import type { ToolsSidebarProps } from "@/types/tool-sidebar.types";
import type { EditorMode } from "@/types/editor-mode.types";
import { useRef, useState, useEffect, useCallback } from "react";
diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsx
index 234dd7e..d447d05 100644
--- a/app/components/ui/editor/VideoCanvas.tsx
+++ b/app/components/ui/editor/VideoCanvas.tsx
@@ -122,9 +122,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct
const ctrlScrollWheelRef = useRef<((e: WheelEvent) => void) | null>(null);
// WebGL canvas from image phone Phone3DViewer, captured via onMount prop for export
const imagePhoneCanvasRef = useRef<HTMLCanvasElement | null>(null);
- // Phone3DViewer API (e.g. renderAt) so we can re-render the WebGL canvas
- // at the export resolution right before capturing (fixes the pixelation
- // caused by upscaling a 595×765 canvas to 4K).
const imagePhoneApiRef = useRef<{ renderAt: (w: number, h: number) => void } | null>(null);
const [activePhoneDevice, setActivePhoneDevice] = useState<string | null>(null);
const [phoneTransitioning, setPhoneTransitioning] = useState(false);
@@ -293,12 +290,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct
const previewContainerRef = useRef<HTMLDivElement>(null);
const canvasWrapperRef = useRef<HTMLDivElement>(null);
- // ── Non-passive Ctrl+scroll zoom for image phone overlay ──────────────
- // React registers onWheel listeners as passive (React 17+), so calling
- // e.preventDefault() inside onWheel silently fails and the browser logs:
- // "Unable to preventDefault inside passive event listener invocation."
- // Fix: update a ref each render (captures fresh state, no re-render cost)
- // and attach a stable non-passive listener once via useEffect.
ctrlScrollWheelRef.current = (e: WheelEvent) => {
if (!e.ctrlKey || !imagePhoneActive) return;
e.preventDefault();
diff --git a/app/components/ui/editor/ZoomFragmentEditor.tsx b/app/components/ui/editor/ZoomFragmentEditor.tsx
index 6b8be32..2cc33d8 100644
--- a/app/components/ui/editor/ZoomFragmentEditor.tsx
+++ b/app/components/ui/editor/ZoomFragmentEditor.tsx
@@ -3,7 +3,7 @@
import { useRef, useMemo, useState } from "react";
import { Icon } from "@iconify/react";
import { useTranslations } from "next-intl";
-import { SliderControl } from "../SliderControl";
+import { SliderControl } from "../../../../components/ui/SliderControl";
import type { ZoomFragmentEditorProps } from "@/types/zoom.types";
import { formatZoomTime, zoomLevelToFactor, speedToTransitionMs, calculateHoldDuration } from "@/types/zoom.types";
import { TooltipAction } from "@/components/ui/tooltip-action";
diff --git a/app/components/ui/SidebarTool.tsx b/components/ui/SidebarTool.tsx
similarity index 100%
rename from app/components/ui/SidebarTool.tsx
rename to components/ui/SidebarTool.tsx
diff --git a/app/components/ui/SliderControl.tsx b/components/ui/SliderControl.tsx
similarity index 100%
rename from app/components/ui/SliderControl.tsx
rename to components/ui/SliderControl.tsx
diff --git a/app/components/ui/TabButton.tsx b/components/ui/TabButton.tsx
similarity index 100%
rename from app/components/ui/TabButton.tsx
rename to components/ui/TabButton.tsx
diff --git a/components/ui/TrackVolumeSlider.tsx b/components/ui/TrackVolumeSlider.tsx
index e3e655f..7362a79 100644
--- a/components/ui/TrackVolumeSlider.tsx
+++ b/components/ui/TrackVolumeSlider.tsx
@@ -1,4 +1,4 @@
-import { SliderControl } from "@/app/components/ui/SliderControl";
+import { SliderControl } from "@/components/ui/SliderControl";
import { AudioTrack } from "@/types/audio.types";
import { useState, useEffect } from "react";