Lint and so on

This commit is contained in:
2025-12-03 11:36:00 +01:00
parent e3c437c027
commit 38b0bc0437
23 changed files with 1315 additions and 185 deletions

View File

@@ -7,7 +7,7 @@ export function calculateCenterOffset(
corner: string,
deltaWidth: number,
deltaHeight: number,
rotation: number
rotation: number,
): Point {
const rad = (rotation * Math.PI) / 180;
const cos = Math.cos(rad);
@@ -24,14 +24,14 @@ export function calculateCenterOffset(
return {
x: localDx * cos - localDy * sin,
y: localDx * sin + localDy * cos
y: localDx * sin + localDy * cos,
};
}
export function constrainToAspectRatio(
newWidth: number,
newHeight: number,
aspectRatio: number
aspectRatio: number,
): { width: number; height: number } {
const newRatio = newWidth / newHeight;
@@ -47,13 +47,13 @@ export function detectRotationCorner(
localY: number,
halfWidth: number,
halfHeight: number,
zoneRadius: number
zoneRadius: number,
): string | null {
const corners: Record<string, Point> = {
nw: { x: -halfWidth, y: -halfHeight },
ne: { x: halfWidth, y: -halfHeight },
sw: { x: -halfWidth, y: halfHeight },
se: { x: halfWidth, y: halfHeight }
se: { x: halfWidth, y: halfHeight },
};
const isInsideBounds =
@@ -71,8 +71,10 @@ export function detectRotationCorner(
if (dist > zoneRadius || dist < 3) continue;
const isOutwardX = (name.includes('w') && dx < 0) || (name.includes('e') && dx > 0);
const isOutwardY = (name.includes('n') && dy < 0) || (name.includes('s') && dy > 0);
const isOutwardX =
(name.includes('w') && dx < 0) || (name.includes('e') && dx > 0);
const isOutwardY =
(name.includes('n') && dy < 0) || (name.includes('s') && dy > 0);
if (isOutwardX || isOutwardY) return name;
}