//#region src/gui/transformUtils.ts
/**
* Pure utility functions for transform calculations.
* Extracted from motion designer TransformHandles component.
*/
/**
* Rotate a point around a center point by given radians.
*/
function rotatePoint(cx, cy, x, y, radians) {
	const cos = Math.cos(radians);
	const sin = Math.sin(radians);
	return {
		x: cos * (x - cx) - sin * (y - cy) + cx,
		y: sin * (x - cx) + cos * (y - cy) + cy
	};
}
/**
* Calculate corner point in canvas coordinates for a rotated element.
* @param x - Element x position
* @param y - Element y position
* @param width - Element width
* @param height - Element height
* @param rotationRadians - Rotation in radians
* @param xMagnitude - 0 = left, 0.5 = center, 1 = right
* @param yMagnitude - 0 = top, 0.5 = center, 1 = bottom
*/
function getCornerPoint(x, y, width, height, rotationRadians, xMagnitude, yMagnitude) {
	return rotatePoint(x + width / 2, y + height / 2, x + xMagnitude * width, y + yMagnitude * height, rotationRadians);
}
/**
* Get opposite corner magnitudes for a handle.
* Used to determine which corner stays fixed during resize.
*/
function getOppositeCorner(handle) {
	switch (handle) {
		case "nw": return {
			x: 1,
			y: 1
		};
		case "n": return {
			x: .5,
			y: 1
		};
		case "ne": return {
			x: 0,
			y: 1
		};
		case "e": return {
			x: 0,
			y: .5
		};
		case "se": return {
			x: 0,
			y: 0
		};
		case "s": return {
			x: .5,
			y: 0
		};
		case "sw": return {
			x: 1,
			y: 0
		};
		case "w": return {
			x: 1,
			y: .5
		};
		default: return {
			x: .5,
			y: .5
		};
	}
}

//#endregion
export { getCornerPoint, getOppositeCorner, rotatePoint };
//# sourceMappingURL=transformUtils.js.map