import Image from 'next/image' import { useMessage } from '@/hooks/useMessage' import { forwardRef, useState } from 'react' import { CalculatorInput } from '@/components/common/input/CalcInput' const PlacementSurface = forwardRef((props, refs) => { const { getMessage } = useMessage() const { id, lines, info, rotate, xInversion, yInversion } = props let { length1, length2, length3, length4, length5, lengthetc, azimuth } = refs const [azimuthDirection, setAzimuthDirection] = useState(azimuth.current) const num = ['①', '②', '③', '④', '⑤'] const getImageUrl = () => { // re_는 normal의 y축 대칭 이미지 const imageName = id < 10 ? '0' + id : id let imageRotate = 0 if (xInversion && !yInversion) { if (rotate % 2 === 0 || rotate < 0) { imageRotate = Math.abs(rotate % 4) } else { if (rotate < 0) { imageRotate = Math.abs((rotate - 2) % 4) } else { imageRotate = Math.abs((rotate + 2) % 4) } } } else if (xInversion && yInversion) { imageRotate = Math.abs((rotate + 4) % 4) } else if (xInversion !== yInversion && rotate < 0) { imageRotate = Math.abs(rotate) } else if (!xInversion && yInversion) { if (rotate % 2 === 0 || rotate < 0) { imageRotate = Math.abs(rotate % 4) } else { if (rotate < 0) { imageRotate = Math.abs((rotate - 2) % 4) } else { imageRotate = Math.abs((rotate + 2) % 4) } } } else { imageRotate = (rotate + 4) % 4 } const rotateType = imageRotate % 4 !== 0 ? (imageRotate % 4) * 90 + 'deg' : 'normal' if (xInversion !== yInversion) { return `/static/images/canvas/shape/re_${rotateType}/plane_tab${imageName}.svg` } else { return `/static/images/canvas/shape/${rotateType}/plane_tab${imageName}.svg` } } const azimuthButton = (direction, e) => { setAzimuthDirection(direction) azimuth.current = direction } return ( <>