Skip to content

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

feat: update VideoCanvasHandle to support high-quality frame drawing and enhance mockup device definitions with poster and video URLs

CristianOlivera1df4e46d43c61
diff --git a/types/editor.types.ts b/types/editor.types.ts
index 3e6c733..ca25d2f 100644
--- a/types/editor.types.ts
+++ b/types/editor.types.ts
@@ -43,7 +43,7 @@ export interface EditorState {
export interface VideoCanvasHandle {
getExportCanvas: () => HTMLCanvasElement | null;
- drawFrame: () => Promise<void>;
+drawFrame: (highQuality?: boolean) => Promise<void>;
getPreviewContainer: () => HTMLDivElement | null;
clearAllSelection: () => { multiIds: string[]; videoSelected: boolean };
restoreSelectionState: (state: { multiIds: string[]; videoSelected: boolean }) => void;
@@ -122,10 +122,5 @@ export interface VideoCanvasProps {
onTextToolDeactivate?: () => void;
onAddElement?: (element: CanvasElement) => void;
isPlaying?: boolean;
- /**
- * Called when the user clicks an active mockup on the canvas. The `kind`
- * discriminates between the 2D frame wrapper (e.g. MacOS browser) and
- * the 3D device phone overlay. Not fired when neither is active.
- */
onMockupClick?: (kind: "2d" | "3d") => void;
}
\ No newline at end of file
diff --git a/types/mockup.types.ts b/types/mockup.types.ts
index 04e7595..7482629 100644
--- a/types/mockup.types.ts
+++ b/types/mockup.types.ts
@@ -82,54 +82,57 @@ export function getMockupDefaultConfig(mockup: Mockup | undefined): MockupConfig
export type ImageDeviceId = (typeof IMAGE_DEVICE_TEMPLATES)[number]["id"];
-// ─── PositionPad ─────────────────────────────────────────────────────────────
-
export const PAD_H = 130;
export const X_HALF = 500;
export const Y_HALF = 500;
export const HANDLE_R = 9;
-// ─── Types ────────────────────────────────────────────────────────────────────
-
export type MenuPage = "home" | "detail-2d" | "detail-3d";
-// ─── 3D Device definitions ────────────────────────────────────────────────────
-
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",
- },
- {
- id: "iphone",
- title: "iPhone 15 Pro",
- accentColor: "#A8A8B0",
- icon: "simple-icons:apple",
- modelUrl: "/models/iphone-15-pro-max.glb",
- },
- {
- id: "samsung",
- title: "Samsung S25",
- accentColor: "#1428A0",
- icon: "simple-icons:samsung",
- modelUrl: "/models/samsung-galaxy-s25-ultra.glb",
- },
- {
- id: "phone",
- title: "Phone",
- accentColor: "#00A3FF",
- icon: "ph:device-mobile-bold",
- modelUrl: "/models/phone-gltf.glb",
- },
- {
- id: "laptop",
- title: "macOS Laptop",
- accentColor: "#CECFD3",
- icon: "ph:laptop-bold",
- modelUrl: "/models/mac-book.glb",
- },
-] as const;
-
+ {
+ 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"),
+ },
+] as const;
\ No newline at end of file