This commit is contained in:
Manav Rathi 2024-05-18 09:56:20 +05:30
parent fb81a59d4b
commit 9808dce44d
No known key found for this signature in database

View file

@ -9,6 +9,12 @@ import { getLocalFiles } from "services/fileService";
import { EnteFile } from "types/file";
import { getRenderableImage } from "utils/file";
/**
* Clamp {@link value} to between {@link min} and {@link max}, inclusive.
*/
export const clamp = (value: number, min: number, max: number) =>
Math.min(max, Math.max(min, value));
export async function getLocalFile(fileId: number) {
const localFiles = await getLocalFiles();
return localFiles.find((f) => f.id === fileId);
@ -116,10 +122,6 @@ export function readPixelColor(
};
}
export function clamp(value: number, min: number, max: number) {
return Math.min(max, Math.max(min, value));
}
export function getPixelBicubic(
fx: number,
fy: number,