Compare commits
No commits in common. "965f13ebdd890b7a2556857a1010338f0416112e" and "b707df8d2915839969d5d42b1a2fcfec724a1f41" have entirely different histories.
965f13ebdd
...
b707df8d29
@ -8,7 +8,6 @@ import { useSwal } from '@/hooks/useSwal'
|
|||||||
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
|
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
|
||||||
import Big from 'big.js'
|
import Big from 'big.js'
|
||||||
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
|
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
|
||||||
import { getSelectLinePosition } from '@/util/skeleton-utils'
|
|
||||||
import { useMouse } from '@/hooks/useMouse'
|
import { useMouse } from '@/hooks/useMouse'
|
||||||
|
|
||||||
//동선이동 형 올림 내림
|
//동선이동 형 올림 내림
|
||||||
@ -286,14 +285,7 @@ export function useMovementSetting(id) {
|
|||||||
const midY = Big(target.y1).plus(target.y2).div(2)
|
const midY = Big(target.y1).plus(target.y2).div(2)
|
||||||
const wall = canvas.getObjects().find((obj) => obj.id === target.attributes.wallId)
|
const wall = canvas.getObjects().find((obj) => obj.id === target.attributes.wallId)
|
||||||
|
|
||||||
const result = getSelectLinePosition(wall, target, {
|
let linePosition = classifyWallLine(wall, target).position;
|
||||||
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) { //수평벽
|
if (target.y1 === target.y2) { //수평벽
|
||||||
|
|
||||||
@ -448,8 +440,7 @@ export function useMovementSetting(id) {
|
|||||||
roof.moveFlowLine = parseInt(moveFlowLine, 10) || 0;
|
roof.moveFlowLine = parseInt(moveFlowLine, 10) || 0;
|
||||||
roof.moveUpDown = parseInt(moveUpDown, 10) || 0;
|
roof.moveUpDown = parseInt(moveUpDown, 10) || 0;
|
||||||
roof.moveDirect = "";
|
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 wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes.roofId === roofId)
|
||||||
const baseLines = wall.baseLines
|
const baseLines = wall.baseLines
|
||||||
let centerPoint = wall.getCenterPoint();
|
let centerPoint = wall.getCenterPoint();
|
||||||
@ -591,7 +582,7 @@ export function useMovementSetting(id) {
|
|||||||
value = value.neg()
|
value = value.neg()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//console.log("error::", UP_DOWN_REF)
|
console.log("error::", UP_DOWN_REF)
|
||||||
value =
|
value =
|
||||||
UP_DOWN_REF.FILLED_INPUT_REF.current.value !== ''
|
UP_DOWN_REF.FILLED_INPUT_REF.current.value !== ''
|
||||||
? Big(UP_DOWN_REF.FILLED_INPUT_REF.current.value)
|
? Big(UP_DOWN_REF.FILLED_INPUT_REF.current.value)
|
||||||
@ -615,22 +606,10 @@ export function useMovementSetting(id) {
|
|||||||
// value = value.neg()
|
// 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 // 디버깅 로그 출력
|
|
||||||
});
|
|
||||||
|
|
||||||
//console.log("2222linePosition:::::", result.position);
|
let linePosition = classifyWallLine(wall, target).position;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 디버깅용 분류 결과 확인
|
|
||||||
|
|
||||||
let linePosition = result.position;
|
|
||||||
roof.movePosition = linePosition
|
|
||||||
value = value.div(10)
|
value = value.div(10)
|
||||||
targetBaseLines
|
targetBaseLines
|
||||||
.filter((line) => Math.sqrt(Math.pow(line.line.x2 - line.line.x1, 2) + Math.pow(line.line.y2 - line.line.y1, 2)) >= 1)
|
.filter((line) => Math.sqrt(Math.pow(line.line.x2 - line.line.x1, 2) + Math.pow(line.line.y2 - line.line.y1, 2)) >= 1)
|
||||||
@ -638,7 +617,7 @@ export function useMovementSetting(id) {
|
|||||||
const currentLine = target.line
|
const currentLine = target.line
|
||||||
|
|
||||||
//console.log("linePosition::::::::::::::", linePosition)
|
//console.log("linePosition::::::::::::::", linePosition)
|
||||||
if (UP_DOWN_REF?.DOWN_RADIO_REF?.current?.checked ){
|
if (UP_DOWN_REF.DOWN_RADIO_REF.current.checked ){
|
||||||
//position확인
|
//position확인
|
||||||
if(linePosition === 'bottom' || linePosition === 'right') {
|
if(linePosition === 'bottom' || linePosition === 'right') {
|
||||||
//console.log("1value::::::::::::::", value.toString())
|
//console.log("1value::::::::::::::", value.toString())
|
||||||
@ -706,6 +685,52 @@ export function useMovementSetting(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// javascript
|
// 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 {
|
return {
|
||||||
@ -717,6 +742,7 @@ export function useMovementSetting(id) {
|
|||||||
FLOW_LINE_REF,
|
FLOW_LINE_REF,
|
||||||
UP_DOWN_REF,
|
UP_DOWN_REF,
|
||||||
handleSave,
|
handleSave,
|
||||||
|
classifyWallLine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user