import { Pos } from "../../utils/math.ts";
import { useViewerInvertTransform } from "./use-viewer.ts";

export const useConversionPosition = (enable: boolean) => {
	const invertTransform = enable && useViewerInvertTransform();
	return <T extends Pos>(position: T) => {
		return invertTransform
			? {...position, ...invertTransform.value.point(position)}
			: position;
	}
};

