Lint and so on
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user