mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
formatting
This commit is contained in:
@@ -18,7 +18,10 @@ import {
|
||||
DEFAULT_COLOR,
|
||||
} from "@/constants/project-constants";
|
||||
import { buildDefaultScene, getProjectDurationFromScenes } from "@/lib/scenes";
|
||||
import { generateImageThumbnail, generateThumbnail } from "@/lib/media/processing";
|
||||
import {
|
||||
generateImageThumbnail,
|
||||
generateThumbnail,
|
||||
} from "@/lib/media/processing";
|
||||
import {
|
||||
CURRENT_STORAGE_VERSION,
|
||||
migrations,
|
||||
@@ -489,7 +492,10 @@ export class ProjectManager {
|
||||
project.name.toLowerCase().includes(searchQuery.toLowerCase()),
|
||||
);
|
||||
|
||||
const [key, order] = sortOption.split("-") as [TProjectSortKey, "asc" | "desc"];
|
||||
const [key, order] = sortOption.split("-") as [
|
||||
TProjectSortKey,
|
||||
"asc" | "desc",
|
||||
];
|
||||
|
||||
const sortedProjects = [...filteredProjects].sort((a, b) => {
|
||||
const aValue = a[key];
|
||||
|
||||
@@ -116,25 +116,23 @@ export async function generateImageThumbnail({
|
||||
const objectUrl = URL.createObjectURL(imageFile);
|
||||
|
||||
image.addEventListener("load", () => {
|
||||
try {
|
||||
const dataUrl = renderToThumbnailDataUrl({
|
||||
width: image.naturalWidth,
|
||||
height: image.naturalHeight,
|
||||
draw: ({ context, width, height }) => {
|
||||
context.drawImage(image, 0, 0, width, height);
|
||||
},
|
||||
});
|
||||
resolve(dataUrl);
|
||||
} catch (error) {
|
||||
reject(
|
||||
error instanceof Error
|
||||
? error
|
||||
: new Error("Could not render image"),
|
||||
);
|
||||
} finally {
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
image.remove();
|
||||
}
|
||||
try {
|
||||
const dataUrl = renderToThumbnailDataUrl({
|
||||
width: image.naturalWidth,
|
||||
height: image.naturalHeight,
|
||||
draw: ({ context, width, height }) => {
|
||||
context.drawImage(image, 0, 0, width, height);
|
||||
},
|
||||
});
|
||||
resolve(dataUrl);
|
||||
} catch (error) {
|
||||
reject(
|
||||
error instanceof Error ? error : new Error("Could not render image"),
|
||||
);
|
||||
} finally {
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
image.remove();
|
||||
}
|
||||
});
|
||||
|
||||
image.addEventListener("error", () => {
|
||||
|
||||
Reference in New Issue
Block a user