dev #827
@ -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) {
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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),
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user