log 제거

This commit is contained in:
ysCha 2025-10-31 18:08:23 +09:00
parent 990c0e7e29
commit 03c31c82ff
2 changed files with 941 additions and 241 deletions

View File

@ -8,6 +8,7 @@ import { useSwal } from '@/hooks/useSwal'
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
import Big from 'big.js'
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
import { getSelectLinePosition } from '@/util/skeleton-utils'
import { useMouse } from '@/hooks/useMouse'
//동선이동 형 올림 내림
@ -285,7 +286,14 @@ export function useMovementSetting(id) {
const midY = Big(target.y1).plus(target.y2).div(2)
const wall = canvas.getObjects().find((obj) => obj.id === target.attributes.wallId)
let linePosition = classifyWallLine(wall, target).position;
const result = getSelectLinePosition(wall, target, {
testDistance: 5, // 테스트 거리
debug: true // 디버깅 로그 출력
});
//console.log("1111litarget:::::", target);
//console.log("1111linePosition:::::", result.position); // 'top', 'bottom', 'left', 'right'
let linePosition = result.position;
if (target.y1 === target.y2) { //수평벽
@ -440,7 +448,8 @@ export function useMovementSetting(id) {
roof.moveFlowLine = parseInt(moveFlowLine, 10) || 0;
roof.moveUpDown = parseInt(moveUpDown, 10) || 0;
roof.moveDirect = "";
roof.moveSelectLine = target;
roof.moveSelectLine = target
//console.log("target::::", target, roof.moveSelectLine)
const wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes.roofId === roofId)
const baseLines = wall.baseLines
let centerPoint = wall.getCenterPoint();
@ -582,7 +591,7 @@ export function useMovementSetting(id) {
value = value.neg()
}
} else {
console.log("error::", UP_DOWN_REF)
//console.log("error::", UP_DOWN_REF)
value =
UP_DOWN_REF.FILLED_INPUT_REF.current.value !== ''
? Big(UP_DOWN_REF.FILLED_INPUT_REF.current.value)
@ -606,10 +615,22 @@ export function useMovementSetting(id) {
// value = value.neg()
// }
}
// console.log("2222titarget:::::", target);
// console.log("2222저장된 moveSelectLine:", roof.moveSelectLine);
// console.log("222wall::::", wall.points)
const result = getSelectLinePosition(wall, target, {
testDistance: 5, // 테스트 거리
debug: true // 디버깅 로그 출력
});
let linePosition = classifyWallLine(wall, target).position;
//console.log("2222linePosition:::::", result.position);
// 디버깅용 분류 결과 확인
let linePosition = result.position;
roof.movePosition = linePosition
value = value.div(10)
targetBaseLines
.filter((line) => Math.sqrt(Math.pow(line.line.x2 - line.line.x1, 2) + Math.pow(line.line.y2 - line.line.y1, 2)) >= 1)
@ -617,7 +638,7 @@ export function useMovementSetting(id) {
const currentLine = target.line
//console.log("linePosition::::::::::::::", linePosition)
if (UP_DOWN_REF.DOWN_RADIO_REF.current.checked ){
if (UP_DOWN_REF?.DOWN_RADIO_REF?.current?.checked ){
//position확인
if(linePosition === 'bottom' || linePosition === 'right') {
//console.log("1value::::::::::::::", value.toString())
@ -685,52 +706,6 @@ export function useMovementSetting(id) {
}
// javascript
const classifyWallLine = (wall, line, epsilon = 0.5, offset = 10)=> {
if (!wall || !line) return { orientation: 'unknown', position: 'unknown' }
const center = wall.getCenterPoint()
const dx = Math.abs(line.x2 - line.x1)
const dy = Math.abs(line.y2 - line.y1)
let orientation = 'slanted'
if (dy < epsilon && dx >= epsilon) orientation = 'horizontal'
else if (dx < epsilon && dy >= epsilon) orientation = 'vertical'
else orientation = dx > dy ? 'horizontal' : 'vertical'
const midX = (line.x1 + line.x2) / 2
const midY = (line.y1 + line.y2) / 2
// checkPoint: mid에서 center 방향으로 약간 이동한 점을 계산
let checkX = midX
let checkY = midY
if (orientation === 'horizontal') {
const dir = Math.sign(center.y - midY) || 1
checkY = midY + dir * offset
} else if (orientation === 'vertical') {
const dir = Math.sign(center.x - midX) || 1
checkX = midX + dir * offset
} else {
const dirX = Math.sign(center.x - midX) || 1
const dirY = Math.sign(center.y - midY) || 1
checkX = midX + dirX * offset
checkY = midY + dirY * offset
}
const inside = typeof wall.inPolygon === 'function' ? wall.inPolygon({ x: checkX, y: checkY }) : true
let position = 'unknown'
if (orientation === 'horizontal') {
const dir = center.y - midY
if (inside) position = dir > 0 ? 'top' : 'bottom'
else position = dir > 0 ? 'bottom' : 'top'
} else if (orientation === 'vertical') {
const dir = center.x - midX
if (inside) position = dir > 0 ? 'left' : 'right'
else position = dir > 0 ? 'right' : 'left'
}
return { orientation, position, mid: { x: midX, y: midY }, center, checkPoint: { x: checkX, y: checkY }, inside }
}
return {
@ -742,7 +717,6 @@ export function useMovementSetting(id) {
FLOW_LINE_REF,
UP_DOWN_REF,
handleSave,
classifyWallLine
}
}

File diff suppressed because it is too large Load Diff