diff --git a/src/app/api/image/cad/route.js b/src/app/api/image/cad/route.js index a0e60a4c..e124408c 100644 --- a/src/app/api/image/cad/route.js +++ b/src/app/api/image/cad/route.js @@ -11,7 +11,7 @@ const s3 = new S3Client({ }) const uploadImage = async (file) => { - console.log('πŸš€ ~ uploadImage ~ file:', file) + // console.log('πŸš€ ~ uploadImage ~ file:', file) const Body = Buffer.from(await file.arrayBuffer()) const Key = `cads/${file.name}` const ContentType = 'image/png' @@ -49,7 +49,7 @@ export async function DELETE(req) { try { const searchParams = req.nextUrl.searchParams const Key = `cads/${searchParams.get('fileName')}` - console.log('πŸš€ ~ DELETE ~ Key:', Key) + // console.log('πŸš€ ~ DELETE ~ Key:', Key) if (!Key) { return NextResponse.json({ error: 'fileName parameter is required' }, { status: 400 }) diff --git a/src/app/api/image/map/route.js b/src/app/api/image/map/route.js index 0cc76c02..96df259b 100644 --- a/src/app/api/image/map/route.js +++ b/src/app/api/image/map/route.js @@ -57,7 +57,7 @@ export async function DELETE(req) { try { const searchParams = req.nextUrl.searchParams const Key = `maps/${searchParams.get('fileName')}` - console.log('πŸš€ ~ DELETE ~ Key:', Key) + // console.log('πŸš€ ~ DELETE ~ Key:', Key) if (!Key) { return NextResponse.json({ error: 'fileName parameter is required' }, { status: 400 }) diff --git a/src/app/api/image/upload/route.js b/src/app/api/image/upload/route.js index 4d875257..4d802e75 100644 --- a/src/app/api/image/upload/route.js +++ b/src/app/api/image/upload/route.js @@ -55,7 +55,7 @@ export async function DELETE(req) { } const Key = `upload/${fileName}` - console.log('πŸš€ ~ DELETE ~ Key:', Key) + // console.log('πŸš€ ~ DELETE ~ Key:', Key) await s3.send( new DeleteObjectCommand({ diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 0d6f12a8..fc0d1b88 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -23,6 +23,7 @@ import { QcastContext } from '@/app/QcastProvider' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' import { useSwal } from '@/hooks/useSwal' import { sanitizeIntegerInputEvent } from '@/util/input-utils' +import { logger } from '@/util/logger' import { CalculatorInput } from '@/components/common/input/CalcInput' import Image from 'next/image' @@ -1045,42 +1046,76 @@ export default function StuffDetail() { form.setValue('installHeight', installHeight) form.setValue('remarks', info.remarks) - if (info.saleStoreLevel === '1') { - setSelOptions(info.saleStoreId) - form.setValue('saleStoreId', info.saleStoreId) - form.setValue('saleStoreName', info.saleStoreName) - form.setValue('saleStoreLevel', info.saleStoreLevel) + // [PLANREQ-MATCH 2026-05-12] λ§€ν•‘ μ •μ±… μž¬μ •μ˜ β€” λ―Έλ§€μΉ­ μ‹œ list append 폐지, 둜그인 μ΄ˆκΈ°κ°’ reset 으둜 μ „ν™˜ + // - μ§„μž… κ°€λ“œ (2차점 둜그인 storeLvl='2'): 1μ°¨ hidden·본인 firstAgent κ³ μ • β†’ 1μ°¨ derive skip, 2μ°¨ λ§€ν•‘λ§Œ 검증, μ‹€νŒ¨ μ‹œ 2차만 본인 store 둜 reset + // - T01 / 1차점: 1μ°¨ 게이트 β€” 1μ°¨ λ§€ν•‘ μ‹€νŒ¨ = 전체 μ‹€νŒ¨. info.saleStoreLevel='2' μΌ€μ΄μŠ€λŠ” firstAgent derive + 2μ°¨ lookup λ‘˜ λ‹€ 성곡해야 set. ν•œμͺ½μ΄λΌλ„ μ‹€νŒ¨ μ‹œ 1,2μ°¨ λͺ¨λ‘ 둜그인 μ΄ˆκΈ°κ°’μœΌλ‘œ reset + const resetSaleStoresToLoginDefaults = () => { + if (session?.storeId === 'T01') { + setSelOptions('T01') + form.setValue('saleStoreId', 'T01') + form.setValue('saleStoreLevel', session?.storeLvl) + setOtherSelOptions('') + form.setValue('otherSaleStoreId', '') + form.setValue('otherSaleStoreLevel', '') + } else if (session?.storeLvl === '1') { + setSelOptions(session?.storeId) + form.setValue('saleStoreId', session?.storeId) + form.setValue('saleStoreLevel', session?.storeLvl) + setOtherSelOptions('') + form.setValue('otherSaleStoreId', '') + form.setValue('otherSaleStoreLevel', '') + } + // storeLvl='2' λŠ” 별도 처리 β€” resetSaleStoresToLoginDefaults() ν˜ΈμΆœλ˜μ§€ μ•ŠμŒ + } + + if (session?.storeId !== 'T01' && session?.storeLvl === '2') { + // 2차점 둜그인: 1μ°¨ derive skip, 2μ°¨ λ§€ν•‘λ§Œ 검증 + const matched2 = otherSaleStoreList.some((o) => o.saleStoreId === info.saleStoreId) + if (matched2) { + setOtherSelOptions(info.saleStoreId) + form.setValue('otherSaleStoreId', info.saleStoreId) + form.setValue('otherSaleStoreName', info.saleStoreName) + form.setValue('otherSaleStoreLevel', info.saleStoreLevel) + } else { + // 2μ°¨ λ§€ν•‘ μ‹€νŒ¨ β†’ 2차만 본인 store 둜 reset + setOtherSelOptions(session?.storeId) + form.setValue('otherSaleStoreId', session?.storeId) + form.setValue('otherSaleStoreLevel', session?.storeLvl) + } + } else if (info.saleStoreLevel === '1') { + // T01 / 1차점 + planreq κ°€ 1μ°¨ ID β€” 1μ°¨ λ§€ν•‘λ§Œ μ‹œλ„ + const matched1 = saleStoreList.some((s) => s.saleStoreId === info.saleStoreId) + if (matched1) { + setSelOptions(info.saleStoreId) + form.setValue('saleStoreId', info.saleStoreId) + form.setValue('saleStoreName', info.saleStoreName) + form.setValue('saleStoreLevel', info.saleStoreLevel) + setOtherSelOptions('') + form.setValue('otherSaleStoreId', '') + form.setValue('otherSaleStoreLevel', '') + } else { + resetSaleStoresToLoginDefaults() + } } else { - setOtherSelOptions(info.saleStoreId) - form.setValue('otherSaleStoreId', info.saleStoreId) - form.setValue('otherSaleStoreName', info.saleStoreName) - form.setValue('otherSaleStoreLevel', info.saleStoreLevel) + // T01 / 1차점 + planreq κ°€ 2μ°¨ ID β€” firstAgent derive + 2μ°¨ lookup λ™μ‹œ ν•„μš” + const matched2 = otherSaleStoreList.some((o) => o.saleStoreId === info.saleStoreId) get({ url: `/api/object/saleStore/${info.saleStoreId}/firstAgent` }).then((res) => { - if (res?.firstAgentId) { - const firstAgent = { saleStoreId: res.firstAgentId, saleStoreName: res.firstAgentName } - setSaleStoreList((prev) => { - const exists = prev.some((s) => s.saleStoreId === res.firstAgentId) - return exists ? prev : [...prev, firstAgent] - }) - setShowSaleStoreList((prev) => { - const exists = prev.some((s) => s.saleStoreId === res.firstAgentId) - return exists ? prev : [...prev, firstAgent] - }) - setSelOptions(res.firstAgentId) - form.setValue('saleStoreId', res.firstAgentId) + const firstId = res?.firstAgentId + const matchedFirst = firstId && saleStoreList.some((s) => s.saleStoreId === firstId) + if (matched2 && matchedFirst) { + setSelOptions(firstId) + form.setValue('saleStoreId', firstId) form.setValue('saleStoreName', res.firstAgentName) form.setValue('saleStoreLevel', '1') + setOtherSelOptions(info.saleStoreId) + form.setValue('otherSaleStoreId', info.saleStoreId) + form.setValue('otherSaleStoreName', info.saleStoreName) + form.setValue('otherSaleStoreLevel', info.saleStoreLevel) } else { - setSelOptions('') - form.setValue('saleStoreId', '') - form.setValue('saleStoreName', '') - form.setValue('saleStoreLevel', '') + resetSaleStoresToLoginDefaults() } }).catch(() => { - setSelOptions('') - form.setValue('saleStoreId', '') - form.setValue('saleStoreName', '') - form.setValue('saleStoreLevel', '') + resetSaleStoresToLoginDefaults() }) } } @@ -1271,7 +1306,6 @@ export default function StuffDetail() { const onValid = async (actionType) => { const formData = form.getValues(); if(actionType !== 'save') return false - console.log('Action type:', actionType); // 'save' λ˜λŠ” 'tempSave' let errors = {} let fieldNm @@ -1474,7 +1508,7 @@ export default function StuffDetail() { type: 'alert', icon: 'error', }) - console.log('error::::::', error) + logger.error('error::::::', error) }) } else { // μˆ˜μ •λͺ¨λ“œμΌλ•ŒλŠ” PUT @@ -1507,7 +1541,7 @@ export default function StuffDetail() { type: 'alert', icon: 'error', }) - console.log('error::::::', error) + logger.error('error::::::', error) }) } } @@ -1598,7 +1632,7 @@ export default function StuffDetail() { type: 'alert', icon: 'error', }) - console.log('error::::::', error) + logger.error('error::::::', error) }) } else { setIsGlobalLoading(true) @@ -1622,7 +1656,7 @@ export default function StuffDetail() { type: 'alert', icon: 'error', }) - console.error('error::::::', error) + logger.error('error::::::', error) }) } } @@ -1692,7 +1726,7 @@ export default function StuffDetail() { type: 'alert', icon: 'error', }) - console.log('error::::::', error) + logger.error('error::::::', error) }) }, }) @@ -2051,13 +2085,12 @@ export default function StuffDetail() { getOptionLabel={(x) => x.saleStoreName} getOptionValue={(x) => x.saleStoreId} isDisabled={ - session?.storeLvl === '1' + // [PLANREQ-MATCH 2026-05-11] T01 λ˜λŠ” 1μ°¨ user(storeLvl='1') 은 2μ°¨ enable, 2μ°¨ user(storeLvl='2') 만 disable + session?.storeId === 'T01' || session?.storeLvl === '1' ? otherSaleStoreList.length > 0 ? false : true - : otherSaleStoreList.length === 1 - ? true - : false + : true } isClearable={true} value={otherSaleStoreList.filter(function (option) { @@ -2650,15 +2683,14 @@ export default function StuffDetail() { getOptionLabel={(x) => x.saleStoreName} getOptionValue={(x) => x.saleStoreId} isDisabled={ + // [PLANREQ-MATCH 2026-05-11] T01 λ˜λŠ” 1μ°¨ user(storeLvl='1') 은 2μ°¨ enable, 2μ°¨ user(storeLvl='2') 만 disable managementState?.tempFlg === '0' ? true - : session?.storeLvl === '1' + : session?.storeId === 'T01' || session?.storeLvl === '1' ? otherSaleStoreList.length > 0 ? false : true - : otherSaleStoreList.length === 1 - ? true - : false + : true } isClearable={managementState?.tempFlg === '0' ? false : true} value={otherSaleStoreList.filter(function (option) { diff --git a/src/config/config.export.js b/src/config/config.export.js index 620bd65c..142d4026 100644 --- a/src/config/config.export.js +++ b/src/config/config.export.js @@ -5,7 +5,7 @@ import configProduction from './config.production' // ν΄λΌμ΄μ–ΈνŠΈμ—μ„œλŠ” 이 ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ config 값을 μ°Έμ‘°ν•©λ‹ˆλ‹€. const Config = () => { - console.log('πŸš€ ~ Config ~ process.env.NEXT_PUBLIC_RUN_MODE:', process.env.NEXT_PUBLIC_RUN_MODE) + // console.log('πŸš€ ~ Config ~ process.env.NEXT_PUBLIC_RUN_MODE:', process.env.NEXT_PUBLIC_RUN_MODE) switch (process.env.NEXT_PUBLIC_RUN_MODE) { case 'local': return configLocal diff --git a/src/lib/cadAction.js b/src/lib/cadAction.js index b2feafff..aa15d9dd 100644 --- a/src/lib/cadAction.js +++ b/src/lib/cadAction.js @@ -10,7 +10,7 @@ import fs from 'fs/promises' const imageSavePath = 'public/cadImages' const convertDwgToPng = async (fileName, data) => { - console.log('fileName', fileName) + // console.log('fileName', fileName) try { await fs.readdir(imageSavePath) } catch { diff --git a/src/util/skeleton-utils.js b/src/util/skeleton-utils.js index ce02181c..e46053c4 100644 --- a/src/util/skeleton-utils.js +++ b/src/util/skeleton-utils.js @@ -96,7 +96,7 @@ const movingLineFromSkeleton = (roofId, canvas) => { const _lp = canvas?.skeleton?.lastPoints const _src = _lp ? 'lastPoints' : 'orgRoofPoints' const _p7 = oldPoints?.[7] - logger.log(`[LP-TRACE] movingLineFromSkeleton.in src=${_src} oldPoints[7]=(${_p7?.x?.toFixed(1)},${_p7?.y?.toFixed(1)}) pos=${movePosition} dir=${moveDirection}`) + // logger.log(`[LP-TRACE] movingLineFromSkeleton.in src=${_src} oldPoints[7]=(${_p7?.x?.toFixed(1)},${_p7?.y?.toFixed(1)}) pos=${movePosition} dir=${moveDirection}`) } catch (_e) {} const oppositeLine = findOppositeLine(canvas.skeleton.Edges, startPoint, endPoint, oldPoints); @@ -108,18 +108,18 @@ const movingLineFromSkeleton = (roofId, canvas) => { const skeletonLines = canvas.getObjects().filter((object) => object.skeletonType === 'line' && object.parentId === roofId) if (oppositeLine) { - logger.log('Opposite line found:', oppositeLine); + // logger.log('Opposite line found:', oppositeLine); } else { - logger.log('No opposite line found'); + // logger.log('No opposite line found'); } if(moveFlowLine !== 0) { return oldPoints.map((point, index) => { - logger.log('Point:', point); + // logger.log('Point:', point); const newPoint = { ...point }; const absMove = Big(moveFlowLine).times(2).div(10); - logger.log('skeletonBuilder moveDirection:', moveDirection); + // logger.log('skeletonBuilder moveDirection:', moveDirection); switch (moveDirection) { case 'left': @@ -180,7 +180,7 @@ const movingLineFromSkeleton = (roofId, canvas) => { if (line.position === 'bottom') { - logger.log('oldPoint:', point); + // logger.log('oldPoint:', point); if (isSamePoint(newPoint, line.start)) { newPoint.y = Big(line.start.y).minus(absMove).toNumber(); @@ -199,7 +199,7 @@ const movingLineFromSkeleton = (roofId, canvas) => { // μ‚¬μš© μ˜ˆμ‹œ } - logger.log('newPoint:', newPoint); + // logger.log('newPoint:', newPoint); //baseline λ³€κ²½ return newPoint; }) @@ -256,10 +256,10 @@ const movingLineFromSkeleton = (roofId, canvas) => { affected.add(k); affected.add((k + 1) % nPts); }); - logger.log('absMove::', moveUpDownLength); + // logger.log('absMove::', moveUpDownLength); // [BR-TRACE local] movingLineFromSkeleton position/direction λΆ„κΈ° const __isLocalMS = process.env.NEXT_PUBLIC_RUN_MODE === 'local' - if (__isLocalMS) logger.log(`[BR-TRACE] movingLineFromSkeleton position=${position} dir=${moveDirection} affected=${[...affected].join(',')}`) + // if (__isLocalMS) logger.log(`[BR-TRACE] movingLineFromSkeleton position=${position} dir=${moveDirection} affected=${[...affected].join(',')}`) affected.forEach((i) => { const point = newPoints[i]; if (!point) return; @@ -267,19 +267,19 @@ const movingLineFromSkeleton = (roofId, canvas) => { if (position === 'bottom') { if (moveDirection === 'in') point.y = Big(point.y).minus(moveUpDownLength).toNumber(); else if (moveDirection === 'out') point.y = Big(point.y).plus(moveUpDownLength).toNumber(); - if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} bottom/${moveDirection} y ${__by}β†’${point.y}`) + // if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} bottom/${moveDirection} y ${__by}β†’${point.y}`) } else if (position === 'top') { if (moveDirection === 'in') point.y = Big(point.y).plus(moveUpDownLength).toNumber(); else if (moveDirection === 'out') point.y = Big(point.y).minus(moveUpDownLength).toNumber(); - if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} top/${moveDirection} y ${__by}β†’${point.y}`) + // if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} top/${moveDirection} y ${__by}β†’${point.y}`) } else if (position === 'left') { if (moveDirection === 'in') point.x = Big(point.x).plus(moveUpDownLength).toNumber(); else if (moveDirection === 'out') point.x = Big(point.x).minus(moveUpDownLength).toNumber(); - if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} left/${moveDirection} x ${__bx}β†’${point.x}`) + // if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} left/${moveDirection} x ${__bx}β†’${point.x}`) } else if (position === 'right') { if (moveDirection === 'in') point.x = Big(point.x).minus(moveUpDownLength).toNumber(); else if (moveDirection === 'out') point.x = Big(point.x).plus(moveUpDownLength).toNumber(); - if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}β†’${point.x}`) + // if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}β†’${point.x}`) } else if (__isLocalMS) { logger.warn(`[BR-TRACE] i=${i} position=${position} λ§€μΉ­ λΆ„κΈ° μ—†μŒ (이동 μ•ˆ 됨)`) } @@ -409,7 +409,7 @@ const buildRawMovedPoints = (roofId, canvas) => { // [LP-TRACE] buildRawMovedPoints μ§„μž… β€” prevLast 유무 및 [7] ν˜„μž¬ κ°’ try { const _pl7 = prevLast?.[7] - logger.log(`[LP-TRACE] buildRaw.in prevLast=${prevLast ? 'Y' : 'N'} prevLast[7]=(${_pl7?.x?.toFixed(1)},${_pl7?.y?.toFixed(1)}) oldPoints[7]=(${oldPoints[7]?.x?.toFixed(1)},${oldPoints[7]?.y?.toFixed(1)})`) + // logger.log(`[LP-TRACE] buildRaw.in prevLast=${prevLast ? 'Y' : 'N'} prevLast[7]=(${_pl7?.x?.toFixed(1)},${_pl7?.y?.toFixed(1)}) oldPoints[7]=(${oldPoints[7]?.x?.toFixed(1)},${oldPoints[7]?.y?.toFixed(1)})`) } catch (_e) {} const selectLine = roof.moveSelectLine @@ -447,7 +447,7 @@ const buildRawMovedPoints = (roofId, canvas) => { }) // [BR-TRACE local] buildRawMovedPoints position/direction λΆ„κΈ° const __isLocalBR = process.env.NEXT_PUBLIC_RUN_MODE === 'local' - if (__isLocalBR) logger.log(`[BR-TRACE] buildRawMovedPoints position=${position} dir=${moveDirection} affected=${[...affected].join(',')}`) + // if (__isLocalBR) logger.log(`[BR-TRACE] buildRawMovedPoints position=${position} dir=${moveDirection} affected=${[...affected].join(',')}`) affected.forEach((i) => { const point = newPoints[i] if (!point) return @@ -455,19 +455,19 @@ const buildRawMovedPoints = (roofId, canvas) => { if (position === 'bottom') { if (moveDirection === 'out') point.y = Big(point.y).plus(moveUpDownLength).toNumber() else if (moveDirection === 'in') point.y = Big(point.y).minus(moveUpDownLength).toNumber() - if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} bottom/${moveDirection} y ${__by}β†’${point.y}`) + // if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} bottom/${moveDirection} y ${__by}β†’${point.y}`) } else if (position === 'top') { if (moveDirection === 'out') point.y = Big(point.y).minus(moveUpDownLength).toNumber() else if (moveDirection === 'in') point.y = Big(point.y).plus(moveUpDownLength).toNumber() - if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} top/${moveDirection} y ${__by}β†’${point.y}`) + // if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} top/${moveDirection} y ${__by}β†’${point.y}`) } else if (position === 'left') { if (moveDirection === 'out') point.x = Big(point.x).minus(moveUpDownLength).toNumber() else if (moveDirection === 'in') point.x = Big(point.x).plus(moveUpDownLength).toNumber() - if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} left/${moveDirection} x ${__bx}β†’${point.x}`) + // if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} left/${moveDirection} x ${__bx}β†’${point.x}`) } else if (position === 'right') { if (moveDirection === 'out') point.x = Big(point.x).plus(moveUpDownLength).toNumber() else if (moveDirection === 'in') point.x = Big(point.x).minus(moveUpDownLength).toNumber() - if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}β†’${point.x}`) + // if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}β†’${point.x}`) } else if (__isLocalBR) { logger.warn(`[BR-TRACE] i=${i} position=${position} λ§€μΉ­ λΆ„κΈ° μ—†μŒ (이동 μ•ˆ 됨)`) } @@ -478,7 +478,7 @@ const buildRawMovedPoints = (roofId, canvas) => { const _sel = selectLine const _sp = _sel?.startPoint const _ep = _sel?.endPoint - logger.log(`[LP-TRACE] buildRaw.out matchingLines=${matchingLines.length} selSP=(${_sp?.x?.toFixed(1)},${_sp?.y?.toFixed(1)}) selEP=(${_ep?.x?.toFixed(1)},${_ep?.y?.toFixed(1)}) bp7=(${basePoints[7]?.x?.toFixed(1)},${basePoints[7]?.y?.toFixed(1)}) newPoints[7]=(${newPoints[7]?.x?.toFixed(1)},${newPoints[7]?.y?.toFixed(1)})`) + // logger.log(`[LP-TRACE] buildRaw.out matchingLines=${matchingLines.length} selSP=(${_sp?.x?.toFixed(1)},${_sp?.y?.toFixed(1)}) selEP=(${_ep?.x?.toFixed(1)},${_ep?.y?.toFixed(1)}) bp7=(${basePoints[7]?.x?.toFixed(1)},${basePoints[7]?.y?.toFixed(1)}) newPoints[7]=(${newPoints[7]?.x?.toFixed(1)},${newPoints[7]?.y?.toFixed(1)})`) } catch (_e) {} return newPoints @@ -512,7 +512,7 @@ export const verifyMoveBoundary = (roofId, canvas) => { try { const roof = canvas?.getObjects().find((o) => o.id === roofId) if (!roof || !Array.isArray(roof.points)) { - logger.log('[verifyMoveBoundary] roof/points μ—†μŒ β†’ unknown') + // logger.log('[verifyMoveBoundary] roof/points μ—†μŒ β†’ unknown') return 'unknown' } @@ -520,20 +520,20 @@ export const verifyMoveBoundary = (roofId, canvas) => { const moveUpDown = roof.moveUpDown ?? 0 const position = roof.movePosition const direction = roof.moveDirect - logger.log( - `[verifyMoveBoundary] μ§„μž… position=${position} direction=${direction} moveUpDown=${moveUpDown} moveFlowLine=${moveFlowLine}` - ) + // logger.log( + // `[verifyMoveBoundary] μ§„μž… position=${position} direction=${direction} moveUpDown=${moveUpDown} moveFlowLine=${moveFlowLine}` + // ) if (moveFlowLine === 0 && moveUpDown === 0) { - logger.log('[verifyMoveBoundary] 이동 μ—†μŒ β†’ ok') + // logger.log('[verifyMoveBoundary] 이동 μ—†μŒ β†’ ok') return 'ok' } const proposed = buildRawMovedPoints(roofId, canvas) const orig = roof.points if (!Array.isArray(proposed) || proposed.length !== orig.length) { - logger.log( - `[verifyMoveBoundary] proposed 비정상 (len=${proposed?.length}, orig.len=${orig.length}) β†’ unknown` - ) + // logger.log( + // `[verifyMoveBoundary] proposed 비정상 (len=${proposed?.length}, orig.len=${orig.length}) β†’ unknown` + // ) return 'unknown' } @@ -556,9 +556,9 @@ export const verifyMoveBoundary = (roofId, canvas) => { const crossOrig = getTurnDirection(orig[prev], orig[i], orig[next]) const crossNew = getTurnDirection(proposed[prev], proposed[i], proposed[next]) - logger.log( - `[verifyMoveBoundary] [${i}] orig=(${Math.round(orig[i].x)},${Math.round(orig[i].y)}) β†’ proposed=(${Math.round(proposed[i].x)},${Math.round(proposed[i].y)}) crossOrig=${crossOrig.toFixed(1)} crossNew=${crossNew.toFixed(1)}` - ) + // logger.log( + // `[verifyMoveBoundary] [${i}] orig=(${Math.round(orig[i].x)},${Math.round(orig[i].y)}) β†’ proposed=(${Math.round(proposed[i].x)},${Math.round(proposed[i].y)}) crossOrig=${crossOrig.toFixed(1)} crossNew=${crossNew.toFixed(1)}` + // ) // μ›λž˜ 골짜기(>0) μ˜€λ˜ κΌ­μ§“μ λ§Œ 경계 νŒμ • λŒ€μƒ if (crossOrig > 0) { @@ -572,18 +572,18 @@ export const verifyMoveBoundary = (roofId, canvas) => { return 'crossed' } if (Math.abs(crossNew) <= boundaryTol) { - logger.log( - `[verifyMoveBoundary] 꼭짓점[${i}] 경계 도달 (on-boundary): cross β‰ˆ 0 (${crossNew.toFixed(1)})` - ) + // logger.log( + // `[verifyMoveBoundary] 꼭짓점[${i}] 경계 도달 (on-boundary): cross β‰ˆ 0 (${crossNew.toFixed(1)})` + // ) if (worst === 'ok') worst = 'on-boundary' } } } if (movedIdx.length === 0) { - logger.log('[verifyMoveBoundary] μ΄λ™λœ 꼭짓점 0개 (buildRawMovedPoints λ§€μΉ­ μ‹€νŒ¨ κ°€λŠ₯μ„±)') + // logger.log('[verifyMoveBoundary] μ΄λ™λœ 꼭짓점 0개 (buildRawMovedPoints λ§€μΉ­ μ‹€νŒ¨ κ°€λŠ₯μ„±)') } - logger.log(`[verifyMoveBoundary] μ΅œμ’… νŒμ •: ${worst} (moved indices=[${movedIdx.join(',')}])`) + // logger.log(`[verifyMoveBoundary] μ΅œμ’… νŒμ •: ${worst} (moved indices=[${movedIdx.join(',')}])`) return worst } catch (e) { logger.warn('[verifyMoveBoundary] νŒμ • μ‹€νŒ¨ β†’ unknown:', e) @@ -735,7 +735,7 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi if (!il || !isFinite(il.x1) || !isFinite(il.y1) || !isFinite(il.x2) || !isFinite(il.y2)) return false return il.lineName === 'hip' || il.name === 'hip' }) - logger.log(`[v1 ext] HIP μΆ”μΆœ ${hipLines.length}개 / 전체 innerLines ${roof.innerLines.length}`) + // logger.log(`[v1 ext] HIP μΆ”μΆœ ${hipLines.length}개 / 전체 innerLines ${roof.innerLines.length}`) // μ ˆμ‚­ λŒ€μƒ: roofLine seg + canvas 의 λ‹€λ₯Έ 보쑰라인 (eaveHelpLine λ“±). // κΈ°μ‘΄ helper 자체(BASELINE_TO_ROOFLINE_HELPER_TYPE) / wall/roof 본체 / ν…μŠ€νŠΈ 등은 μ œμ™Έ. @@ -765,7 +765,7 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi const s = segs[k] auxList.push(`${s.__name || '?'}=(${Math.round(s.A.x)},${Math.round(s.A.y)})β†’(${Math.round(s.B.x)},${Math.round(s.B.y)}) len=${Math.round(Math.hypot(s.B.x - s.A.x, s.B.y - s.A.y))}`) } - logger.log(`[BR-SEGS] roofLine=${m} aux=${segs.length - m}`, auxList) + // logger.log(`[BR-SEGS] roofLine=${m} aux=${segs.length - m}`, auxList) } // [v1 ext μ •μ •] ext λŠ” wallbaseLine 의 꼭지점(corner) 에 outer 끝점이 μΌμΉ˜ν•˜λŠ” hip 만 λŒ€μƒ. @@ -784,16 +784,16 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi // outer 끝이 wallbaseLine corner 에 μΌμΉ˜ν•˜μ§€ μ•ŠμœΌλ©΄ ext λŒ€μƒ μ•„λ‹˜. if (outerCornerDist > CORNER_EPS) { - logger.log( - `[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) ` + - `corner 거리=${outerCornerDist.toFixed(2)} > ${CORNER_EPS} β†’ λ‚΄λΆ€ hip skip` - ) + // logger.log( + // `[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) ` + + // `corner 거리=${outerCornerDist.toFixed(2)} > ${CORNER_EPS} β†’ λ‚΄λΆ€ hip skip` + // ) continue } // 이미 처마(roofLine) μœ„μ— 있으면 ext λΆˆν•„μš”. if (isPointOnRoofLine(outerEnd, 1.0)) { - logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) 이미 roofLine μœ„ β†’ skip`) + // logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) 이미 roofLine μœ„ β†’ skip`) continue } @@ -815,7 +815,7 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi // [BR-RAY] local only β€” finite t 인 λͺ¨λ“  후보 hit 찍기 (μ–΄λ–€ seg κ°€ κ°€μž₯ λΉ λ₯Έμ§€ λΉ„κ΅μš©) if (__isLocalRayLog && isFinite(t)) { const __label = (k < m) ? `roofLine#${k}` : (segs[k].__name || `aux#${k - m}`) - logger.log(`[BR-RAY] hip outer=(${Math.round(outerEnd.x)},${Math.round(outerEnd.y)}) ${__label} t=${t.toFixed(2)} seg=(${Math.round(A.x)},${Math.round(A.y)})β†’(${Math.round(B.x)},${Math.round(B.y)})`) + // logger.log(`[BR-RAY] hip outer=(${Math.round(outerEnd.x)},${Math.round(outerEnd.y)}) ${__label} t=${t.toFixed(2)} seg=(${Math.round(A.x)},${Math.round(A.y)})β†’(${Math.round(B.x)},${Math.round(B.y)})`) } if (t < bestT) { bestT = t @@ -824,7 +824,7 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi } } if (!isFinite(bestT) || bestT < 0.5) { - logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) NO_HIT or λ„ˆλ¬΄ κ°€κΉŒμ›€`) + // logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) NO_HIT or λ„ˆλ¬΄ κ°€κΉŒμ›€`) continue } @@ -833,18 +833,18 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi // eaveHelpLine 이 ray 경둜λ₯Ό κ°€λ‘œλ§‰μœΌλ©΄ 이미 eave/aux μ˜μ—­μ— λ„λ‹¬ν•œ κ²ƒμ΄λ―€λ‘œ 더 그릴 ν•„μš” μ—†μŒ. // roofLine 승자만 μ§„μ§œ "처마 도달" 둜 인정 β†’ ext κ·Έλ¦Ό. if (bestSegName === 'eaveHelpLine') { - logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) 승자=eaveHelpLine bestT=${bestT.toFixed(2)} β†’ skip`) + // logger.log(`[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) 승자=eaveHelpLine bestT=${bestT.toFixed(2)} β†’ skip`) continue } const hitX = outerEnd.x + ux * bestT const hitY = outerEnd.y + uy * bestT - logger.log( - `[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) ` + - `dir=(${ux.toFixed(3)},${uy.toFixed(3)}) bestT=${bestT.toFixed(2)} src=${bestSrc} ` + - `β†’ ext=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)})β†’(${hitX.toFixed(1)},${hitY.toFixed(1)})` - ) + // logger.log( + // `[v1 ext] hip outer=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)}) ` + + // `dir=(${ux.toFixed(3)},${uy.toFixed(3)}) bestT=${bestT.toFixed(2)} src=${bestSrc} ` + + // `β†’ ext=(${outerEnd.x.toFixed(1)},${outerEnd.y.toFixed(1)})β†’(${hitX.toFixed(1)},${hitY.toFixed(1)})` + // ) // ───────────────────────────────────────────────────────────────────────── // [hip μ’Œν‘œ μ—°μž₯ 2026-04-30] @@ -884,10 +884,10 @@ const drawBaselineToRooflineHelpers = (roof, canvas, baseLinePoints, roofLinePoi if (typeof hip.setLength === 'function') hip.setLength() if (typeof hip.addLengthText === 'function') hip.addLengthText() - logger.log( - `[v1 ext] hip μ—°μž₯ oldLen=${oldLen.toFixed(1)} +extLen=${extLen.toFixed(1)} ratio=${ratio.toFixed(3)} ` + - `(plane ${oldPlane}β†’${hip.attributes.planeSize}, actual ${oldActual}β†’${hip.attributes.actualSize})` - ) + // logger.log( + // `[v1 ext] hip μ—°μž₯ oldLen=${oldLen.toFixed(1)} +extLen=${extLen.toFixed(1)} ratio=${ratio.toFixed(3)} ` + + // `(plane ${oldPlane}β†’${hip.attributes.planeSize}, actual ${oldActual}β†’${hip.attributes.actualSize})` + // ) // ───────────────────────────────────────────────────────────────────────── // [ν™•μž₯μ„  μŠ€νƒ€μΌ] local: λΉ¨κ°• 점선(디버그 κ°€μ‹œν™”), dev/prd: innerLine 동일색·싀선(μ—°κ²°λœ κ²ƒμ²˜λŸΌ). @@ -983,10 +983,10 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { const moveUpDown = roof.moveUpDown || 0 // 디버그: offset λ³€κ²½ + moveLine μƒνƒœ 확인 - logger.log('[DEBUG] moveFlowLine:', moveFlowLine, 'moveUpDown:', moveUpDown) - logger.log('[DEBUG] wall.lines:', wall.lines.map((l, i) => `[${i}] (${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})`)) - logger.log('[DEBUG] wall.baseLines:', wall.baseLines.map((l, i) => `[${i}] (${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})`)) - logger.log('[DEBUG] roof.points:', roof.points.map((p, i) => `[${i}] (${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[DEBUG] moveFlowLine:', moveFlowLine, 'moveUpDown:', moveUpDown) + // logger.log('[DEBUG] wall.lines:', wall.lines.map((l, i) => `[${i}] (${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})`)) + // logger.log('[DEBUG] wall.baseLines:', wall.baseLines.map((l, i) => `[${i}] (${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})`)) + // logger.log('[DEBUG] roof.points:', roof.points.map((p, i) => `[${i}] (${Math.round(p.x)},${Math.round(p.y)})`)) // λ‹«νžŒ 폴리곀(첫점 = 끝점)인 경우 λ§ˆμ§€λ§‰ 쀑볡 점 제거 const isClosedPolygon = (points) => @@ -1128,8 +1128,8 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { if (SK_INPUT_USE_WALL_BASELINE_DIRECT) { changRoofLinePoints = orderedBaseLinePoints.map((p) => ({ x: p.x, y: p.y })) roofLineContactPoints = orderedBaseLinePoints.map((p) => ({ x: p.x, y: p.y })) - logger.log('[v1 SK_INPUT] wall.baseLines 직접 μ‚¬μš© (45Β° ν™•μž₯/movedPoints λ¬΄μ‹œ):', - changRoofLinePoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`).join(' ')) + // logger.log('[v1 SK_INPUT] wall.baseLines 직접 μ‚¬μš© (45Β° ν™•μž₯/movedPoints λ¬΄μ‹œ):', + // changRoofLinePoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`).join(' ')) // [v1 ν‰ν–‰μ˜€λ²„ corner 흑수 2026-04-29] // ν‰ν–‰μ˜€λ²„ μ‹œ OVER_GUARD κ°€ 인접 baseLine 길이λ₯Ό OVER_EPS(0.5) 만큼만 남김. @@ -1162,15 +1162,15 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { kept = next } if (absorbedAll.length > 0 && kept.length >= 3) { - logger.log(`[v1 SK_INPUT ν‰ν–‰ν‘μˆ˜] ${absorbedAll.length}개 corner 제거:\n ${absorbedAll.join('\n ')}`) - logger.log(`[v1 SK_INPUT ν‰ν–‰ν‘μˆ˜] μ΅œμ’… ${kept.length}개 corner:`, - kept.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`).join(' ')) + // logger.log(`[v1 SK_INPUT ν‰ν–‰ν‘μˆ˜] ${absorbedAll.length}개 corner 제거:\n ${absorbedAll.join('\n ')}`) + // logger.log(`[v1 SK_INPUT ν‰ν–‰ν‘μˆ˜] μ΅œμ’… ${kept.length}개 corner:`, + // kept.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`).join(' ')) changRoofLinePoints = kept roofLineContactPoints = kept.map((p) => ({ x: p.x, y: p.y })) } } - logger.log('[DEBUG] changRoofLinePoints(μ΅œμ’… SKμž…λ ₯):', changRoofLinePoints.map((p, i) => `[${i}] (${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[DEBUG] changRoofLinePoints(μ΅œμ’… SKμž…λ ₯):', changRoofLinePoints.map((p, i) => `[${i}] (${Math.round(p.x)},${Math.round(p.y)})`)) // μ’Œν‘œ μœ νš¨μ„± 검증 const invalidPoints = changRoofLinePoints.filter((p, i) => @@ -1206,14 +1206,14 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { let isOverDetected = false const origPoints = roof.points || [] const n = changRoofLinePoints.length - logger.log('[SK_OVER_DEBUG] origPoints:', origPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) - logger.log('[SK_OVER_DEBUG] changRoofLinePoints:', changRoofLinePoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) - logger.log('[SK_OVER_DEBUG] λ³€κ²½λœ 점:', changRoofLinePoints.map((p, i) => { - const o = origPoints[i] - if (!o) return null - const dist = Math.hypot(p.x - o.x, p.y - o.y) - return dist > 1 ? `[${i}] dx=${Math.round(p.x - o.x)} dy=${Math.round(p.y - o.y)}` : null - }).filter(Boolean)) + // logger.log('[SK_OVER_DEBUG] origPoints:', origPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[SK_OVER_DEBUG] changRoofLinePoints:', changRoofLinePoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[SK_OVER_DEBUG] λ³€κ²½λœ 점:', changRoofLinePoints.map((p, i) => { + // const o = origPoints[i] + // if (!o) return null + // const dist = Math.hypot(p.x - o.x, p.y - o.y) + // return dist > 1 ? `[${i}] dx=${Math.round(p.x - o.x)} dy=${Math.round(p.y - o.y)}` : null + // }).filter(Boolean)) if (origPoints.length === n && n >= 3) { for (let i = 0; i < n; i++) { const prevOrig = origPoints[(i - 1 + n) % n] @@ -1257,7 +1257,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { ) if (corrected && corrected.length >= 3) { skeletonInputPoints = corrected - logger.log('[SK_OVER] 보정 포인트 적용:', skeletonInputPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[SK_OVER] 보정 포인트 적용:', skeletonInputPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) } } catch (e) { logger.error('[SK_OVER] 보정 μ‹€νŒ¨ β†’ fallback:', e) @@ -1270,8 +1270,8 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { try { // SkeletonBuilderλŠ” λ‹«νžˆμ§€ μ•Šμ€ 폴리곀을 κΈ°λŒ€ν•˜λ―€λ‘œ λ§ˆμ§€λ§‰ 점 제거 geoJSONPolygon.pop() - logger.log('[SkeletonBuilder] geoJSONPolygon:', JSON.stringify(geoJSONPolygon, null, 2)) - logger.log('[SkeletonBuilder] 꼭짓점 수:', geoJSONPolygon.length) + // logger.log('[SkeletonBuilder] geoJSONPolygon:', JSON.stringify(geoJSONPolygon, null, 2)) + // logger.log('[SkeletonBuilder] 꼭짓점 수:', geoJSONPolygon.length) const skeleton = SkeletonBuilder.BuildFromGeoJSON([[geoJSONPolygon]]) // μŠ€μΌˆλ ˆν†€ 데이터λ₯Ό 기반으둜 λ‚΄λΆ€μ„  생성 @@ -1324,9 +1324,9 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { // [LP-TRACE] μ‹€μ œ μ €μž₯λ˜λŠ” lastPoints[7] β€” 이 값이 λ‹€μŒ μ΄λ™μ˜ prevLast[7] try { const _p7 = rawMovedFull[7] - logger.log(`[LP-TRACE] lastPoints.save [7]=(${_p7?.x?.toFixed(1)},${_p7?.y?.toFixed(1)}) len=${rawMovedFull.length}`) + // logger.log(`[LP-TRACE] lastPoints.save [7]=(${_p7?.x?.toFixed(1)},${_p7?.y?.toFixed(1)}) len=${rawMovedFull.length}`) } catch (_e) {} - logger.log('[skeleton] lastPoints μ €μž₯: raw ν’€ 길이', rawMovedFull.length, '점') + // logger.log('[skeleton] lastPoints μ €μž₯: raw ν’€ 길이', rawMovedFull.length, '점') } else { canvas.skeleton.lastPoints = roofLineContactPoints } @@ -1378,7 +1378,7 @@ export const drawSkeletonRidgeRoofFromBaseLines = (roofId, canvas, textMode) => const bl = wall.baseLines[i] const planeSize = bl?.attributes?.planeSize ?? Infinity if (planeSize < 1) { - logger.log(`[SK_OVER_FN] baseLines[${i}] SHOULDER_ABSORBED skip (planeSize=${planeSize})`) + // logger.log(`[SK_OVER_FN] baseLines[${i}] SHOULDER_ABSORBED skip (planeSize=${planeSize})`) continue } if (bl == null || !isFinite(bl.x1) || !isFinite(bl.y1)) { @@ -1393,7 +1393,7 @@ export const drawSkeletonRidgeRoofFromBaseLines = (roofId, canvas, textMode) => return } - logger.log('[SK_OVER_FN] wall.baseLines polygon:', rawPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) + // logger.log('[SK_OVER_FN] wall.baseLines polygon:', rawPoints.map((p, i) => `[${i}](${Math.round(p.x)},${Math.round(p.y)})`)) // skeletonPoints λ§ˆν‚Ή (μ˜€λ²„ μ’Œν‘œ κ·ΈλŒ€λ‘œ) roof.skeletonPoints = rawPoints.map((p) => ({ x: p.x, y: p.y })) @@ -1403,8 +1403,8 @@ export const drawSkeletonRidgeRoofFromBaseLines = (roofId, canvas, textMode) => try { geoJSONPolygon.pop() - logger.log('[SK_OVER_FN] geoJSONPolygon:', JSON.stringify(geoJSONPolygon, null, 2)) - logger.log('[SK_OVER_FN] 꼭짓점 수:', geoJSONPolygon.length) + // logger.log('[SK_OVER_FN] geoJSONPolygon:', JSON.stringify(geoJSONPolygon, null, 2)) + // logger.log('[SK_OVER_FN] 꼭짓점 수:', geoJSONPolygon.length) const skeleton = SkeletonBuilder.BuildFromGeoJSON([[geoJSONPolygon]]) roof.innerLines = roof.innerLines || [] @@ -1577,7 +1577,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver if (rotIdx > 0) { wallLines = [...wallLines.slice(rotIdx), ...wallLines.slice(0, rotIdx)] if (process.env.NEXT_PUBLIC_RUN_MODE === 'local') { - logger.log('[WL-ROT-FIX] wall.lines rotated by', -rotIdx, 'to align with wall.baseLines[0].startPoint') + // logger.log('[WL-ROT-FIX] wall.lines rotated by', -rotIdx, 'to align with wall.baseLines[0].startPoint') } } } @@ -1723,11 +1723,11 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver // [PAIR-DIAG] local only β€” top in μ‹œ νŽ˜μ–΄ 인덱슀 어긋남 진단 (2026-04-30) // 1) 길이 미슀맀치 / 2) _keyOfEdge 좩돌 / 3) raw 단계 1:1 λ¬΄λ„ˆμ§ κ°€λ €λ‚΄κΈ° μœ„ν•¨ if (process.env.NEXT_PUBLIC_RUN_MODE === 'local') { - logger.log('[PAIR-DIAG] lengths', { - roofLines: roofLines.length, - wallLines: wallLines.length, - wallBaseLines: wall.baseLines.length, - }) + // logger.log('[PAIR-DIAG] lengths', { + // roofLines: roofLines.length, + // wallLines: wallLines.length, + // wallBaseLines: wall.baseLines.length, + // }) const _seen = new Map() roofLines.forEach((l, i) => { const k = _keyOfEdge(l) @@ -1737,10 +1737,10 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver roofLines.forEach((rl, i) => { const wl = wallLines[i] const wb = wall.baseLines[i] - logger.log(`[PAIR-DIAG] raw#${i}`, - `roof=(${Math.round(rl.x1)},${Math.round(rl.y1)})β†’(${Math.round(rl.x2)},${Math.round(rl.y2)})`, - wl ? `wall=(${Math.round(wl.x1)},${Math.round(wl.y1)})β†’(${Math.round(wl.x2)},${Math.round(wl.y2)})` : 'wall=βˆ…', - wb ? `base=(${Math.round(wb.x1)},${Math.round(wb.y1)})β†’(${Math.round(wb.x2)},${Math.round(wb.y2)})` : 'base=βˆ…') + // logger.log(`[PAIR-DIAG] raw#${i}`, + // `roof=(${Math.round(rl.x1)},${Math.round(rl.y1)})β†’(${Math.round(rl.x2)},${Math.round(rl.y2)})`, + // wl ? `wall=(${Math.round(wl.x1)},${Math.round(wl.y1)})β†’(${Math.round(wl.x2)},${Math.round(wl.y2)})` : 'wall=βˆ…', + // wb ? `base=(${Math.round(wb.x1)},${Math.round(wb.y1)})β†’(${Math.round(wb.x2)},${Math.round(wb.y2)})` : 'base=βˆ…') }) } @@ -1774,7 +1774,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const l = `${lineAxis}${k}` // y1 or x1 const otherL = `${lineAxis}${otherK}` // y2 or x2 - logger.log(`${condition}::::isStartEnd:::::`) + // logger.log(`${condition}::::isStartEnd:::::`) // [MOVE-TRACE] index 0 μ „μš© (ν•„μš” μ‹œ 주석 ν•΄μ œ) // if (index === 0) { @@ -1858,12 +1858,12 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const prevAbsorbed = (prevBL?.attributes?.planeSize ?? Infinity) < 10 const nextAbsorbed = (nextBL?.attributes?.planeSize ?? Infinity) < 10 if (prevAbsorbed || nextAbsorbed) { - logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) + // logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) return } } - logger.log(`${condition}::::isStartEnd (both):::::`) + // logger.log(`${condition}::::isStartEnd (both):::::`) // 원본 κΈ°μ€€: moveDistY = abs(roofLine.y - wallBaseLine.y), moveDistX = abs(roofLine.x - wallBaseLine.x) const moveDistY1 = Math.abs(Big(roofLine.y1).minus(wallBaseLine.y1).toNumber()) @@ -1889,7 +1889,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const createHipLine = (fromPoint, toPoint) => { const createdLine = getAddLine(fromPoint, toPoint, 'orange', 'extensionLine') - logger.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 }) + // logger.log('extensionLine created - length:', createdLine.length, 'coords:', { x1: createdLine.x1, y1: createdLine.y1, x2: createdLine.x2, y2: createdLine.y2 }) createdLine.set({ name: LINE_TYPE.SUBLINE.HIP, lineName: LINE_TYPE.SUBLINE.HIP, stroke: '#FF0000', strokeWidth: 2 }) createdLine.attributes = { ...createdLine.attributes, type: LINE_TYPE.SUBLINE.HIP } innerLines.push(createdLine) @@ -1915,7 +1915,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver target = { x: roofLine.x1 + xSignStart * dist, y: roofLine.y1 } } if (!__isNearSkVertex(target)) { - logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP_VERTEX_MISS start target=(${target.x.toFixed(1)},${target.y.toFixed(1)})`) + // logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP_VERTEX_MISS start target=(${target.x.toFixed(1)},${target.y.toFixed(1)})`) } else { createHipLine(sPoint, target) } @@ -1931,7 +1931,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver target = { x: roofLine.x2 + xSignEnd * dist, y: roofLine.y2 } } if (!__isNearSkVertex(target)) { - logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP_VERTEX_MISS end target=(${target.x.toFixed(1)},${target.y.toFixed(1)})`) + // logger.log(`⏭️ [pair#${index}] ${condition} HIP_SKIP_VERTEX_MISS end target=(${target.x.toFixed(1)},${target.y.toFixed(1)})`) } else { createHipLine(ePoint, target) } @@ -1988,7 +1988,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver // }) // } - logger.log('wallBaseLines', wall.baseLines) + // logger.log('wallBaseLines', wall.baseLines) //wall.baseLine은 움직인라인 let movedLines = [] @@ -1996,7 +1996,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver // 쑰건에 λ§žλŠ” λΌμΈλ“€λ§Œ 필터링 const validWallLines = [...wallLines].sort((a, b) => a.idx - b.idx).filter((wallLine, index) => wallLine.idx - 1 === index) - logger.log('', sortRoofLines, sortWallLines, sortWallBaseLines); + // logger.log('', sortRoofLines, sortWallLines, sortWallBaseLines); (sortWallLines.length === sortWallBaseLines.length && sortWallBaseLines.length > 3) && sortWallLines.forEach((wallLine, index) => { @@ -2009,7 +2009,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver // μž„κ³„ = 10: useMovementSetting OVER_EPS=0.5 (canvas unit) μ‹œ μž”μ—¬ 길이=0.5 β†’ planeSize=5 (calcLinePlaneSize Γ— 10). // μ•ˆμ „λ§ˆμ§„ 두고 < 10 으둜 차단. 정상 baseLine 은 보톡 50+ μ΄λ―€λ‘œ false positive μ—†μŒ. if (!wallBaseLine || (wallBaseLine.attributes?.planeSize ?? Infinity) < 10) { - logger.log(`⏭️ [pair#${index}] SHOULDER_ABSORBED skip: wb=(${Math.round(wallBaseLine?.x1)},${Math.round(wallBaseLine?.y1)})β†’(${Math.round(wallBaseLine?.x2)},${Math.round(wallBaseLine?.y2)}) planeSize=${wallBaseLine?.attributes?.planeSize}`) + // logger.log(`⏭️ [pair#${index}] SHOULDER_ABSORBED skip: wb=(${Math.round(wallBaseLine?.x1)},${Math.round(wallBaseLine?.y1)})β†’(${Math.round(wallBaseLine?.x2)},${Math.round(wallBaseLine?.y2)}) planeSize=${wallBaseLine?.attributes?.planeSize}`) return } @@ -2022,7 +2022,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const wallIdWl = wallLine.attributes?.wallId ?? wallLine.attributes?.idx ?? '?' const wallIdWb = wallBaseLine.attributes?.wallId ?? wallBaseLine.attributes?.idx ?? '?' const dirMatch = wlDir === wbDir - logger.log(`πŸ”— [pair#${index}] wallId wl=${wallIdWl} wb=${wallIdWb} ${dirMatch ? '' : '⚠️DIR_MISMATCH '}wlDir=${wlDir} wbDir=${wbDir} wl=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wb=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) + // logger.log(`πŸ”— [pair#${index}] wallId wl=${wallIdWl} wb=${wallIdWb} ${dirMatch ? '' : '⚠️DIR_MISMATCH '}wlDir=${wlDir} wbDir=${wbDir} wl=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wb=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) } //roofline μ™Έκ³½μ„  μ„€μ • @@ -2066,7 +2066,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver } for (const [p1, p2] of __cgPairs) { if (Math.hypot(p2.x - p1.x, p2.y - p1.y) < 0.5) continue - logger.log(`🎯 [corner-gap eaveHelpLine] index=${index} p1=(${Math.round(p1.x)},${Math.round(p1.y)})β†’p2=(${Math.round(p2.x)},${Math.round(p2.y)}) wallLine=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wallBaseLine=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) + // logger.log(`🎯 [corner-gap eaveHelpLine] index=${index} p1=(${Math.round(p1.x)},${Math.round(p1.y)})β†’p2=(${Math.round(p2.x)},${Math.round(p2.y)}) wallLine=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wallBaseLine=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) const __cgLine = new QLine([p1.x, p1.y, p2.x, p2.y], { parentId: roof.id, fontSize: roof.fontSize, @@ -2112,15 +2112,15 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver movedLines.push({ index, p1, p2 }) // [진단] eaveHelpLine 생성 좔적: μ–΄λŠ index/μ–΄λŠ wallBaseLine-wallLine μŒμ—μ„œ λ§Œλ“€μ–΄μ§€λŠ”μ§€ - logger.log('🎯 [getAddLine]', { - index, - lineType, - p1: { x: Math.round(p1.x), y: Math.round(p1.y) }, - p2: { x: Math.round(p2.x), y: Math.round(p2.y) }, - wallLine: `(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)})`, - wallBaseLine: `(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`, - wallBaseLen: Math.round(Math.hypot(wallBaseLine.x2 - wallBaseLine.x1, wallBaseLine.y2 - wallBaseLine.y1)), - }) + // logger.log('🎯 [getAddLine]', { + // index, + // lineType, + // p1: { x: Math.round(p1.x), y: Math.round(p1.y) }, + // p2: { x: Math.round(p2.x), y: Math.round(p2.y) }, + // wallLine: `(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)})`, + // wallBaseLine: `(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`, + // wallBaseLen: Math.round(Math.hypot(wallBaseLine.x2 - wallBaseLine.x1, wallBaseLine.y2 - wallBaseLine.y1)), + // }) const dx = Math.abs(p2.x - p1.x); const dy = Math.abs(p2.y - p1.y); @@ -2190,7 +2190,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const midY = (wallBaseLine.y1 + wallBaseLine.y2) / 2 const isH = Math.abs(wallBaseLine.y1 - wallBaseLine.y2) < 0.5 const isV = Math.abs(wallBaseLine.x1 - wallBaseLine.x2) < 0.5 - logger.log(`🧭 [getSelectLinePosition κ²°κ³Ό] idx=${index} position=${mLine.position} orient=${mLine.orientation} mid=(${Math.round(midX)},${Math.round(midY)}) isH=${isH} isV=${isV} wallLine=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wallBaseLine=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) + // logger.log(`🧭 [getSelectLinePosition κ²°κ³Ό] idx=${index} position=${mLine.position} orient=${mLine.orientation} mid=(${Math.round(midX)},${Math.round(midY)}) isH=${isH} isV=${isV} wallLine=(${Math.round(wallLine.x1)},${Math.round(wallLine.y1)})β†’(${Math.round(wallLine.x2)},${Math.round(wallLine.y2)}) wallBaseLine=(${Math.round(wallBaseLine.x1)},${Math.round(wallBaseLine.y1)})β†’(${Math.round(wallBaseLine.x2)},${Math.round(wallBaseLine.y2)})`) } if (getOrientation(roofLine) === 'vertical') { @@ -2247,7 +2247,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const prevAbsorbed = (prevBL?.attributes?.planeSize ?? Infinity) < 10 const nextAbsorbed = (nextBL?.attributes?.planeSize ?? Infinity) < 10 if (prevAbsorbed || nextAbsorbed) { - logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) + // logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) return } } @@ -2306,7 +2306,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver } if (isStartEnd.end) { - logger.log('left_out::::isStartEnd:::::', isStartEnd) + // logger.log('left_out::::isStartEnd:::::', isStartEnd) const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber() const aStartY = Big(roofLine.y2).plus(moveDist).toNumber() const bStartY = Big(wallLine.y2).plus(moveDist).toNumber() @@ -2371,13 +2371,13 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const prevAbsorbed = (prevBL?.attributes?.planeSize ?? Infinity) < 10 const nextAbsorbed = (nextBL?.attributes?.planeSize ?? Infinity) < 10 if (prevAbsorbed || nextAbsorbed) { - logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) + // logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) return } } if (isStartEnd.start) { - logger.log('right_out::::isStartEnd:::::', isStartEnd) + // logger.log('right_out::::isStartEnd:::::', isStartEnd) const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber() const aStartY = Big(roofLine.y1).plus(moveDist).toNumber() const bStartY = Big(wallLine.y1).plus(moveDist).toNumber() @@ -2532,13 +2532,13 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const prevAbsorbed = (prevBL?.attributes?.planeSize ?? Infinity) < 10 const nextAbsorbed = (nextBL?.attributes?.planeSize ?? Infinity) < 10 if (prevAbsorbed || nextAbsorbed) { - logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) + // logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) return } } if (isStartEnd.start) { - logger.log('top_out isStartEnd:::::::', isStartEnd) + // logger.log('top_out isStartEnd:::::::', isStartEnd) const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const aStartX = Big(roofLine.x1).plus(moveDist).toNumber() const bStartX = Big(wallLine.x1).plus(moveDist).toNumber() @@ -2591,7 +2591,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver getAddLine(newPStart, newPEnd, 'red') } if (isStartEnd.end) { - logger.log('isStartEnd:::::', isStartEnd) + // logger.log('isStartEnd:::::', isStartEnd) const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const aStartX = Big(roofLine.x2).minus(moveDist).toNumber() const bStartX = Big(wallLine.x2).minus(moveDist).toNumber() @@ -2643,7 +2643,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver getAddLine(newPStart, newPEnd, 'red') } } else if (condition === 'bottom_out') { - logger.log('bottom_out isStartEnd:::::::', isStartEnd) + // logger.log('bottom_out isStartEnd:::::::', isStartEnd) // [SHOULDER-ADJACENT _out] 인접 pair 흑수 μ‹œ ν˜„μž¬ pair 의 끝점은 μƒˆ SK ν† ν΄λ‘œμ§€μ—μ„œ dissolve 됨. // roof.points μ˜› μ½”λ„ˆ μ°Έμ‘° β†’ updateAndAddLine NOT FOUND + phantom eaveHelpLine μ™ΈλΆ€ μΆœν˜„. @@ -2655,13 +2655,13 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const prevAbsorbed = (prevBL?.attributes?.planeSize ?? Infinity) < 10 const nextAbsorbed = (nextBL?.attributes?.planeSize ?? Infinity) < 10 if (prevAbsorbed || nextAbsorbed) { - logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) + // logger.log(`⏭️ [pair#${index}] ${condition} OUT_SKIP adj_absorbed prev=${prevAbsorbed} next=${nextAbsorbed}`) return } } if (isStartEnd.start) { - logger.log('isStartEnd:::::::', isStartEnd) + // logger.log('isStartEnd:::::::', isStartEnd) const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const aStartX = Big(roofLine.x1).minus(moveDist).toNumber() const bStartX = Big(wallLine.x1).minus(moveDist).toNumber() @@ -2714,7 +2714,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver } if (isStartEnd.end) { - logger.log('isStartEnd:::::', isStartEnd) + // logger.log('isStartEnd:::::', isStartEnd) const moveDist = Big(wallLine.y1).minus(wallBaseLine.y1).abs().toNumber() const aStartX = Big(roofLine.x2).plus(moveDist).toNumber() const bStartX = Big(wallLine.x2).plus(moveDist).toNumber() @@ -2851,12 +2851,12 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver if (toRemove.length > 0) { if (process.env.NEXT_PUBLIC_RUN_MODE === 'local') { - logger.log( - `[Bμ•ˆ cull] dead-end ridge 제거 ${toRemove.length}개`, - toRemove.map( - (l) => `(${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})` - ) - ) + // logger.log( + // `[Bμ•ˆ cull] dead-end ridge 제거 ${toRemove.length}개`, + // toRemove.map( + // (l) => `(${Math.round(l.x1)},${Math.round(l.y1)})β†’(${Math.round(l.x2)},${Math.round(l.y2)})` + // ) + // ) } toRemove.forEach((line) => { canvas.remove(line) @@ -2915,7 +2915,7 @@ function processEavesEdge(roofId, canvas, skeleton, edgeResult, skeletonLines) { if(!outerLine) { outerLine = findMatchingLine(edgeResult.Polygon, roof, roof.points); - logger.log('Has matching line:', outerLine); + // logger.log('Has matching line:', outerLine); //if(outerLine === null) return } // [hip pitch fallback 2026-04-30] @@ -3084,12 +3084,12 @@ function logDeadEndLines(skeletonLines, roof) { const p2Dead = deadEndVertices.has(k2); if (p1Dead || p2Dead) { - logger.log('⚠️ [logDeadEndLines] μ‚­μ œ 후보:', { - idx, - p1: { x: Math.round(line.p1.x), y: Math.round(line.p1.y), deadEnd: p1Dead, isRoof: isRoofVertex(line.p1) }, - p2: { x: Math.round(line.p2.x), y: Math.round(line.p2.y), deadEnd: p2Dead, isRoof: isRoofVertex(line.p2) }, - dx: Math.round(dx), dy: Math.round(dy), - }); + // logger.log('⚠️ [logDeadEndLines] μ‚­μ œ 후보:', { + // idx, + // p1: { x: Math.round(line.p1.x), y: Math.round(line.p1.y), deadEnd: p1Dead, isRoof: isRoofVertex(line.p1) }, + // p2: { x: Math.round(line.p2.x), y: Math.round(line.p2.y), deadEnd: p2Dead, isRoof: isRoofVertex(line.p2) }, + // dx: Math.round(dx), dy: Math.round(dy), + // }); } }); @@ -3248,8 +3248,8 @@ const calcOverCorrectedPointsSafe = (points, origPoints, lastPoints) => { changedNow[i] ? op : (lastPoints[i] ?? op) ) - logger.log('[calcOverCorrectedPointsSafe] changedNow:', - changedNow.map((v, i) => v ? i : null).filter(v => v !== null)) + // logger.log('[calcOverCorrectedPointsSafe] changedNow:', + // changedNow.map((v, i) => v ? i : null).filter(v => v !== null)) return calcOverCorrectedPoints(points, virtualOrig) } @@ -3271,7 +3271,7 @@ const calcOverCorrectedPoints = (points, origPoints) => { const origDir = origPoints[movedIdx].x - origPoints[fixedIdx].x const newDir = skPoints[movedIdx].x - skPoints[fixedIdx].x if (origDir * newDir < 0) { - logger.log(`[SK_OVER] ν΄λž¨ν•‘: [${movedIdx}].x ${Math.round(skPoints[movedIdx].x)} β†’ ${Math.round(skPoints[fixedIdx].x)}`) + // logger.log(`[SK_OVER] ν΄λž¨ν•‘: [${movedIdx}].x ${Math.round(skPoints[movedIdx].x)} β†’ ${Math.round(skPoints[fixedIdx].x)}`) skPoints[movedIdx].x = skPoints[fixedIdx].x didClamp = true } @@ -3281,7 +3281,7 @@ const calcOverCorrectedPoints = (points, origPoints) => { const origDir = origPoints[movedIdx].y - origPoints[fixedIdx].y const newDir = skPoints[movedIdx].y - skPoints[fixedIdx].y if (origDir * newDir < 0) { - logger.log(`[SK_OVER] ν΄λž¨ν•‘: [${movedIdx}].y ${Math.round(skPoints[movedIdx].y)} β†’ ${Math.round(skPoints[fixedIdx].y)}`) + // logger.log(`[SK_OVER] ν΄λž¨ν•‘: [${movedIdx}].y ${Math.round(skPoints[movedIdx].y)} β†’ ${Math.round(skPoints[fixedIdx].y)}`) skPoints[movedIdx].y = skPoints[fixedIdx].y didClamp = true } @@ -4534,14 +4534,14 @@ export const getSelectLinePosition = (wall, selectLine, options = {}) => { const { testDistance = 10, epsilon = 0.5, debug = false } = options; if (!wall || !selectLine) { - if (debug) logger.log('ERROR: wall λ˜λŠ” selectLine이 μ—†μŒ'); + // if (debug) logger.log('ERROR: wall λ˜λŠ” selectLine이 μ—†μŒ'); return { position: 'unknown', orientation: 'unknown', error: 'invalid_input' }; } // selectLine의 μ’Œν‘œ μΆ”μΆœ const lineCoords = extractLineCoords(selectLine); if (!lineCoords.valid) { - if (debug) logger.log('ERROR: selectLine μ’Œν‘œκ°€ μœ νš¨ν•˜μ§€ μ•ŠμŒ'); + // if (debug) logger.log('ERROR: selectLine μ’Œν‘œκ°€ μœ νš¨ν•˜μ§€ μ•ŠμŒ'); return { position: 'unknown', orientation: 'unknown', error: 'invalid_coords' }; } @@ -4633,7 +4633,7 @@ export const getSelectLinePosition = (wall, selectLine, options = {}) => { } else { // λŒ€κ°μ„  - if (debug) logger.log('λŒ€κ°μ„ μ€ μ§€μ›ν•˜μ§€ μ•ŠμŒ'); + // if (debug) logger.log('λŒ€κ°μ„ μ€ μ§€μ›ν•˜μ§€ μ•ŠμŒ'); return { position: 'unknown', orientation: 'diagonal', error: 'not_supported' }; } @@ -4848,9 +4848,9 @@ export const processEaveHelpLines = (lines) => { const mergedHorizontal = mergeLines(horizontalLines, 'horizontal'); // κ²°κ³Ό ν™•μΈμš© 둜그 - logger.log('Original lines:', lines.length); - logger.log('Merged vertical:', mergedVertical.length); - logger.log('Merged horizontal:', mergedHorizontal.length); + // logger.log('Original lines:', lines.length); + // logger.log('Merged vertical:', mergedVertical.length); + // logger.log('Merged horizontal:', mergedHorizontal.length); return [...mergedVertical, ...mergedHorizontal]; }; @@ -4893,7 +4893,7 @@ const mergeLines = (lines, direction) => { merged.push(current); // 병합 κ²°κ³Ό 둜그 - logger.log(`Merged ${direction} lines:`, merged); + // logger.log(`Merged ${direction} lines:`, merged); return merged; }; @@ -4959,7 +4959,7 @@ function updateAndAddLine(innerLines, targetPoint) { if (!foundLine) { foundLine = findLineContainingPoint(innerLines, targetPoint); if (foundLine) { - logger.log(`[MOVE-TRACE] HIP fallback matched: position=${targetPoint.position} target=(${targetPoint.x.toFixed(2)},${targetPoint.y.toFixed(2)}) β†’ (${foundLine.x1.toFixed(1)},${foundLine.y1.toFixed(1)})β†’(${foundLine.x2.toFixed(1)},${foundLine.y2.toFixed(1)}) type=${foundLine.attributes?.type||'?'}`) + // logger.log(`[MOVE-TRACE] HIP fallback matched: position=${targetPoint.position} target=(${targetPoint.x.toFixed(2)},${targetPoint.y.toFixed(2)}) β†’ (${foundLine.x1.toFixed(1)},${foundLine.y1.toFixed(1)})β†’(${foundLine.x2.toFixed(1)},${foundLine.y2.toFixed(1)}) type=${foundLine.attributes?.type||'?'}`) } } if (!foundLine) { @@ -5116,7 +5116,7 @@ function isPointOnLineSegment2(point, lineStart, lineEnd, tolerance = 0.1) { const isOnSegment = Math.abs((dist1 + dist2) - lineLength) <= tolerance; if (isOnSegment) { - logger.log(`점 (${px}, ${py})은 μ„ λΆ„ [(${x1}, ${y1}), (${x2}, ${y2})] μœ„μ— μžˆμŠ΅λ‹ˆλ‹€.`); + // logger.log(`점 (${px}, ${py})은 μ„ λΆ„ [(${x1}, ${y1}), (${x2}, ${y2})] μœ„μ— μžˆμŠ΅λ‹ˆλ‹€.`); } return isOnSegment; @@ -5223,13 +5223,13 @@ function isValleyVertex(targetPoint, connectedLine, allLines, isStartVertex) { const fmt = (p) => `(${Math.round(p.x)},${Math.round(p.y)})`; const cLen = Math.hypot(clx2 - clx1, cly2 - cly1); const nLen = Math.hypot(nlx2 - nlx1, nly2 - nly1); - logger.log( - `[VALLEY] ${isStartVertex ? 'START' : 'END'} target=${fmt(targetPoint)} ` + - `conn=${fmt({x:clx1,y:cly1})}β†’${fmt({x:clx2,y:cly2})}[len=${cLen.toFixed(2)}] ` + - `neigh=${fmt({x:nlx1,y:nly1})}β†’${fmt({x:nlx2,y:nly2})}[len=${nLen.toFixed(2)}] ` + - `p1=${fmt(p1)} p2=${fmt(p2)} p3=${fmt(p3)} cross=${crossProduct.toFixed(2)} ` + - `valley=${collinearSkip ? false : (crossProduct > 0)}${collinearSkip ? ' (collinear-skip)' : ''}` - ); + // logger.log( + // `[VALLEY] ${isStartVertex ? 'START' : 'END'} target=${fmt(targetPoint)} ` + + // `conn=${fmt({x:clx1,y:cly1})}β†’${fmt({x:clx2,y:cly2})}[len=${cLen.toFixed(2)}] ` + + // `neigh=${fmt({x:nlx1,y:nly1})}β†’${fmt({x:nlx2,y:nly2})}[len=${nLen.toFixed(2)}] ` + + // `p1=${fmt(p1)} p2=${fmt(p2)} p3=${fmt(p3)} cross=${crossProduct.toFixed(2)} ` + + // `valley=${collinearSkip ? false : (crossProduct > 0)}${collinearSkip ? ' (collinear-skip)' : ''}` + // ); if (collinearSkip) return false; return crossProduct > 0; }