테스트
This commit is contained in:
parent
c44fa88ed8
commit
722f77bf6d
@ -338,16 +338,7 @@ export function useMode() {
|
||||
|
||||
if (!otherLines) {
|
||||
//외각선 기준
|
||||
const sortedIndex = getStartIndex(lines)
|
||||
let tmpArraySorted = rearrangeArray(lines, sortedIndex)
|
||||
|
||||
if (tmpArraySorted[0].direction === 'right') {
|
||||
//시계방향
|
||||
tmpArraySorted = tmpArraySorted.reverse() //그럼 배열을 거꾸로 만들어서 무조건 반시계방향으로 배열 보정
|
||||
}
|
||||
|
||||
setSortedArray(tmpArraySorted) //recoil에 넣음
|
||||
const topIndex = findTopTwoIndexesByDistance(tmpArraySorted) //배열중에 큰 2값을 가져옴 TODO: 나중에는 인자로 받아서 다각으로 수정 해야됨
|
||||
const topIndex = findTopTwoIndexesByDistance(sortedArray) //배열중에 큰 2값을 가져옴 TODO: 나중에는 인자로 받아서 다각으로 수정 해야됨
|
||||
|
||||
//일단 배열 6개 짜리 기준의 선 번호
|
||||
if (topIndex[0] === 4) {
|
||||
@ -718,10 +709,12 @@ export function useMode() {
|
||||
makePolygon(newOuterlines)
|
||||
}
|
||||
|
||||
const handleOuterlinesTest = () => {
|
||||
/**
|
||||
*벽 지붕 외곽선 생성
|
||||
*/
|
||||
const handleOuterlinesTest = (offset = 71) => {
|
||||
var offsetPoints = []
|
||||
let offset = 71 // == 100 - 29
|
||||
|
||||
|
||||
const sortedIndex = getStartIndex(historyLines.current)
|
||||
let tmpArraySorted = rearrangeArray(historyLines.current, sortedIndex)
|
||||
|
||||
@ -730,6 +723,8 @@ export function useMode() {
|
||||
tmpArraySorted = tmpArraySorted.reverse() //그럼 배열을 거꾸로 만들어서 무조건 반시계방향으로 배열 보정
|
||||
}
|
||||
|
||||
setSortedArray(tmpArraySorted) //recoil에 넣음
|
||||
|
||||
const points = tmpArraySorted.map((line) => ({
|
||||
x: line.x1,
|
||||
y: line.y1,
|
||||
@ -781,6 +776,25 @@ export function useMode() {
|
||||
}
|
||||
|
||||
makePolygon(offsetPoints)
|
||||
|
||||
drawDiagonalLines(tmpArraySorted) //대각선 그리기
|
||||
|
||||
}
|
||||
|
||||
|
||||
const drawDiagonalLines = (sortedArray) => {
|
||||
let splitCenter = 0
|
||||
if ( sortedArray[0].height > sortedArray[1].width ) { //세로형 네모
|
||||
splitCenter = sortedArray[0].length / 2
|
||||
|
||||
}else { //가로형 네모
|
||||
horiCenter = sortedArray[1].length / 2
|
||||
vertCenter = sortedArray[0].length / 2
|
||||
sortedArray.x1 + vertCenter // x값
|
||||
sortedArray.y1 + horiCenter // y값
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const togglePolygonLine = (obj) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user