contextmenu 모듈 기능 구현 중
This commit is contained in:
parent
d80368d3a9
commit
28fa156bdb
@ -112,6 +112,7 @@ export const POLYGON_TYPE = {
|
|||||||
WALL: 'wall',
|
WALL: 'wall',
|
||||||
TRESTLE: 'trestle',
|
TRESTLE: 'trestle',
|
||||||
MODULE_SETUP_SURFACE: 'moduleSetupSurface',
|
MODULE_SETUP_SURFACE: 'moduleSetupSurface',
|
||||||
|
MODULE: 'module',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SAVE_KEY = [
|
export const SAVE_KEY = [
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export default function Eaves({ pitchRef, offsetRef, widthRef, radioTypeRef, pit
|
|||||||
{getMessage('slope')}
|
{getMessage('slope')}
|
||||||
</span>
|
</span>
|
||||||
<div className="input-grid mr5" style={{ width: '100px' }}>
|
<div className="input-grid mr5" style={{ width: '100px' }}>
|
||||||
<input type="number" className="input-origin block" defaultValue={currentAngleType === ANGLE_TYPE.SLOPE ? 4 : 21.8} ref={pitchRef} />
|
<input type="text" className="input-origin block" defaultValue={currentAngleType === ANGLE_TYPE.SLOPE ? 4 : 21.8} ref={pitchRef} />
|
||||||
</div>
|
</div>
|
||||||
<span className="thin">{pitchText}</span>
|
<span className="thin">{pitchText}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -29,7 +29,7 @@ export default function Eaves({ pitchRef, offsetRef, widthRef, radioTypeRef, pit
|
|||||||
{getMessage('offset')}
|
{getMessage('offset')}
|
||||||
</span>
|
</span>
|
||||||
<div className="input-grid mr5" style={{ width: '100px' }}>
|
<div className="input-grid mr5" style={{ width: '100px' }}>
|
||||||
<input type="number" className="input-origin block" defaultValue={500} ref={offsetRef} />
|
<input type="text" className="input-origin block" defaultValue={500} ref={offsetRef} />
|
||||||
</div>
|
</div>
|
||||||
<span className="thin">mm</span>
|
<span className="thin">mm</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -72,7 +72,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
width: roofRef.width.current?.value,
|
width: roofRef.width.current?.value,
|
||||||
length: roofRef.length.current?.value,
|
length: roofRef.length.current?.value,
|
||||||
hajebichi: roofRef.hajebichi.current?.value,
|
hajebichi: roofRef.hajebichi.current?.value,
|
||||||
raft: roofRef.rafter.current?.value,
|
// raft: roofRef.rafter.current?.value,
|
||||||
selected: true,
|
selected: true,
|
||||||
layout: roofLayout,
|
layout: roofLayout,
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
const addedRoofs = []
|
const addedRoofs = []
|
||||||
addedRoofs.push(roofInfo)
|
addedRoofs.push(roofInfo)
|
||||||
|
|
||||||
setBasicSettings({
|
console.log('save Info', {
|
||||||
...basicSetting,
|
...basicSetting,
|
||||||
selectedRoofMaterial: {
|
selectedRoofMaterial: {
|
||||||
// 선택된 지붕재 정보
|
// 선택된 지붕재 정보
|
||||||
@ -88,6 +88,14 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
},
|
},
|
||||||
roofs: addedRoofs,
|
roofs: addedRoofs,
|
||||||
})
|
})
|
||||||
|
setBasicSettings({
|
||||||
|
...basicSetting,
|
||||||
|
selectedRoofMaterial: {
|
||||||
|
// 선택된 지붕재 정보
|
||||||
|
...roofInfo,
|
||||||
|
},
|
||||||
|
roofs: addedRoofs,
|
||||||
|
})
|
||||||
basicSettingSave()
|
basicSettingSave()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +285,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
options={raftCodes.map((raft, index) => {
|
options={raftCodes.map((raft, index) => {
|
||||||
return { ...raft, name: globalLocale === 'ko' ? raft.clCodeNm : raft.clCodeNmJp }
|
return { ...raft, name: globalLocale === 'ko' ? raft.clCodeNm : raft.clCodeNmJp }
|
||||||
})}
|
})}
|
||||||
value={currentRoofMaterial}
|
value={raftCodes.find((r) => r.clCode === currentRoofMaterial.raftBaseCd)}
|
||||||
onChange={(e) => handleRafterChange(e.clCode)}
|
onChange={(e) => handleRafterChange(e.clCode)}
|
||||||
/>
|
/>
|
||||||
{/* <select className="select-light dark" name="roofGap" ref={roofRef.rafter}>
|
{/* <select className="select-light dark" name="roofGap" ref={roofRef.rafter}>
|
||||||
|
|||||||
@ -33,7 +33,7 @@ export default function RoofAllocationSetting(props) {
|
|||||||
const globalLocale = useRecoilValue(globalLocaleStore)
|
const globalLocale = useRecoilValue(globalLocaleStore)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const raftCodeList = findCommonCode('203800')
|
const raftCodeList = findCommonCode('203800')
|
||||||
setRaftCodes(raftCodeList.map((raft) => ({ ...raft, value: raft.clCode, name: raft.clCodeNm })))
|
setRaftCodes(raftCodeList.map((raft) => ({ ...raft, name: raft.clCodeNm })))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -52,9 +52,10 @@ export default function RoofAllocationSetting(props) {
|
|||||||
<div className="grid-select">
|
<div className="grid-select">
|
||||||
<QSelectBox
|
<QSelectBox
|
||||||
options={roofMaterials}
|
options={roofMaterials}
|
||||||
|
value={roofMaterials[0]}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const selected = roofMaterials.find((roofMaterial) => roofMaterial.roofMatlCd === e.id)
|
// const selected = roofMaterials.find((roofMaterial) => roofMaterial.roofMatlCd === e.id)
|
||||||
setCurrentRoofMaterial(selected)
|
setCurrentRoofMaterial(e)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -122,10 +123,7 @@ export default function RoofAllocationSetting(props) {
|
|||||||
<div className="flex-ment">
|
<div className="flex-ment">
|
||||||
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
||||||
<div className="grid-select" style={{ width: '160px' }}>
|
<div className="grid-select" style={{ width: '160px' }}>
|
||||||
<QSelectBox
|
<QSelectBox options={raftCodes} value={raftCodes.find((r) => r.clCode === roof.raftBaseCd)} />
|
||||||
options={raftCodes.map((raft) => ({ ...raft, name: globalLocale === 'ko' ? raft.clCodeNm : raft.clCodeNmJp }))}
|
|
||||||
value={raftCodes.find((r) => r.id === roof.id)}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -117,16 +117,18 @@ export function useRoofAllocationSetting(id) {
|
|||||||
let result = false
|
let result = false
|
||||||
|
|
||||||
roofBases.forEach((roof) => {
|
roofBases.forEach((roof) => {
|
||||||
roof.innerLines.forEach((line) => {
|
if (roof.separatePolygon.length === 0) {
|
||||||
if (!line.attributes.actualSize || line.attributes?.actualSize === 0) {
|
roof.innerLines.forEach((line) => {
|
||||||
line.set({
|
if (!line.attributes.actualSize || line.attributes?.actualSize === 0) {
|
||||||
strokeWidth: 4,
|
line.set({
|
||||||
stroke: 'black',
|
strokeWidth: 4,
|
||||||
selectable: true,
|
stroke: 'black',
|
||||||
})
|
selectable: true,
|
||||||
result = true
|
})
|
||||||
}
|
result = true
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if (result) canvas?.renderAll()
|
if (result) canvas?.renderAll()
|
||||||
|
|
||||||
|
|||||||
@ -620,12 +620,12 @@ export function useContextMenu() {
|
|||||||
{
|
{
|
||||||
id: 'columnMove',
|
id: 'columnMove',
|
||||||
name: getMessage('contextmenu.column.move'),
|
name: getMessage('contextmenu.column.move'),
|
||||||
component: <PanelEdit id={popupId} type={'move'} />,
|
component: <PanelEdit id={popupId} type={'columnMove'} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'columnCopy',
|
id: 'columnCopy',
|
||||||
name: getMessage('contextmenu.column.copy'),
|
name: getMessage('contextmenu.column.copy'),
|
||||||
component: <PanelEdit id={popupId} type={'copy'} />,
|
component: <PanelEdit id={popupId} type={'columnCopy'} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'columnRemove',
|
id: 'columnRemove',
|
||||||
@ -642,12 +642,12 @@ export function useContextMenu() {
|
|||||||
{
|
{
|
||||||
id: 'rowMove',
|
id: 'rowMove',
|
||||||
name: getMessage('contextmenu.row.move'),
|
name: getMessage('contextmenu.row.move'),
|
||||||
component: <PanelEdit id={popupId} type={'move'} />,
|
component: <PanelEdit id={popupId} type={'rowMove'} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rowCopy',
|
id: 'rowCopy',
|
||||||
name: getMessage('contextmenu.row.copy'),
|
name: getMessage('contextmenu.row.copy'),
|
||||||
component: <PanelEdit id={popupId} type={'copy'} />,
|
component: <PanelEdit id={popupId} type={'rowCopy'} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rowRemove',
|
id: 'rowRemove',
|
||||||
|
|||||||
@ -751,6 +751,10 @@ export const pointsToTurfPolygon = (points) => {
|
|||||||
return turf.polygon([coordinates])
|
return turf.polygon([coordinates])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isOverlap(polygon1, polygon2) {
|
||||||
|
return turf.booleanOverlap(polygon1, polygon2)
|
||||||
|
}
|
||||||
|
|
||||||
export const triangleToPolygon = (triangle) => {
|
export const triangleToPolygon = (triangle) => {
|
||||||
const points = []
|
const points = []
|
||||||
const halfWidth = triangle.width / 2
|
const halfWidth = triangle.width / 2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user