feat: complete windows cursor assets
This commit is contained in:
+11
-69
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
|
||||
import type { DesktopCapturerSource } from "electron";
|
||||
import {
|
||||
app,
|
||||
BrowserWindow,
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
shell,
|
||||
systemPreferences,
|
||||
} from "electron";
|
||||
import type { DesktopCapturerSource } from "electron";
|
||||
import {
|
||||
normalizeProjectMedia,
|
||||
normalizeRecordingSession,
|
||||
@@ -410,46 +409,6 @@ function setCurrentRecordingSessionState(session: RecordingSession | null) {
|
||||
currentVideoPath = session?.screenVideoPath ?? null;
|
||||
}
|
||||
|
||||
async function storeRecordedSessionFiles(payload: StoreRecordedSessionInput) {
|
||||
const createdAt =
|
||||
typeof payload.createdAt === "number" && Number.isFinite(payload.createdAt)
|
||||
? payload.createdAt
|
||||
: Date.now();
|
||||
const screenVideoPath = resolveRecordingOutputPath(payload.screen.fileName);
|
||||
await fs.writeFile(screenVideoPath, Buffer.from(payload.screen.videoData));
|
||||
|
||||
let webcamVideoPath: string | undefined;
|
||||
if (payload.webcam) {
|
||||
webcamVideoPath = resolveRecordingOutputPath(payload.webcam.fileName);
|
||||
await fs.writeFile(webcamVideoPath, Buffer.from(payload.webcam.videoData));
|
||||
}
|
||||
|
||||
const session: RecordingSession = webcamVideoPath
|
||||
? { screenVideoPath, webcamVideoPath, createdAt }
|
||||
: { screenVideoPath, createdAt };
|
||||
setCurrentRecordingSessionState(session);
|
||||
currentProjectPath = null;
|
||||
|
||||
const telemetryPath = `${screenVideoPath}.cursor.json`;
|
||||
if (pendingCursorRecordingData && pendingCursorRecordingData.samples.length > 0) {
|
||||
await fs.writeFile(telemetryPath, JSON.stringify(pendingCursorRecordingData, null, 2), "utf-8");
|
||||
}
|
||||
pendingCursorRecordingData = null;
|
||||
|
||||
const sessionManifestPath = path.join(
|
||||
RECORDINGS_DIR,
|
||||
`${path.parse(payload.screen.fileName).name}${RECORDING_SESSION_SUFFIX}`,
|
||||
);
|
||||
await fs.writeFile(sessionManifestPath, JSON.stringify(session, null, 2), "utf-8");
|
||||
|
||||
return {
|
||||
success: true,
|
||||
path: screenVideoPath,
|
||||
session,
|
||||
message: "Recording session stored successfully",
|
||||
};
|
||||
}
|
||||
|
||||
export function registerIpcHandlers(
|
||||
createEditorWindow: () => void,
|
||||
createSourceSelectorWindow: () => BrowserWindow,
|
||||
@@ -612,12 +571,12 @@ export function registerIpcHandlers(
|
||||
typeof payload.createdAt === "number" && Number.isFinite(payload.createdAt)
|
||||
? payload.createdAt
|
||||
: Date.now();
|
||||
const screenVideoPath = path.join(RECORDINGS_DIR, payload.screen.fileName);
|
||||
const screenVideoPath = resolveRecordingOutputPath(payload.screen.fileName);
|
||||
await fs.writeFile(screenVideoPath, Buffer.from(payload.screen.videoData));
|
||||
|
||||
let webcamVideoPath: string | undefined;
|
||||
if (payload.webcam) {
|
||||
webcamVideoPath = path.join(RECORDINGS_DIR, payload.webcam.fileName);
|
||||
webcamVideoPath = resolveRecordingOutputPath(payload.webcam.fileName);
|
||||
await fs.writeFile(webcamVideoPath, Buffer.from(payload.webcam.videoData));
|
||||
}
|
||||
|
||||
@@ -625,7 +584,6 @@ export function registerIpcHandlers(
|
||||
? { screenVideoPath, webcamVideoPath, createdAt }
|
||||
: { screenVideoPath, createdAt };
|
||||
setCurrentRecordingSessionState(session);
|
||||
currentVideoPath = screenVideoPath;
|
||||
currentProjectPath = null;
|
||||
|
||||
const telemetryPath = `${screenVideoPath}.cursor.json`;
|
||||
@@ -638,6 +596,12 @@ export function registerIpcHandlers(
|
||||
}
|
||||
pendingCursorRecordingData = null;
|
||||
|
||||
const sessionManifestPath = path.join(
|
||||
RECORDINGS_DIR,
|
||||
`${path.parse(payload.screen.fileName).name}${RECORDING_SESSION_SUFFIX}`,
|
||||
);
|
||||
await fs.writeFile(sessionManifestPath, JSON.stringify(session, null, 2), "utf-8");
|
||||
|
||||
return {
|
||||
success: true,
|
||||
path: screenVideoPath,
|
||||
@@ -1010,18 +974,7 @@ export function registerIpcHandlers(
|
||||
const content = await fs.readFile(filePath, "utf-8");
|
||||
const project = JSON.parse(content);
|
||||
currentProjectPath = filePath;
|
||||
if (project && typeof project === "object") {
|
||||
const rawProject = project as { media?: unknown; videoPath?: unknown };
|
||||
const media =
|
||||
normalizeProjectMedia(rawProject.media) ??
|
||||
(typeof rawProject.videoPath === "string"
|
||||
? {
|
||||
screenVideoPath:
|
||||
normalizeVideoSourcePath(rawProject.videoPath) ?? rawProject.videoPath,
|
||||
}
|
||||
: null);
|
||||
setCurrentRecordingSessionState(media ? { ...media, createdAt: Date.now() } : null);
|
||||
}
|
||||
setCurrentRecordingSessionState(await getApprovedProjectSession(project, filePath));
|
||||
|
||||
return {
|
||||
success: true,
|
||||
@@ -1050,18 +1003,7 @@ export function registerIpcHandlers(
|
||||
|
||||
const content = await fs.readFile(currentProjectPath, "utf-8");
|
||||
const project = JSON.parse(content);
|
||||
if (project && typeof project === "object") {
|
||||
const rawProject = project as { media?: unknown; videoPath?: unknown };
|
||||
const media =
|
||||
normalizeProjectMedia(rawProject.media) ??
|
||||
(typeof rawProject.videoPath === "string"
|
||||
? {
|
||||
screenVideoPath:
|
||||
normalizeVideoSourcePath(rawProject.videoPath) ?? rawProject.videoPath,
|
||||
}
|
||||
: null);
|
||||
setCurrentRecordingSessionState(media ? { ...media, createdAt: Date.now() } : null);
|
||||
}
|
||||
setCurrentRecordingSessionState(await getApprovedProjectSession(project, currentProjectPath));
|
||||
return {
|
||||
success: true,
|
||||
path: currentProjectPath,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.501 2.8601L15.884 11.2611C16.937 12.3171 16.19 14.1191 14.699 14.1191H13.475L14.6908 17.0067C14.9038 17.5127 14.9068 18.0727 14.6998 18.5817C14.4918 19.0917 14.0978 19.4897 13.5898 19.7027C13.3338 19.8097 13.0658 19.8637 12.7918 19.8637C11.9608 19.8637 11.2158 19.3687 10.8938 18.6027L9.616 15.565L8.784 16.3031C7.703 17.2591 6 16.4921 6 15.0481V3.4811C6 2.6971 6.947 2.3051 7.501 2.8601Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.9995 4.1292C6.9995 3.9982 7.1585 3.9322 7.2505 4.0252L15.1585 11.9502C15.5895 12.3822 15.2835 13.1192 14.6735 13.1192H11.9695L13.7691 17.3936C13.9961 17.9336 13.7421 18.5546 13.2031 18.7806C12.6621 19.0076 12.0421 18.7546 11.8161 18.2156L9.9985 13.8917L8.1385 15.5392C7.7225 15.9072 7.0806 15.6507 7.0065 15.1274L6.9995 15.0262V4.1292Z" fill="black"/>
|
||||
<circle cx="22" cy="22" r="7.25" stroke="white" stroke-width="3.5"/>
|
||||
<path d="M22 14.75C23.9228 14.75 25.7669 15.5138 27.1265 16.8735" stroke="black" stroke-width="2.3" stroke-linecap="round"/>
|
||||
<path d="M27.1265 16.8735C28.4862 18.2331 29.25 20.0772 29.25 22" stroke="#2563EB" stroke-width="2.3" stroke-linecap="round"/>
|
||||
<path d="M22 29.25C17.9959 29.25 14.75 26.0041 14.75 22" stroke="black" stroke-width="2.3" stroke-linecap="round" opacity="0.7"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.501 2.8601L15.884 11.2611C16.937 12.3171 16.19 14.1191 14.699 14.1191H13.475L14.6908 17.0067C14.9038 17.5127 14.9068 18.0727 14.6998 18.5817C14.4918 19.0917 14.0978 19.4897 13.5898 19.7027C13.3338 19.8097 13.0658 19.8637 12.7918 19.8637C11.9608 19.8637 11.2158 19.3687 10.8938 18.6027L9.616 15.565L8.784 16.3031C7.703 17.2591 6 16.4921 6 15.0481V3.4811C6 2.6971 6.947 2.3051 7.501 2.8601Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.9995 4.1292C6.9995 3.9982 7.1585 3.9322 7.2505 4.0252L15.1585 11.9502C15.5895 12.3822 15.2835 13.1192 14.6735 13.1192H11.9695L13.7691 17.3936C13.9961 17.9336 13.7421 18.5546 13.2031 18.7806C12.6621 19.0076 12.0421 18.7546 11.8161 18.2156L9.9985 13.8917L8.1385 15.5392C7.7225 15.9072 7.0806 15.6507 7.0065 15.1274L6.9995 15.0262V4.1292Z" fill="black"/>
|
||||
<circle cx="23" cy="22" r="7" fill="white"/>
|
||||
<path d="M23 28.25C26.4518 28.25 29.25 25.4518 29.25 22C29.25 18.5482 26.4518 15.75 23 15.75C19.5482 15.75 16.75 18.5482 16.75 22C16.75 25.4518 19.5482 28.25 23 28.25Z" stroke="black" stroke-width="1.8"/>
|
||||
<path d="M20.9 20.1C21.05 18.85 21.85 18.15 23.1 18.15C24.4 18.15 25.25 18.95 25.25 20.05C25.25 21.05 24.7 21.55 23.9 22.05C23.25 22.45 23 22.85 23 23.65" stroke="#2563EB" stroke-width="1.9" stroke-linecap="round"/>
|
||||
<circle cx="23" cy="25.8" r="1.15" fill="#2563EB"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,7 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="16" cy="16" r="10.75" fill="white"/>
|
||||
<circle cx="16" cy="16" r="9.25" stroke="black" stroke-width="3"/>
|
||||
<path d="M9.55 22.45L22.45 9.55" stroke="black" stroke-width="3" stroke-linecap="round"/>
|
||||
<circle cx="16" cy="16" r="8.25" stroke="#DC2626" stroke-width="2"/>
|
||||
<path d="M10.25 21.75L21.75 10.25" stroke="#DC2626" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16 2.5L7.25 12.25H12V28.5H20V12.25H24.75L16 2.5Z" fill="white" stroke="white" stroke-width="3" stroke-linejoin="round"/>
|
||||
<path d="M16 5.25L10 11.95H14V26.5H18V11.95H22L16 5.25Z" fill="black"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 306 B |
@@ -0,0 +1,6 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="16" cy="16" r="10.5" stroke="white" stroke-width="4"/>
|
||||
<path d="M16 5.5C18.7848 5.5 21.4555 6.60625 23.4246 8.57538" stroke="black" stroke-width="3" stroke-linecap="round"/>
|
||||
<path d="M23.4246 8.57538C25.3938 10.5445 26.5 13.2152 26.5 16" stroke="#2563EB" stroke-width="3" stroke-linecap="round"/>
|
||||
<path d="M16 26.5C10.201 26.5 5.5 21.799 5.5 16" stroke="black" stroke-width="3" stroke-linecap="round" opacity="0.7"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 532 B |
@@ -1,14 +1,18 @@
|
||||
import { type Container, Point } from "pixi.js";
|
||||
import appStartingUrl from "@/assets/cursors/Cursor=App-Starting.svg";
|
||||
import crosshairUrl from "@/assets/cursors/Cursor=Cross.svg";
|
||||
import arrowUrl from "@/assets/cursors/Cursor=Default.svg";
|
||||
import pointerUrl from "@/assets/cursors/Cursor=Hand-(Pointing).svg";
|
||||
import notAllowedUrl from "@/assets/cursors/Cursor=Menu.svg";
|
||||
import helpUrl from "@/assets/cursors/Cursor=Help.svg";
|
||||
import moveUrl from "@/assets/cursors/Cursor=Move.svg";
|
||||
import notAllowedUrl from "@/assets/cursors/Cursor=Not-Allowed.svg";
|
||||
import resizeNeswUrl from "@/assets/cursors/Cursor=Resize-North-East-South-West.svg";
|
||||
import resizeNsUrl from "@/assets/cursors/Cursor=Resize-North-South.svg";
|
||||
import resizeNwseUrl from "@/assets/cursors/Cursor=Resize-North-West-South-East.svg";
|
||||
import resizeEwUrl from "@/assets/cursors/Cursor=Resize-West-East.svg";
|
||||
import textUrl from "@/assets/cursors/Cursor=Text-Cursor.svg";
|
||||
import upArrowUrl from "@/assets/cursors/Cursor=Up-Arrow.svg";
|
||||
import waitUrl from "@/assets/cursors/Cursor=Wait.svg";
|
||||
import type { CropRegion } from "@/components/video-editor/types";
|
||||
import type {
|
||||
CursorRecordingData,
|
||||
@@ -113,6 +117,34 @@ const PRETTY_NATIVE_CURSOR_ASSETS: Partial<Record<NativeCursorType, PrettyNative
|
||||
hotspotX: 16,
|
||||
hotspotY: 16,
|
||||
},
|
||||
wait: {
|
||||
imageDataUrl: waitUrl,
|
||||
width: 32,
|
||||
height: 32,
|
||||
hotspotX: 16,
|
||||
hotspotY: 16,
|
||||
},
|
||||
"app-starting": {
|
||||
imageDataUrl: appStartingUrl,
|
||||
width: 32,
|
||||
height: 32,
|
||||
hotspotX: 5.8,
|
||||
hotspotY: 3.2,
|
||||
},
|
||||
help: {
|
||||
imageDataUrl: helpUrl,
|
||||
width: 32,
|
||||
height: 32,
|
||||
hotspotX: 5.8,
|
||||
hotspotY: 3.2,
|
||||
},
|
||||
"up-arrow": {
|
||||
imageDataUrl: upArrowUrl,
|
||||
width: 32,
|
||||
height: 32,
|
||||
hotspotX: 16,
|
||||
hotspotY: 3,
|
||||
},
|
||||
};
|
||||
|
||||
export function hasNativeCursorRecordingData(
|
||||
|
||||
Reference in New Issue
Block a user