dev #828

Merged
ysCha merged 3 commits from dev into prd-deploy 2026-05-08 17:56:38 +09:00
3 changed files with 44 additions and 0 deletions
Showing only changes of commit 2aef32e03c - Show all commits

View File

@ -11,6 +11,7 @@ import { useObjectBatch } from '@/hooks/object/useObjectBatch'
import { BATCH_TYPE, POLYGON_TYPE } from '@/common/common'
import { useSurfaceShapeBatch } from '@/hooks/surface/useSurfaceShapeBatch'
import { CalculatorInput } from '@/components/common/input/CalcInput'
import { useSwal } from '@/hooks/useSwal'
export default function SizeSetting(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
@ -20,6 +21,7 @@ export default function SizeSetting(props) {
const { closePopup } = usePopup()
const { resizeObjectBatch } = useObjectBatch({})
const { resizeSurfaceShapeBatch } = useSurfaceShapeBatch({})
const { swalFire } = useSwal()
const widthRef = useRef(null)
const heightRef = useRef(null)
const [width, setWidth] = useState(target?.width ? (target.width * 10).toFixed() : 0)
@ -46,6 +48,15 @@ export default function SizeSetting(props) {
const width = widthRef.current.value
const height = heightRef.current.value
// [OPENING-MIN-SIZE 2026-05-08] 0/ . 0,0 4
// 0-dim plan turf throw .
if (target.name === BATCH_TYPE.OPENING || target.name === BATCH_TYPE.SHADOW) {
if (width === '' || height === '' || Number(width) <= 0 || Number(height) <= 0) {
swalFire({ text: getMessage('common.canvas.validate.size'), icon: 'error' })
return
}
}
if (target.name === BATCH_TYPE.OPENING || target.name === BATCH_TYPE.SHADOW) {
resizeObjectBatch(settingTarget, target, width, height, id)
} else if (target.name === POLYGON_TYPE.ROOF) {

View File

@ -327,6 +327,15 @@ export function useModuleBasicSetting(tabNum) {
//도머등 오브젝트 객체가 있으면 아웃라인 낸다
batchObjects.forEach((obj) => {
// [OPENING-MIN-SIZE 2026-05-08] 기존 plan 에 저장된 0-면적 개구/그림자/도머 보호:
// 모든 정점이 동일 좌표면 offsetPolygon → cleanSelfIntersectingPolygon → turf.polygon throw 발생.
// 신규는 SizeSetting 가드로 막지만, 이미 저장된 데이터는 여기서 skip.
const _pts = obj.getCurrentPoints?.() || obj.points || []
if (_pts.length >= 2 && _pts.every((p) => p.x === _pts[0].x && p.y === _pts[0].y)) {
console.warn('[OPENING-MIN-SIZE 2026-05-08] 0-dim batch object skipped (outline)', { id: obj.id, name: obj.name, parentId: obj.parentId })
return
}
//도머일때
if (obj.name === BATCH_TYPE.TRIANGLE_DORMER || obj.name === BATCH_TYPE.PENTAGON_DORMER) {
const groupPoints = obj.getCurrentPoints()
@ -960,6 +969,12 @@ export function useModuleBasicSetting(tabNum) {
//도머 객체를 가져옴
if (batchObjects) {
batchObjects.forEach((object) => {
// [OPENING-MIN-SIZE 2026-05-08] 0-면적 객체는 turf 변환 시 throw 위험 → skip
const _pts = object.getCurrentPoints?.() || object.points || []
if (_pts.length >= 2 && _pts.every((p) => p.x === _pts[0].x && p.y === _pts[0].y)) {
console.warn('[OPENING-MIN-SIZE 2026-05-08] 0-dim batch object skipped (intersect)', { id: object.id, name: object.name })
return
}
let dormerTurfPolygon = polygonToTurfPolygon(object, true)
const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //겹치는지 확인
//겹치면 안됨
@ -3716,6 +3731,12 @@ export function useModuleBasicSetting(tabNum) {
//도머 객체를 가져옴
if (batchObjects) {
batchObjects.forEach((object) => {
// [OPENING-MIN-SIZE 2026-05-08] 0-면적 객체는 turf 변환 시 throw 위험 → skip
const _pts = object.getCurrentPoints?.() || object.points || []
if (_pts.length >= 2 && _pts.every((p) => p.x === _pts[0].x && p.y === _pts[0].y)) {
console.warn('[OPENING-MIN-SIZE 2026-05-08] 0-dim batch object skipped (intersect)', { id: object.id, name: object.name })
return
}
let dormerTurfPolygon
if (object.type === 'group') {

View File

@ -287,6 +287,10 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
}
isDown = false
// [OPENING-COLLAPSE-DIAG 2026-05-08] 치수입력 mouse:up 시점 width/height 0 검출
if (!rect.width || !rect.height) {
console.warn('[OPENING-COLLAPSE-DIAG] dimension-input mouse:up rect collapsed:', { name: objName, w: rect.width, h: rect.height, sx: rect.scaleX, sy: rect.scaleY, left: rect.left, top: rect.top })
}
rect.set({ name: objName, parentId: selectedSurface.id, points: rectToPolygon(rect) })
rect.setCoords()
initEvent()
@ -1430,6 +1434,10 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
addCanvasMouseEventListener('mouse:up', (e) => {
//개구, 그림자 타입일 경우 폴리곤 타입 변경
if (BATCH_TYPE.OPENING === obj.name || BATCH_TYPE.SHADOW === obj.name) {
// [OPENING-COLLAPSE-DIAG 2026-05-08] 객체 이동 mouse:up 시점 width/height 0 검출
if (!obj.width || !obj.height || !obj.scaleX || !obj.scaleY) {
console.warn('[OPENING-COLLAPSE-DIAG] move mouse:up obj collapsed:', { id: obj.id, name: obj.name, w: obj.width, h: obj.height, sx: obj.scaleX, sy: obj.scaleY, left: obj.left, top: obj.top })
}
obj.set({
points: rectToPolygon(obj),
})
@ -1532,6 +1540,10 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
addCanvasMouseEventListener('mouse:up', (e) => {
//개구, 그림자 타입일 경우 폴리곤 타입 변경
if (BATCH_TYPE.OPENING == obj.name || BATCH_TYPE.SHADOW == obj.name) {
// [OPENING-COLLAPSE-DIAG 2026-05-08] 복제 mouse:up 시점 width/height 0 검출
if (!clonedObj.width || !clonedObj.height || !clonedObj.scaleX || !clonedObj.scaleY) {
console.warn('[OPENING-COLLAPSE-DIAG] copy mouse:up clonedObj collapsed:', { name: obj.name, w: clonedObj.width, h: clonedObj.height, sx: clonedObj.scaleX, sy: clonedObj.scaleY, left: clonedObj.left, top: clonedObj.top })
}
clonedObj.set({
points: rectToPolygon(clonedObj),
})