오브젝트 배치 리사이즈 수정 및 그림자 자유 모드
This commit is contained in:
parent
d84a386856
commit
9a023e3b76
@ -33,9 +33,9 @@ export default function SizeSetting(props) {
|
|||||||
const height = heightRef.current.value
|
const height = heightRef.current.value
|
||||||
|
|
||||||
if (target.name === BATCH_TYPE.OPENING || target.name === BATCH_TYPE.SHADOW) {
|
if (target.name === BATCH_TYPE.OPENING || target.name === BATCH_TYPE.SHADOW) {
|
||||||
resizeObjectBatch(settingTarget, target, width, height)
|
resizeObjectBatch(settingTarget, target, width, height, id)
|
||||||
} else if (target.name === POLYGON_TYPE.ROOF) {
|
} else if (target.name === POLYGON_TYPE.ROOF) {
|
||||||
resizeSurfaceShapeBatch(settingTarget, target, width, height)
|
resizeSurfaceShapeBatch(settingTarget, target, width, height, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ export default function SizeSetting(props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid-btn-wrap">
|
<div className="grid-btn-wrap">
|
||||||
<button className="btn-frame modal act" onClick={() => handleReSizeObject()}>
|
<button className="btn-frame modal act" onClick={() => handleReSizeObject(id)}>
|
||||||
{getMessage('write')}
|
{getMessage('write')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import { v4 as uuidv4 } from 'uuid'
|
|||||||
import { fontSelector } from '@/store/fontAtom'
|
import { fontSelector } from '@/store/fontAtom'
|
||||||
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
||||||
import { roofDisplaySelector } from '@/store/settingAtom'
|
import { roofDisplaySelector } from '@/store/settingAtom'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
export function useObjectBatch({ isHidden, setIsHidden }) {
|
export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -33,6 +34,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
const { setSurfaceShapePattern } = useRoofFn()
|
const { setSurfaceShapePattern } = useRoofFn()
|
||||||
const lengthTextFont = useRecoilValue(fontSelector('lengthText'))
|
const lengthTextFont = useRecoilValue(fontSelector('lengthText'))
|
||||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||||
|
const { closePopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
@ -160,12 +162,15 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
const rectPolygon = pointsToTurfPolygon(rectToPolygon(rect))
|
const rectPolygon = pointsToTurfPolygon(rectToPolygon(rect))
|
||||||
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
|
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
|
||||||
|
|
||||||
//지붕 밖으로 그렸을때
|
//그림자는 배치면이 겹친부분에도 그려져야 한다
|
||||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
if (rect.name === BATCH_TYPE.OPENING_TEMP) {
|
||||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
//지붕 밖으로 그렸을때
|
||||||
//일단 지워
|
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||||
deleteTempObjects()
|
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||||
return
|
//일단 지워
|
||||||
|
deleteTempObjects()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCrossChecked) {
|
if (!isCrossChecked) {
|
||||||
@ -242,12 +247,15 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
const rectPolygon = pointsToTurfPolygon(rectToPolygon(rect))
|
const rectPolygon = pointsToTurfPolygon(rectToPolygon(rect))
|
||||||
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
|
const selectedSurfacePolygon = polygonToTurfPolygon(selectedSurface)
|
||||||
|
|
||||||
//지붕 밖으로 그렸을때
|
//그림자는 배치면이 겹친부분에도 그려져야 한다
|
||||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
if (rect.name === BATCH_TYPE.OPENING_TEMP) {
|
||||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
//지붕 밖으로 그렸을때
|
||||||
//일단 지워
|
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||||
deleteTempObjects()
|
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||||
return
|
//일단 지워
|
||||||
|
deleteTempObjects()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCrossChecked) {
|
if (!isCrossChecked) {
|
||||||
@ -1269,7 +1277,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
return { leftPoints, rightPoints, groupPoints }
|
return { leftPoints, rightPoints, groupPoints }
|
||||||
}
|
}
|
||||||
|
|
||||||
const resizeObjectBatch = (side, target, width, height) => {
|
const resizeObjectBatch = (side, target, width, height, popupId) => {
|
||||||
const objectWidth = target.width
|
const objectWidth = target.width
|
||||||
const objectHeight = target.height
|
const objectHeight = target.height
|
||||||
|
|
||||||
@ -1318,6 +1326,10 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
originY: target.originY,
|
originY: target.originY,
|
||||||
left: changedCoords.x,
|
left: changedCoords.x,
|
||||||
top: changedCoords.y,
|
top: changedCoords.y,
|
||||||
|
height: toFixedWithoutRounding(height / 10, 1),
|
||||||
|
width: toFixedWithoutRounding(width / 10, 1),
|
||||||
|
scaleX: 1,
|
||||||
|
scaleY: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
// target.setCoords()
|
// target.setCoords()
|
||||||
@ -1327,6 +1339,8 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
target.points = currentPoints
|
target.points = currentPoints
|
||||||
|
|
||||||
if (target.type === 'group') reGroupObject(target)
|
if (target.type === 'group') reGroupObject(target)
|
||||||
|
|
||||||
|
closePopup(popupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const reGroupObject = (groupObj) => {
|
const reGroupObject = (groupObj) => {
|
||||||
@ -1402,21 +1416,30 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
|||||||
points: rectToPolygon(obj),
|
points: rectToPolygon(obj),
|
||||||
})
|
})
|
||||||
|
|
||||||
const turfObject = pointsToTurfPolygon(obj.points)
|
//그림자는 아무데나 설치 할 수 있게 해달라고 함
|
||||||
|
if (obj.name === BATCH_TYPE.OPENING) {
|
||||||
|
const turfObject = pointsToTurfPolygon(obj.points)
|
||||||
|
|
||||||
if (turf.booleanWithin(turfObject, turfSurface)) {
|
if (turf.booleanWithin(turfObject, turfSurface)) {
|
||||||
|
obj.set({
|
||||||
|
lockMovementX: true,
|
||||||
|
lockMovementY: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
obj.setCoords()
|
||||||
|
} else {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('batch.object.outside.roof'),
|
||||||
|
icon: 'warning',
|
||||||
|
})
|
||||||
|
obj.set({ ...originObj, lockMovementX: true, lockMovementY: true })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
obj.set({
|
obj.set({
|
||||||
lockMovementX: true,
|
lockMovementX: true,
|
||||||
lockMovementY: true,
|
lockMovementY: true,
|
||||||
})
|
})
|
||||||
|
obj.bringToFront()
|
||||||
obj.setCoords()
|
|
||||||
} else {
|
|
||||||
swalFire({
|
|
||||||
title: getMessage('batch.object.outside.roof'),
|
|
||||||
icon: 'warning',
|
|
||||||
})
|
|
||||||
obj.set({ ...originObj, lockMovementX: true, lockMovementY: true })
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
obj.set({
|
obj.set({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user