Create professional demos and 3D mockups in seconds, directly in your browser
feat: enhance SidebarTool interactions and update popover content
CristianOlivera1d3845ccc50f3
diff --git a/app/components/ui/SidebarTool.tsx b/app/components/ui/SidebarTool.tsxindex ba17efd..61c27c0 100644--- a/app/components/ui/SidebarTool.tsx+++ b/app/components/ui/SidebarTool.tsx@@ -33,9 +33,13 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(const handleMouseEnter = () => {if (disabled) return;clearTimeout(timeoutRef.current);- setIsOpen(true);+ timeoutRef.current = setTimeout(() => {+ setIsOpen(true);+ }, 800);};+const handleMouseLeave = () => {+ clearTimeout(timeoutRef.current);timeoutRef.current = setTimeout(() => {setIsOpen(false);}, 150);@@ -46,9 +50,8 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(ref={ref}onClick={disabled ? undefined : onClick}disabled={disabled}- className={`relative flex flex-col items-center gap-1.5 transition-all duration-200 w-full- ${disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer"}- ${isActive ? "text-white" : "text-white/60 hover:text-white"}`}+ className={`relative flex flex-col items-center gap-1.5 transition-all duration-200 w-full ${disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer"+ } ${isActive ? "text-white" : "text-white/60 hover:text-white"}`}>{badgeCount !== undefined && badgeCount > 0 && (<div className="absolute -top-1 right-1 z-10 min-w-4 h-4 px-1 flex items-center justify-center bg-emerald-500 rounded-full border border-emerald-400 shadow-lg pointer-events-none animate-in zoom-in-50 duration-200">@@ -57,7 +60,6 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(</span></div>)}-{badge && (<div className="absolute -top-1 -right-0.5 z-10 px-1.5 py-0.5 bg-linear-to-r from-gray-500 to-gray-500 rounded-full border border-white/20 shadow-lg pointer-events-none"><span className="text-[8px] font-bold text-white tracking-widest uppercase block drop-shadow-sm leading-none">@@ -65,37 +67,42 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(</span></div>)}-{isActive && !disabled && (<div className="absolute inset-x-0 top-0 h-px bg-linear-to-r from-transparent via-white/20 to-transparent mx-2" />)}-<span- className={`flex items-center justify-center p-3 squircle-element transition-all duration-200 relative- ${!disabled && isActive ? "" : "hover:bg-white/5"}- `}- style={isActive && !disabled ? {- background: 'radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)',- boxShadow: 'inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333',- } : {}}+ className={`flex items-center justify-center p-3 squircle-element transition-all duration-200 relative ${!disabled && isActive ? "" : "hover:bg-white/5"+ } `}+ style={+ isActive && !disabled+ ? {+ background:+ "radial-gradient(circle at 50% 0%, #555555 0%, #454545 64%)",+ boxShadow:+ "inset 0 1.01rem 0.2rem -1rem #fff, 0 0 0 1px #fff4, 0 4px 4px 0 #0004, 0 0 0 1px #333",+ }+ : {}+ }>- <div className={`transition-transform duration-300 ${isActive && !disabled ? "scale-110" : !disabled ? "hover:scale-105" : ""}`}>+ <div+ className={`transition-transform duration-300 ${isActive && !disabled ? "scale-110" : !disabled ? "hover:scale-105" : ""+ }`}+ >{typeof icon === "string" ? (<Icon icon={icon} width="20" />) : (- <div className="w-5 h-5 flex items-center justify-center">- {icon}- </div>+ <div className="w-5 h-5 flex items-center justify-center">{icon}</div>)}</div>-{isActive && !disabled && (<div className="absolute left-1 w-8 h-2 top-1/5 -translate-y-1/2 size-3 bg-white rounded-full blur-[5px] rotate-45 opacity-50" />)}</span>-{label && (- <label className={`text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-full ${disabled ? "cursor-not-allowed" : "cursor-pointer"}`}>+ <label+ className={`text-xs font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-full ${disabled ? "cursor-not-allowed" : "cursor-pointer"+ }`}+ >{label}</label>)}@@ -112,30 +119,22 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(<divonMouseEnter={handleMouseEnter}onMouseLeave={handleMouseLeave}+ onClick={(e) => e.preventDefault()}className="w-full flex justify-center">{ToolButton}</div></PopoverTrigger>-<PopoverContentside="right"sideOffset={16}className="w-65 p-0 bg-[#09090B] border border-white/20 rounded-xl shadow-2xl overflow-hidden group/popover"><div className="relative w-full aspect-3/4 flex flex-col justify-end overflow-hidden bg-[#0c0c0e]">-<div className="absolute inset-0 z-0">- <img- src="/images/pages/thumbnail-popover.avif"- className="w-full h-full object-cover blur-3xl opacity-40 scale-110"- alt="thumbnail-popover"- /><div className="absolute inset-0 bg-[radial-gradient(circle_at_30%_30%,rgba(6,182,212,0.4)_0%,transparent_65%)] mix-blend-screen" />-<div className="absolute inset-0 bg-[radial-gradient(circle_at_70%_70%,rgba(147,51,234,0.15)_0%,transparent_60%)]" /></div>-{isOpen && (<videosrc={popover.videoSrc}@@ -144,25 +143,21 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(loopmutedplaysInline- className="absolute inset-0 w-full h-full object-cover mask-b-to-90% mask-b-from-90% z-10"+ className="absolute inset-0 w-full h-full object-cover mask-b-to-20% mask-b-from-80% z-10"/>)}-- <div className="absolute inset-0 z-20 bg-linear-to-t from-[#09090B] via-[#09090B]/60 to-transparent pointer-events-none" />-+ <div className="absolute inset-0 z-20 bg-linear-to-t from-[#09090B] via-[#09090B]/50 to-transparent pointer-events-none" /><div className="relative z-30 p-5">- <h3 className="text-sm font-bold text-white mb-1 drop-shadow-md">+ <h3 className="text-sm font-bold text-white mb-1 drop-shadow-[0px_0px_15px_rgba(183,203,248,1)] drop-shadow-[0px_0px_2px_rgba(0,0,0,0.5)]">{popover.title}</h3>- <p className="text-[11px] text-cyan-50/50 leading-relaxed drop-shadow-md">+ <p className="text-[11px] text-cyan-50/60 leading-relaxed drop-shadow-md">{popover.description}</p></div>-- <div className="absolute top-0 inset-x-0 h-px bg-linear-to-r from-transparent via-cyan-400/50 to-transparent z-40" />+ <div className="absolute top-0 inset-x-0 h-px bg-linear-to-r from-transparent via-cyan-400/80 to-transparent z-40" /></div></PopoverContent>-</Popover>);}diff --git a/app/components/ui/editor/ToolsSidebar.tsx b/app/components/ui/editor/ToolsSidebar.tsxindex 8a86b77..fb47789 100644--- a/app/components/ui/editor/ToolsSidebar.tsx+++ b/app/components/ui/editor/ToolsSidebar.tsx@@ -245,11 +245,11 @@ export function ToolsSidebar({isActive={activeTool === "audio"}onClick={() => onToolChange("audio")}ref={audioToolRef}- // popover={{- // title: "Pistas y Efectos",- // description: "Sincroniza pistas de música de fondo o efectos de sonido (clics, notificaciones) para darle vida a tus videos.",- // videoSrc: "/videos/demo-audio.mp4"- // }}+ popover={{+ title: "Pistas y Efectos",+ description: "Sincroniza pistas de música de fondo o efectos de sonido",+ videoSrc: "/videos/preview-audio.mp4"+ }}/><SidebarToolicon="iconamoon:zoom-in-bold"@@ -257,11 +257,11 @@ export function ToolsSidebar({isActive={activeTool === "zoom"}onClick={() => onToolChange("zoom")}ref={zoomToolRef}- // popover={{- // title: "Zoom Dinámico",- // description: "Crea acercamientos fluidos hacia partes específicas de la pantalla para guiar la atención del espectador.",- // videoSrc: "/videos/demo-zoom.mp4"- // }}+ popover={{+ title: "Zoom Dinámico",+ description: "Crea acercamientos fluidos hacia partes específicas de la pantalla para guiar la atención del espectador.",+ videoSrc: "/videos/preview-zoom.mp4"+ }}/><SidebarToolicon="solar:videocamera-record-bold-duotone"@@ -269,11 +269,11 @@ export function ToolsSidebar({isActive={activeTool === "camera"}onClick={() => onToolChange("camera")}ref={cameraToolRef}- // popover={{- // title: "Cámara en pantalla",- // description: "Superpón la grabación de tu webcam con recortes circulares, marcos elegantes y fondos eliminados por IA.",- // videoSrc: "/videos/demo-camara.mp4"- // }}+ popover={{+ title: "Cámara en pantalla",+ description: "Superpón la grabación de tu webcam con recortes circulares",+ videoSrc: "/videos/preview-camera.mp4"+ }}/><SidebarToolicon="solar:cursor-bold-duotone"diff --git a/app/components/ui/editor/VideoCanvas.tsx b/app/components/ui/editor/VideoCanvas.tsxindex c75bc4c..2ab7607 100644--- a/app/components/ui/editor/VideoCanvas.tsx+++ b/app/components/ui/editor/VideoCanvas.tsx@@ -1,12 +1,10 @@"use client";-import { useRef, useEffect, useImperativeHandle, forwardRef, useMemo, useState, useCallback } from "react";+import { useRef, useEffect, useImperativeHandle, forwardRef, useMemo, useState } from "react";import type { VideoCanvasHandle, VideoCanvasProps, VideoThumbnail } from "@/types";-import type { ImageElement, SvgElement, CanvasElement } from "@/types/canvas-elements.types";+import type { ImageElement, SvgElement } from "@/types/canvas-elements.types";import { getCameraLayout } from "@/types/camera.types";import { ASPECT_RATIO_DIMENSIONS } from "@/types";-// import { interpolateCursorPosition, DEFAULT_CURSOR_CONFIG, EMPTY_CURSOR_DATA } from "@/types/cursor.types";-// import type { CursorKeyframe } from "@/types/cursor.types";import { getWallpaperUrl } from "@/lib/wallpaper.utils";import { drawRoundedRect, drawRoundedRectBottomOnly, calculateScaledPadding, applyCanvasBackground, getAspectRatioStyle, getMaxWidth, Corner, getCornerStyle, getNearestCorner } from "@/lib/canvas.utils";import { drawMockupToCanvas } from "@/lib/mockup-canvas.utils";@@ -16,8 +14,7 @@ import PlaceholderEditor from "../PlaceholderEditor";import { MockupWrapper } from "./mockups/MockupWrapper";import { DEFAULT_MOCKUP_CONFIG } from "@/types/mockup.types";import { calculateSmoothZoom } from "@/lib/canvas.utils";-import { SVG_COMPONENTS, getSvgDataUrl } from "@/components/canvas-svg";-// import { getCursorSvgDataUrl } from "@/components/cursor-svg";+import { getSvgDataUrl } from "@/components/canvas-svg";import { VIDEO_Z_INDEX, BOTTOM_ONLY_RADIUS_MOCKUPS, SELF_SHADOWING_MOCKUPS } from "@/lib/constants";import { RotationHandleIcon } from "@/components/ui/RotationHandleIcon";import { CanvasElementsLayer } from "./CanvasElementsLayer";@@ -56,10 +53,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functselectedElementId = null,onElementUpdate,onElementSelect,- // Cursor props- // cursorConfig = DEFAULT_CURSOR_CONFIG,- // cursorData = EMPTY_CURSOR_DATA,- // Camera overlay propscameraUrl = null,cameraConfig = null,onCameraConfigChange,@@ -80,7 +73,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct}, [zoomFragments, currentTime]);// Calculate zoom transform for visual preview using 3-phase system- // Phase 1: Entry (zoom in), Phase 2: Hold with optional movement, Phase 3: Exit (zoom out)const zoomTransform = useMemo(() => {// No active fragment - smooth exit to base scaleif (!activeZoomFragment) {@@ -108,7 +100,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst translateY = (50 - phaseState.focusY) * (phaseState.scale - 1) * 2;// During hold phase with movement, reduce transition to avoid jarring- // CSS transitions should only apply to scale (entry/exit), not translate during movementconst isMoving = activeZoomFragment.movementEnabled && phaseState.phase === 'hold';const transitionMs = isMoving ? 50 : speedToTransitionMs(activeZoomFragment.speed);@@ -124,34 +115,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct};}, [activeZoomFragment, zoomFragments, currentTime]);- // Calculate current cursor position from cursor data- /*const cursorPosition = useMemo<CursorKeyframe | null>(() => {- if (!cursorConfig.visible || cursorConfig.style === "none" || !cursorData.hasCursorData) {- return null;- }- return interpolateCursorPosition(cursorData.keyframes, currentTime, cursorConfig.smoothing);- }, [cursorConfig.visible, cursorConfig.style, cursorConfig.smoothing, cursorData.hasCursorData, cursorData.keyframes, currentTime]);*/-- // Get cursor SVG data URL for rendering- /*const cursorSvgDataUrl = useMemo(() => {- if (!cursorPosition || cursorConfig.style === "none") return null;- return getCursorSvgDataUrl(cursorConfig.style, cursorPosition.state, cursorConfig.color, cursorConfig.size);- }, [cursorPosition, cursorConfig.style, cursorConfig.color, cursorConfig.size]);*/-- // Preload cursor image for canvas rendering- /* const cursorImageRef = useRef<HTMLImageElement | null>(null);- useEffect(() => {- if (cursorSvgDataUrl) {- const img = new Image();- img.src = cursorSvgDataUrl;- img.onload = () => {- cursorImageRef.current = img;- };- } else {- cursorImageRef.current = null;- }- }, [cursorSvgDataUrl]);*/-// Determinar qué background mostrar basado en el tab activoconst shouldShowUnsplashOverride = backgroundTab === "wallpaper" && unsplashOverrideUrl !== "";const shouldShowWallpaper = backgroundTab === "wallpaper" && selectedWallpaper >= 0 && !shouldShowUnsplashOverride;@@ -165,7 +128,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct// Calcular dimensiones de exportación según aspect ratioconst exportDimensions = useMemo(() => {- // For auto and custom, use the actual video dimensions if availableif ((aspectRatio === "auto" || aspectRatio === "custom") && customAspectRatio) {return { width: customAspectRatio.width, height: customAspectRatio.height };}@@ -180,23 +142,23 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct// Set initial video src when videoUrl changes (initial load only — transitions manage src imperatively)const lastSetVideoUrlRef = useRef<string | null>(null);const preservedVideoStateRef = useRef<{ time: number; playing: boolean } | null>(null);-+// Reset lastSetVideoUrlRef when mockupId changes to force src re-assignment on remountuseEffect(() => {lastSetVideoUrlRef.current = null;}, [mockupId]);-+useEffect(() => {if (videoRef.current && videoUrl) {// Always set src if video element has no src, src is empty, or we just changed mockupconst videoSrc = videoRef.current.src;const needsSrc = !videoSrc || videoSrc === '' || videoSrc === window.location.href;const isNewUrl = videoUrl !== lastSetVideoUrlRef.current;-+if (needsSrc || isNewUrl) {videoRef.current.src = videoUrl;lastSetVideoUrlRef.current = videoUrl;-+// Restore preserved state after src is setif (preservedVideoStateRef.current) {const { time, playing } = preservedVideoStateRef.current;@@ -258,8 +220,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functconst elementImagesRef = useRef<Map<string, HTMLImageElement>>(new Map());// SVG element image cache keyed by "svgId-color" — avoids new Image() per frameconst svgImageCacheRef = useRef<Map<string, HTMLImageElement>>(new Map());- // Cursor image cache keyed by data URL — avoids new Image() + decode per frame- // const cursorImageCacheRef = useRef<Map<string, HTMLImageElement>>(new Map());// Actualizar canvas dimensions cuando cambia el aspect ratiouseEffect(() => {@@ -284,12 +244,11 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct}}, [shouldShowWallpaper, wallpaperUrl]);- // Precargar imagen custom para el canvas (Image tab o Unsplash override en wallpaper tab)const imageUrlToLoad = shouldShowCustomImage ? selectedImageUrl : shouldShowUnsplashOverride ? unsplashOverrideUrl : null;useEffect(() => {if (imageUrlToLoad) {const img = new Image();- img.crossOrigin = "anonymous"; // Prevenir problemas de CORS al exportar+ img.crossOrigin = "anonymous";img.src = imageUrlToLoad;img.onload = () => {customImageRef.current = img;@@ -309,20 +268,18 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct.map(el => el.imagePath));- // Remove images not in use anymorefor (const path of loadedPaths) {if (!currentPaths.has(path)) {cache.delete(path);}}- // Load new images with enhanced error handlingfor (const element of canvasElements) {if (element.type === "image") {const imageElement = element as ImageElement;if (!cache.has(imageElement.imagePath)) {const img = new Image();- img.crossOrigin = "anonymous"; // Prevenir problemas de CORS al exportar+ img.crossOrigin = "anonymous";img.onload = () => {cache.set(imageElement.imagePath, img);@@ -856,94 +813,11 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct// 8. Render elements ABOVE video (zIndex >= VIDEO_Z_INDEX)await renderCanvasElements(ctx, canvasElements, canvasWidth, canvasHeight, false);- // 9. Render cursor overlay if enabled and data available- /* if (cursorConfig.visible && cursorConfig.style !== "none" && cursorData.hasCursorData) {- const frameTime = video.currentTime;- const cursorPos = interpolateCursorPosition(cursorData.keyframes, frameTime, cursorConfig.smoothing);-- if (cursorPos) {- // Get cursor image from cache- const cursorDataUrl = getCursorSvgDataUrl(cursorConfig.style, cursorPos.state, cursorConfig.color, cursorConfig.size);- if (cursorDataUrl) {- let cursorImg = cursorImageCacheRef.current.get(cursorDataUrl);- if (!cursorImg) {- cursorImg = new Image();- cursorImageCacheRef.current.set(cursorDataUrl, cursorImg);- cursorImg.src = cursorDataUrl;- await new Promise<void>((resolve) => {- if (cursorImg!.complete) resolve();- else { cursorImg!.onload = () => resolve(); cursorImg!.onerror = () => resolve(); }- });- } else if (!cursorImg.complete) {- await new Promise<void>((resolve) => {- cursorImg!.onload = () => resolve();- cursorImg!.onerror = () => resolve();- setTimeout(resolve, 500);- });- }-- // Calculate cursor position relative to the video area- // The cursor positions stored are percentages of the video dimensions- const cursorX = videoX + (cursorPos.x / 100) * videoWidth;- const cursorY = videoY + (cursorPos.y / 100) * videoHeight;-- // Scale cursor size based on canvas dimensions- const cursorScale = canvasWidth / 1920; // Reference 1920px- const scaledCursorSize = cursorConfig.size * cursorScale;-- ctx.save();- ctx.globalAlpha = 1;-- // Draw click effect if clicking- if (cursorPos.clicking && cursorConfig.clickEffect !== "none") {- ctx.save();- const effectSize = scaledCursorSize * 2;-- if (cursorConfig.clickEffect === "ripple") {- // Ripple effect - expanding circles- ctx.beginPath();- ctx.arc(cursorX, cursorY, effectSize, 0, Math.PI * 2);- ctx.strokeStyle = cursorConfig.clickEffectColor;- ctx.lineWidth = 3 * cursorScale;- ctx.globalAlpha = 0.5;- ctx.stroke();- } else if (cursorConfig.clickEffect === "ring") {- // Ring effect - solid ring- ctx.beginPath();- ctx.arc(cursorX, cursorY, effectSize * 0.8, 0, Math.PI * 2);- ctx.strokeStyle = cursorConfig.clickEffectColor;- ctx.lineWidth = 4 * cursorScale;- ctx.globalAlpha = 0.7;- ctx.stroke();- }-- ctx.restore();- }-- // Draw cursor image- // Cursor hotspot is typically at top-left for arrow cursors- ctx.drawImage(- cursorImg,- cursorX,- cursorY,- scaledCursorSize,- scaledCursorSize- );-- ctx.restore();- }- }- }*/-ctx.restore();- // 10. Camera overlay — drawn in screen space AFTER zoom transform is unwound,- // so the camera stays fixed in the viewport during any zoom/pan animation.await drawCameraOverlay(ctx, canvasWidth, canvasHeight);};- // Draw the camera bubble in screen-space coordinates.- // Runs after the zoom ctx.restore() so position/size are unaffected by zoom.const drawCameraOverlay = async (ctx: CanvasRenderingContext2D,canvasWidth: number,@@ -951,69 +825,66 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct) => {const camVideo = cameraVideoRef.current;const mainVideo = videoRef.current;+if (!camVideo || !cameraConfig || !cameraConfig.enabled) return;- if (camVideo.readyState < 2 || !camVideo.videoWidth || !camVideo.videoHeight) return;+ if (!camVideo.videoWidth || !camVideo.videoHeight) return;- // Guard against camera video being shorter than main videoif (mainVideo && camVideo.duration > 0 && mainVideo.currentTime > camVideo.duration - 0.1) {- return; // Skip drawing camera if we're beyond its duration+ return;}- // During export, main video seeks frame-by-frame; event-driven sync can leave the- // camera one frame behind. Nudge the camera to the main video's time and await- // the resulting seek so drawImage picks up the correct frame.- if (mainVideo && Math.abs(camVideo.currentTime - mainVideo.currentTime) > 0.05) {+ if (mainVideo && camVideo.paused && Math.abs(camVideo.currentTime - mainVideo.currentTime) > 0.05) {try {- // Clamp camera seek to its actual durationconst targetTime = Math.min(mainVideo.currentTime, camVideo.duration - 0.05);camVideo.currentTime = targetTime;+await new Promise<void>((resolve) => {- const done = () => {- camVideo.removeEventListener("seeked", done);+ const timeoutId = setTimeout(() => {+ camVideo.removeEventListener("seeked", onSeeked);resolve();+ }, 250);++ const onSeeked = () => {+ camVideo.removeEventListener("seeked", onSeeked);++ const checkReady = setInterval(() => {+ if (camVideo.readyState >= 3) {+ clearInterval(checkReady);+ clearTimeout(timeoutId);+ resolve();+ }+ }, 10);};- camVideo.addEventListener("seeked", done);- // Guard against events that never fire (e.g., paused camera at end)- setTimeout(() => {- camVideo.removeEventListener("seeked", done);- resolve();- }, 100);++ camVideo.addEventListener("seeked", onSeeked);});} catch {- // continue with whatever frame is available}}-- // Double-check readyState after async seek- if (camVideo.readyState < 2) return;-const { size, left: drawX, top: drawY } = getCameraLayout(cameraConfig,canvasWidth,canvasHeight);+if (size <= 0) return;+const shortSide = Math.min(canvasWidth, canvasHeight);- // Escala el radio dinámicamente (igual que en preview)- const sizePercent = cameraConfig.size * 100; // 0.18 → 18+ const sizePercent = cameraConfig.size * 100;const sizeMultiplier = 0.5 + (sizePercent - 20) / 40;- // Center-crop the camera frame to a squareconst srcShort = Math.min(camVideo.videoWidth, camVideo.videoHeight);const sx = (camVideo.videoWidth - srcShort) / 2;const sy = (camVideo.videoHeight - srcShort) / 2;ctx.save();- // Drop shadow to match preview stylingctx.shadowColor = "rgba(0, 0, 0, 0.55)";ctx.shadowBlur = shortSide * 0.02;ctx.shadowOffsetY = shortSide * 0.008;- // Create clipping path based on shapeif (cameraConfig.shape === "circle") {- // Perfect circle using arcconst centerX = drawX + size / 2;const centerY = drawY + size / 2;const radius = size / 2;@@ -1030,10 +901,9 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functctx.arc(centerX, centerY, radius, 0, Math.PI * 2);ctx.clip();} else {- // Squircle or square with rounded cornersconst radius =cameraConfig.shape === "squircle"- ? Math.round(20 * sizeMultiplier)+ ? Math.round(75 * sizeMultiplier): Math.round(6 * sizeMultiplier);drawRoundedRect(ctx, drawX, drawY, size, size, radius);@@ -1047,18 +917,20 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functctx.clip();}- if (cameraConfig.mirror) {- ctx.translate(drawX + size, drawY);- ctx.scale(-1, 1);- ctx.drawImage(camVideo, sx, sy, srcShort, srcShort, 0, 0, size, size);- } else {- ctx.drawImage(camVideo, sx, sy, srcShort, srcShort, drawX, drawY, size, size);+ try {+ if (cameraConfig.mirror) {+ ctx.translate(drawX + size, drawY);+ ctx.scale(-1, 1);+ ctx.drawImage(camVideo, sx, sy, srcShort, srcShort, 0, 0, size, size);+ } else {+ ctx.drawImage(camVideo, sx, sy, srcShort, srcShort, drawX, drawY, size, size);+ }+ } catch (e) {}ctx.restore();};- // Exponer métodos para exportaciónuseImperativeHandle(ref, () => ({getExportCanvas: () => exportCanvasRef.current,drawFrame,@@ -1272,10 +1144,11 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct)}</div>) : (- <div className="w-full h-full aspect-video min-w-75 bg-[#1E1E1E] border border-white/10 flex flex-col overflow-hidden"> <PlaceholderEditor- onVideoUpload={onVideoUpload}- isUploading={isUploading}- />+ <div className="w-full h-full aspect-video min-w-75 bg-[#1E1E1E] border border-white/10 flex flex-col overflow-hidden">+ <PlaceholderEditor+ onVideoUpload={onVideoUpload}+ isUploading={isUploading}+ /></div>)}</MockupWrapper>@@ -1304,12 +1177,9 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct/>{/* Capa 4: Camera overlay for preview — outside zoom transform, stays fixed */}{cameraUrl && cameraConfig?.enabled && (- <div- data-camera-overlay- className="absolute inset-0 pointer-events-none"- style={{ zIndex: 4 }}- >+ <div data-camera-overlay className="absolute inset-0 pointer-events-none" style={{ zIndex: 4 }}><div+ tabIndex={0}onClick={() => {if (onCameraClick) {onCameraClick();@@ -1358,7 +1228,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functcameraDragRef.current = null;setIsDraggingCamera(false);}}- className={`absolute pointer-events-auto select-none group ${onCameraConfigChange ? (isDraggingCamera ? "cursor-grabbing" : "cursor-grab") : ""+ className={`absolute pointer-events-auto select-none outline-none group ${onCameraConfigChange ? (isDraggingCamera ? "cursor-grabbing" : "cursor-grab") : ""}`}style={{width: `${cameraConfig.size * 100}cqmin`,@@ -1374,8 +1244,7 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(functmutedplaysInlinepreload="auto"- className={`size-full object-cover shadow-[0_8px_30px_rgba(0,0,0,0.45)] ring-1 ring-white/15 ${cameraConfig.shape === "squircle" ? "squircle-element-camera" : ""- }`}+ className={`size-full object-cover shadow-[0_8px_30px_rgba(0,0,0,0.45)] transition-shadow duration-200 ring-1 ring-white/15 group-hover:ring-1 group-hover:ring-white group-focus:ring-1 group-focus:ring-white ${cameraConfig.shape === "squircle" ? "squircle-element-camera" : ""}`}style={{borderRadius:cameraConfig.shape === "circle"@@ -1389,47 +1258,6 @@ export const VideoCanvas = forwardRef<VideoCanvasHandle, VideoCanvasProps>(funct</div></div>)}- {/* Capa 5: Cursor overlay for preview */}- {/* {cursorPosition && cursorSvgDataUrl && cursorConfig.visible && cursorConfig.style !== "none" && (- <div- className="absolute inset-0 pointer-events-none"- style={{- zIndex: 4,- padding: `${padding * 0.5}%`,- }}- >- <div className="relative w-full h-full">- {cursorPosition.clicking && cursorConfig.clickEffect !== "none" && (- <div- className="absolute rounded-full animate-ping"- style={{- left: `${cursorPosition.x}%`,- top: `${cursorPosition.y}%`,- width: cursorConfig.size * 2,- height: cursorConfig.size * 2,- transform: 'translate(-50%, -50%)',- backgroundColor: cursorConfig.clickEffectColor,- opacity: cursorConfig.clickEffect === "ripple" ? 0.3 : 0.5,- }}- />- )}- <img- src={cursorSvgDataUrl}- alt="cursor"- className="absolute pointer-events-none"- style={{- left: `${cursorPosition.x}%`,- top: `${cursorPosition.y}%`,- width: cursorConfig.size,- height: cursorConfig.size,- // Cursor hotspot at top-left for arrow cursors- transform: 'translate(0, 0)',- transition: cursorConfig.smoothing > 50 ? `all ${cursorConfig.smoothing}ms ease-out` : 'none',- }}- />- </div>- </div>- )} */}</div></div></div>diff --git a/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx b/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsxindex 8df2234..52c3525 100644--- a/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx+++ b/app/components/ui/editor/mockups/MacosGhostIdeMockup.tsx@@ -40,6 +40,7 @@ export function MacosGhostIdeMockup({const textColor = isDark ? "#cccccc" : "#333333";const searchBorder = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.15)";const searchBgBase = deriveSearchBg(frameColor);+ const dotBorderColor = isDark ? "rgba(255,255,255,0.2)" : "rgba(0,0,0,0.2)";return (<div@@ -66,9 +67,9 @@ export function MacosGhostIdeMockup({><div className="flex items-center" style={{ gap: `${menuGap * 2}px` }}><div className="flex items-center" style={{ gap: `${6 * headerScale}px` }}>- <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: "1px solid rgba(255,255,255,0.2)" }} />- <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: "1px solid rgba(255,255,255,0.2)" }} />- <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: "1px solid rgba(255,255,255,0.2)" }} />+ <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: `1px solid ${dotBorderColor}` }} />+ <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: `1px solid ${dotBorderColor}` }} />+ <div style={{ width: `${12 * headerScale}px`, height: `${12 * headerScale}px`, borderRadius: "50%", backgroundColor: "transparent", border: `1px solid ${dotBorderColor}` }} /></div><div className="flex items-center" style={{ fontSize: `${menuFontSize}px`, color: isDark ? "#999999" : "#555555" }}>diff --git a/lib/mockup-canvas/macos-ghost-ide.ts b/lib/mockup-canvas/macos-ghost-ide.tsindex e42a07e..9e24cc6 100644--- a/lib/mockup-canvas/macos-ghost-ide.ts+++ b/lib/mockup-canvas/macos-ghost-ide.ts@@ -6,31 +6,32 @@ import { drawRoundedRectPath, drawMockupShadow } from "./shared";export function drawMacosGhostIdeMockup(context: MockupCanvasContext): MockupDrawResult {const { ctx, x, y, width, height, config, cornerRadius, shadowBlur } = context;- const isDark = config.darkMode;- const frameColor = config.frameColor;- const url = config.url || "openvid";+ const isDark = config.darkMode;+ const frameColor = config.frameColor;+ const url = config.url || "openvid";const headerOpacity = config.headerOpacity ?? 100;- const headerScale = (config.headerScale || 100) / 100;+ const headerScale = (config.headerScale || 100) / 100;- const headerHeight = 35 * headerScale;- const menuFontSize = 12 * headerScale;- const menuPaddingX = 8 * headerScale;+ const headerHeight = 35 * headerScale;+ const menuFontSize = 12 * headerScale;+ const menuPaddingX = 8 * headerScale;const headerPaddingX = 12 * headerScale;- const searchHeight = 22 * headerScale;+ const searchHeight = 22 * headerScale;const searchIconSize = 10 * headerScale;const searchFontSize = 11 * headerScale;- const searchGap = 6 * headerScale;- const searchBorder_ = "rgba(255,255,255,0.1)";- const dotSize = 12 * headerScale; // w-3 h-3- const dotGap = 6 * headerScale;-- const bgColor = isDark ? "#1e1e1e" : "#f3f3f3";- const borderColor = isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.1)";- const textColor = isDark ? "#cccccc" : "#333333";- const menuColor = isDark ? "#999999" : "#555555";- const searchBorder = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.15)";- const searchBgBase = deriveSearchBg(frameColor);+ const searchGap = 6 * headerScale;+ const searchBorder_ = "rgba(255,255,255,0.1)";+ const dotSize = 12 * headerScale; // w-3 h-3+ const dotGap = 6 * headerScale;++ const bgColor = isDark ? "#1e1e1e" : "#f3f3f3";+ const borderColor = isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.1)";+ const textColor = isDark ? "#cccccc" : "#333333";+ const menuColor = isDark ? "#999999" : "#555555";+ const searchBorder = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.15)";+ const searchBgBase = deriveSearchBg(frameColor);const hamburgerColor = isDark ? "rgba(163,163,163,0.8)" : "rgba(100,100,100,0.8)";+ const dotBorderColor = isDark ? "rgba(255,255,255,0.2)" : "rgba(0,0,0,0.2)";drawMockupShadow(ctx, x, y, width, height, cornerRadius, shadowBlur);@@ -71,22 +72,22 @@ export function drawMacosGhostIdeMockup(context: MockupCanvasContext): MockupDractx.restore();const midY = y + headerHeight / 2;-const dotsStartX = x + headerPaddingX;+[0, 1, 2].forEach((i) => {const cx = dotsStartX + i * (dotSize + dotGap) + dotSize / 2;ctx.save();ctx.beginPath();ctx.arc(cx, midY, dotSize / 2, 0, Math.PI * 2);- ctx.strokeStyle = "rgba(255,255,255,0.2)";+ ctx.strokeStyle = dotBorderColor;ctx.lineWidth = 1;ctx.stroke();ctx.restore();});- const menuItems = ["File", "Edit", "Selection", "View", "Go"];- const dotsEndX = dotsStartX + 3 * dotSize + 2 * dotGap + menuPaddingX * 2;- let menuX = dotsEndX;+ const menuItems = ["File", "Edit", "Selection", "View", "Go"];+ const dotsEndX = dotsStartX + 3 * dotSize + 2 * dotGap + menuPaddingX * 2;+ let menuX = dotsEndX;ctx.save();ctx.font = `${menuFontSize}px "Inter", -apple-system, BlinkMacSystemFont, sans-serif`;@@ -100,8 +101,8 @@ export function drawMacosGhostIdeMockup(context: MockupCanvasContext): MockupDractx.restore();const searchWidth = Math.min(width * 0.4, 400 * headerScale);- const searchX = x + (width - searchWidth) / 2;- const searchY = y + (headerHeight - searchHeight) / 2;+ const searchX = x + (width - searchWidth) / 2;+ const searchY = y + (headerHeight - searchHeight) / 2;ctx.save();drawRoundedRectPath(ctx, searchX, searchY, searchWidth, searchHeight, 4 * headerScale);@@ -114,9 +115,9 @@ export function drawMacosGhostIdeMockup(context: MockupCanvasContext): MockupDractx.save();ctx.font = `${searchFontSize}px "Inter", -apple-system, BlinkMacSystemFont, sans-serif`;- const displayUrl = url.substring(0, 30);- const textW = ctx.measureText(displayUrl).width;- const groupW = searchIconSize + searchGap + textW;+ const displayUrl = url.substring(0, 30);+ const textW = ctx.measureText(displayUrl).width;+ const groupW = searchIconSize + searchGap + textW;const groupStartX = searchX + (searchWidth - groupW) / 2;drawMagnifyIcon(ctx, groupStartX, searchY + (searchHeight - searchIconSize) / 2, searchIconSize, textColor + "80");@@ -127,25 +128,25 @@ export function drawMacosGhostIdeMockup(context: MockupCanvasContext): MockupDractx.fillText(displayUrl, groupStartX + searchIconSize + searchGap, searchY + searchHeight / 2);ctx.restore();- const hamW = 14 * headerScale;- const hamH = 1.5 * headerScale;+ const hamW = 14 * headerScale;+ const hamH = 1.5 * headerScale;const hamGap = 3.5 * headerScale;- const hamX = x + width - headerPaddingX - hamW;- const hamY0 = midY - hamGap - hamH / 2;+ const hamX = x + width - headerPaddingX - hamW;+ const hamY0 = midY - hamGap - hamH / 2;ctx.save();ctx.fillStyle = hamburgerColor;ctx.beginPath();- ctx.roundRect(hamX, hamY0, hamW, hamH, hamH / 2);- ctx.roundRect(hamX, hamY0 + hamGap, hamW, hamH, hamH / 2);+ ctx.roundRect(hamX, hamY0, hamW, hamH, hamH / 2);+ ctx.roundRect(hamX, hamY0 + hamGap, hamW, hamH, hamH / 2);ctx.roundRect(hamX, hamY0 + hamGap * 2, hamW, hamH, hamH / 2);ctx.fill();ctx.restore();return {- contentX: x,- contentY: y + headerHeight,- contentWidth: width,+ contentX: x,+ contentY: y + headerHeight,+ contentWidth: width,contentHeight: height - headerHeight,};}\ No newline at end of filediff --git a/public/videos/preview-audio.mp4 b/public/videos/preview-audio.mp4new file mode 100644index 0000000..ae98e5fBinary files /dev/null and b/public/videos/preview-audio.mp4 differdiff --git a/public/videos/preview-camera.mp4 b/public/videos/preview-camera.mp4new file mode 100644index 0000000..7b749b6Binary files /dev/null and b/public/videos/preview-camera.mp4 differdiff --git a/public/videos/preview-zoom.mp4 b/public/videos/preview-zoom.mp4new file mode 100644index 0000000..16669ceBinary files /dev/null and b/public/videos/preview-zoom.mp4 differ