ㄱ자 모양 shape 정의
This commit is contained in:
parent
0ba9b9a4e2
commit
88a41236f4
@ -353,6 +353,47 @@ export function useMode() {
|
|||||||
// 캔버스에서 모든 라인 객체를 찾습니다.
|
// 캔버스에서 모든 라인 객체를 찾습니다.
|
||||||
const lines = otherLines || historyLines.current
|
const lines = otherLines || historyLines.current
|
||||||
if (!otherLines) {
|
if (!otherLines) {
|
||||||
|
|
||||||
|
const sortedIndex = getStartIndex(lines)
|
||||||
|
const tmpArraySorted = rearrangeArray(lines, sortedIndex)
|
||||||
|
|
||||||
|
function findTopTwoIndexesByDistance(objArr) {
|
||||||
|
if (objArr.length < 2) {
|
||||||
|
return []; // 배열의 길이가 2보다 작으면 빈 배열 반환
|
||||||
|
}
|
||||||
|
|
||||||
|
let firstIndex = -1;
|
||||||
|
let secondIndex = -1;
|
||||||
|
let firstDistance = -Infinity;
|
||||||
|
let secondDistance = -Infinity;
|
||||||
|
|
||||||
|
for (let i = 0; i < objArr.length; i++) {
|
||||||
|
const distance = objArr[i].length;
|
||||||
|
|
||||||
|
if (distance > firstDistance) {
|
||||||
|
secondDistance = firstDistance;
|
||||||
|
secondIndex = firstIndex;
|
||||||
|
firstDistance = distance;
|
||||||
|
firstIndex = i;
|
||||||
|
} else if (distance > secondDistance) {
|
||||||
|
secondDistance = distance;
|
||||||
|
secondIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [firstIndex, secondIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
const topIndex = findTopTwoIndexesByDistance(tmpArraySorted);
|
||||||
|
|
||||||
|
const shape = 0;
|
||||||
|
|
||||||
|
if(topIndex[0] === 2) {
|
||||||
|
if(topIndex[1] === 3) shape = 1
|
||||||
|
}else if(topIndex === 1){
|
||||||
|
if(topIndex[1] === 2) shape = 4
|
||||||
|
}
|
||||||
|
|
||||||
historyLines.current = []
|
historyLines.current = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user