Renaming general.utils to general.util

This commit is contained in:
2025-01-29 22:51:55 +01:00
parent f32c51ca38
commit f3c453b1b2
19 changed files with 26 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
import type { CanvasNode } from "~/types/canvas";
import { clamp } from "#shared/general.utils";
import { clamp } from "#shared/general.util";
export type Direction = 'bottom' | 'top' | 'left' | 'right';
export type Position = { x: number, y: number };

View File

@@ -40,15 +40,13 @@ export function format(date: Date, template: string): string
return template;
}
export function clamp(x: number, min: number, max: number): number {
if (x > max)
return max;
if (x < min)
return min;
return x;
export function clamp(x: number, min: number, max: number): number
{
return x > max ? max : x < min ? min : x;
}
export function lerp(a: number, b: number, t: number) {
return a + t * (b - a);
export function lerp(x: number, a: number, b: number): number
{
return (1-x)*a+x*b;
}
export function convertContentFromText(type: FileType, content: string): CanvasContent | string {
switch(type)