popupManager canvasSetting 적용
This commit is contained in:
parent
15af4655a3
commit
d6fbea705f
@ -2,20 +2,30 @@ import WithDraggable from '@/components/common/draggable/WithDraggable'
|
|||||||
import ColorPicker from '@/components/common/color-picker/ColorPicker'
|
import ColorPicker from '@/components/common/color-picker/ColorPicker'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
export default function ColorPickerModal(props) {
|
export default function ColorPickerModal(props) {
|
||||||
const { isShow, setIsShow, pos = { x: 800, y: -950 }, color = '#ff0000', setColor } = props
|
const { isShow, setIsShow, pos = { x: 770, y: -815 }, color = '#ff0000', setColor, id } = props
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [originColor, setOriginColor] = useState(color)
|
const [originColor, setOriginColor] = useState(color)
|
||||||
|
const { closePopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOriginColor(color)
|
setOriginColor(color)
|
||||||
}, [isShow])
|
}, [isShow])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={isShow} pos={pos}>
|
<WithDraggable isShow={true} pos={pos}>
|
||||||
<div className={`modal-pop-wrap lr`}>
|
<div className={`modal-pop-wrap lr`}>
|
||||||
<div className="modal-head">
|
<div className="modal-head">
|
||||||
<h1 className="title">{getMessage('modal.color.picker.title')}</h1>
|
<h1 className="title">{getMessage('modal.color.picker.title')}</h1>
|
||||||
<button className="modal-close" onClick={() => setIsShow(false)}>
|
<button
|
||||||
|
className="modal-close"
|
||||||
|
onClick={() => {
|
||||||
|
setIsShow(false)
|
||||||
|
closePopup(id)
|
||||||
|
}}
|
||||||
|
>
|
||||||
닫기
|
닫기
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -32,6 +42,7 @@ export default function ColorPickerModal(props) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setColor(originColor)
|
setColor(originColor)
|
||||||
setIsShow(false)
|
setIsShow(false)
|
||||||
|
closePopup(id)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getMessage('common.message.save')}
|
{getMessage('common.message.save')}
|
||||||
|
|||||||
@ -1,20 +1,23 @@
|
|||||||
import WithDraggable from '@/components/common/draggable/withDraggable'
|
import WithDraggable from '@/components/common/draggable/withDraggable'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
const SelectOption = [{ name: '原寸' }, { name: '原寸' }, { name: '原寸' }, { name: '原寸' }]
|
const SelectOption = [{ name: '原寸' }, { name: '原寸' }, { name: '原寸' }, { name: '原寸' }]
|
||||||
export default function FontSetting(props) {
|
export default function FontSetting(props) {
|
||||||
const { setShowFontSettingModal } = props
|
const { id, setShowFontSettingModal } = props
|
||||||
console.log(
|
const { closePopup } = usePopup()
|
||||||
Array.from({ length: 10 }).map((_, index) => {
|
|
||||||
return { name: 5 + index }
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={true} pos={{ x: 800, y: -950 }}>
|
<WithDraggable isShow={true} pos={{ x: 820, y: -815 }}>
|
||||||
<div className={`modal-pop-wrap r`}>
|
<div className={`modal-pop-wrap r`}>
|
||||||
<div className="modal-head">
|
<div className="modal-head">
|
||||||
<h1 className="title">フォント </h1>
|
<h1 className="title">フォント </h1>
|
||||||
<button className="modal-close" onClick={() => setShowFontSettingModal(false)}>
|
<button
|
||||||
|
className="modal-close"
|
||||||
|
onClick={() => {
|
||||||
|
setShowFontSettingModal(false)
|
||||||
|
closePopup(id)
|
||||||
|
}}
|
||||||
|
>
|
||||||
닫기
|
닫기
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
|||||||
|
|
||||||
import MenuDepth01 from './MenuDepth01'
|
import MenuDepth01 from './MenuDepth01'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { usePlan } from '@/hooks/usePlan'
|
import { usePlan } from '@/hooks/usePlan'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
@ -157,6 +157,11 @@ export default function CanvasMenu(props) {
|
|||||||
// canvas.renderAll()
|
// canvas.renderAll()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
const handlePopup = () => {
|
||||||
|
const id = uuidv4()
|
||||||
|
addPopup(id, 1, <SettingModal01 id={id} />)
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (globalLocale === 'ko') {
|
if (globalLocale === 'ko') {
|
||||||
setAppMessageState(KO)
|
setAppMessageState(KO)
|
||||||
@ -203,7 +208,7 @@ export default function CanvasMenu(props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="btn-from">
|
<div className="btn-from">
|
||||||
{/*<button className="btn04" onClick={() => setShowCanvasSettingModal(true)}></button>*/}
|
{/*<button className="btn04" onClick={() => setShowCanvasSettingModal(true)}></button>*/}
|
||||||
<button className="btn04" onClick={() => addPopup(<SettingModal01 />)}></button>
|
<button className="btn04" onClick={handlePopup}></button>
|
||||||
<button className="btn05"></button>
|
<button className="btn05"></button>
|
||||||
<button className="btn06"></button>
|
<button className="btn06"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { settingModalFirstOptionsState, settingModalGridOptionsState, settingMod
|
|||||||
import '@/styles/contents.scss'
|
import '@/styles/contents.scss'
|
||||||
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
||||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||||
import DotLineGrid from '@/components/floor-plan/modal/grid/DotLineGrid'
|
|
||||||
import WallLineSetting from '@/components/floor-plan/modal/outerlinesetting/WallLineSetting'
|
import WallLineSetting from '@/components/floor-plan/modal/outerlinesetting/WallLineSetting'
|
||||||
import PropertiesSetting from '@/components/floor-plan/modal/outerlinesetting/PropertiesSetting'
|
import PropertiesSetting from '@/components/floor-plan/modal/outerlinesetting/PropertiesSetting'
|
||||||
import PlacementShapeSetting from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
import PlacementShapeSetting from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
||||||
@ -26,7 +25,6 @@ import MovementSetting from '@/components/floor-plan/modal/movement/MovementSett
|
|||||||
import RoofAllocationSetting from '@/components/floor-plan/modal/roofAllocation/RoofAllocationSetting'
|
import RoofAllocationSetting from '@/components/floor-plan/modal/roofAllocation/RoofAllocationSetting'
|
||||||
import BasicSetting from '@/components/floor-plan/modal/basic/BasicSetting'
|
import BasicSetting from '@/components/floor-plan/modal/basic/BasicSetting'
|
||||||
import CircuitTrestleSetting from '@/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting'
|
import CircuitTrestleSetting from '@/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting'
|
||||||
import FontSetting from '@/components/common/font/FontSetting'
|
|
||||||
import { gridColorState } from '@/store/gridAtom'
|
import { gridColorState } from '@/store/gridAtom'
|
||||||
|
|
||||||
export default function FloorPlan() {
|
export default function FloorPlan() {
|
||||||
@ -54,20 +52,10 @@ export default function FloorPlan() {
|
|||||||
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
||||||
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
||||||
|
|
||||||
const [showDotLineGridModal, setShowDotLineGridModal] = useState(false)
|
|
||||||
const [showGridCopyModal, setShowGridCopyModal] = useState(false)
|
const [showGridCopyModal, setShowGridCopyModal] = useState(false)
|
||||||
const [showGridMoveModal, setShowGridMoveModal] = useState(false)
|
const [showGridMoveModal, setShowGridMoveModal] = useState(false)
|
||||||
const [showColorPickerModal, setShowColorPickerModal] = useState(false)
|
|
||||||
const [color, setColor] = useRecoilState(gridColorState)
|
const [color, setColor] = useRecoilState(gridColorState)
|
||||||
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
||||||
const [showFontSettingModal, setShowFontSettingModal] = useState(false)
|
|
||||||
|
|
||||||
const canvasSettingProps = {
|
|
||||||
setShowCanvasSettingModal,
|
|
||||||
setShowDotLineGridModal,
|
|
||||||
setShowColorPickerModal,
|
|
||||||
setShowFontSettingModal,
|
|
||||||
}
|
|
||||||
|
|
||||||
const outlineProps = {
|
const outlineProps = {
|
||||||
setShowOutlineModal,
|
setShowOutlineModal,
|
||||||
@ -125,17 +113,6 @@ export default function FloorPlan() {
|
|||||||
console.error('Data fetching error:', error)
|
console.error('Data fetching error:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const dotLineProps = {
|
|
||||||
showDotLineGridModal,
|
|
||||||
setShowDotLineGridModal,
|
|
||||||
}
|
|
||||||
|
|
||||||
const gridColorProps = {
|
|
||||||
setShowColorPickerModal,
|
|
||||||
color,
|
|
||||||
setColor,
|
|
||||||
setSettingModalGridOptions,
|
|
||||||
}
|
|
||||||
|
|
||||||
const propertiesSettingProps = {
|
const propertiesSettingProps = {
|
||||||
setShowPropertiesSettingModal,
|
setShowPropertiesSettingModal,
|
||||||
@ -149,13 +126,8 @@ export default function FloorPlan() {
|
|||||||
<CanvasMenu {...modalProps} />
|
<CanvasMenu {...modalProps} />
|
||||||
<div className="canvas-content">
|
<div className="canvas-content">
|
||||||
<CanvasLayout />
|
<CanvasLayout />
|
||||||
{/*{showCanvasSettingModal && <SettingModal01 {...canvasSettingProps} />}*/}
|
|
||||||
{showOutlineModal && <WallLineSetting {...outlineProps} />}
|
{showOutlineModal && <WallLineSetting {...outlineProps} />}
|
||||||
{showDotLineGridModal && <DotLineGrid {...dotLineProps} />}
|
|
||||||
{/*{showColorPickerModal && <GridColorSetting {...gridColorProps} />}*/}
|
|
||||||
{showFontSettingModal && <FontSetting setShowFontSettingModal={setShowFontSettingModal} />}
|
|
||||||
{showPropertiesSettingModal && <PropertiesSetting {...propertiesSettingProps} />}
|
{showPropertiesSettingModal && <PropertiesSetting {...propertiesSettingProps} />}
|
||||||
{/*<DimensionLineSetting setShowFontSettingModal={setShowFontSettingModal} setShowColorPickerModal={setShowColorPickerModal} />*/}
|
|
||||||
{showPlaceShapeModal && <PlacementShapeSetting setShowPlaceShapeModal={setShowPlaceShapeModal} />}
|
{showPlaceShapeModal && <PlacementShapeSetting setShowPlaceShapeModal={setShowPlaceShapeModal} />}
|
||||||
{showRoofShapeSettingModal && <RoofShapeSetting setShowRoofShapeSettingModal={setShowRoofShapeSettingModal} />}
|
{showRoofShapeSettingModal && <RoofShapeSetting setShowRoofShapeSettingModal={setShowRoofShapeSettingModal} />}
|
||||||
{showRoofShapePassivitySettingModal && (
|
{showRoofShapePassivitySettingModal && (
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { gridColorState } from '@/store/gridAtom'
|
|||||||
import { settingModalGridOptionsState } from '@/store/settingAtom'
|
import { settingModalGridOptionsState } from '@/store/settingAtom'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
const TYPE = {
|
const TYPE = {
|
||||||
DOT: 'DOT',
|
DOT: 'DOT',
|
||||||
@ -20,7 +21,7 @@ export default function DotLineGrid(props) {
|
|||||||
// const [modalOption, setModalOption] = useRecoilState(modalState); //modal 열림닫힘 state
|
// const [modalOption, setModalOption] = useRecoilState(modalState); //modal 열림닫힘 state
|
||||||
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
||||||
const [close, setClose] = useState(false)
|
const [close, setClose] = useState(false)
|
||||||
const { setShowDotLineGridModal } = props
|
const { id, setShowDotLineGridModal } = props
|
||||||
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
||||||
const gridColor = useRecoilValue(gridColorState)
|
const gridColor = useRecoilValue(gridColorState)
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -32,6 +33,7 @@ export default function DotLineGrid(props) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, post } = useAxios()
|
const { get, post } = useAxios()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const { closePopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
@ -243,6 +245,8 @@ export default function DotLineGrid(props) {
|
|||||||
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
})
|
})
|
||||||
|
setShowDotLineGridModal(false)
|
||||||
|
closePopup(id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
swalFire({ text: getMessage(res.returnMessage), icon: 'error' })
|
swalFire({ text: getMessage(res.returnMessage), icon: 'error' })
|
||||||
}
|
}
|
||||||
@ -303,11 +307,17 @@ export default function DotLineGrid(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={true} pos={{ x: 1300, y: -660 }}>
|
<WithDraggable isShow={true} pos={{ x: 840, y: -815 }}>
|
||||||
<div className={`modal-pop-wrap ssm mount`}>
|
<div className={`modal-pop-wrap ssm mount`}>
|
||||||
<div className="modal-head">
|
<div className="modal-head">
|
||||||
<h1 className="title">{getMessage('modal.canvas.setting.grid.dot.line.setting')}</h1>
|
<h1 className="title">{getMessage('modal.canvas.setting.grid.dot.line.setting')}</h1>
|
||||||
<button className="modal-close" onClick={() => setShowDotLineGridModal(false)}>
|
<button
|
||||||
|
className="modal-close"
|
||||||
|
onClick={() => {
|
||||||
|
setShowDotLineGridModal(false)
|
||||||
|
closePopup(id)
|
||||||
|
}}
|
||||||
|
>
|
||||||
닫기
|
닫기
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -7,9 +7,11 @@ import { useTempGrid } from '@/hooks/useTempGrid'
|
|||||||
import { gridColorState } from '@/store/gridAtom'
|
import { gridColorState } from '@/store/gridAtom'
|
||||||
import { useColor } from 'react-color-palette'
|
import { useColor } from 'react-color-palette'
|
||||||
import ColorPickerModal from '@/components/common/color-picker/ColorPickerModal'
|
import ColorPickerModal from '@/components/common/color-picker/ColorPickerModal'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import DotLineGrid from '@/components/floor-plan/modal/grid/DotLineGrid'
|
||||||
|
|
||||||
export default function GridOption(props) {
|
export default function GridOption(props) {
|
||||||
const { setShowDotLineGridModal } = props
|
|
||||||
const [gridOptions, setGridOptions] = useRecoilState(settingModalGridOptionsState)
|
const [gridOptions, setGridOptions] = useRecoilState(settingModalGridOptionsState)
|
||||||
const [adsorptionPointAddMode, setAdsorptionPointAddMode] = useRecoilState(adsorptionPointAddModeState)
|
const [adsorptionPointAddMode, setAdsorptionPointAddMode] = useRecoilState(adsorptionPointAddModeState)
|
||||||
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
||||||
@ -18,6 +20,8 @@ export default function GridOption(props) {
|
|||||||
const [gridColor, setGridColor] = useRecoilState(gridColorState)
|
const [gridColor, setGridColor] = useRecoilState(gridColorState)
|
||||||
const [color, setColor] = useColor(gridColor)
|
const [color, setColor] = useColor(gridColor)
|
||||||
const [showColorPickerModal, setShowColorPickerModal] = useState(false)
|
const [showColorPickerModal, setShowColorPickerModal] = useState(false)
|
||||||
|
const [showDotLineGridModal, setShowDotLineGridModal] = useState(false)
|
||||||
|
const { addPopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('GridOption useEffect 실행')
|
console.log('GridOption useEffect 실행')
|
||||||
@ -26,6 +30,7 @@ export default function GridOption(props) {
|
|||||||
}, [color])
|
}, [color])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(showColorPickerModal)
|
||||||
gridOptions[3].selected = showColorPickerModal
|
gridOptions[3].selected = showColorPickerModal
|
||||||
setGridOptions([...gridOptions])
|
setGridOptions([...gridOptions])
|
||||||
}, [showColorPickerModal])
|
}, [showColorPickerModal])
|
||||||
@ -42,6 +47,7 @@ export default function GridOption(props) {
|
|||||||
|
|
||||||
const onClickOption = (option) => {
|
const onClickOption = (option) => {
|
||||||
const newGridOptions = [...gridOptions]
|
const newGridOptions = [...gridOptions]
|
||||||
|
const id = uuidv4()
|
||||||
newGridOptions.map((item) => {
|
newGridOptions.map((item) => {
|
||||||
if (item.id === option.id) {
|
if (item.id === option.id) {
|
||||||
item.selected = !item.selected
|
item.selected = !item.selected
|
||||||
@ -59,6 +65,7 @@ export default function GridOption(props) {
|
|||||||
// 점.선 그리드
|
// 점.선 그리드
|
||||||
if (option.selected) {
|
if (option.selected) {
|
||||||
setShowDotLineGridModal(true)
|
setShowDotLineGridModal(true)
|
||||||
|
addPopup(id, 2, <DotLineGrid setShowDotLineGridModal={setShowDotLineGridModal} id={id} />)
|
||||||
} else {
|
} else {
|
||||||
setShowDotLineGridModal(false)
|
setShowDotLineGridModal(false)
|
||||||
}
|
}
|
||||||
@ -75,6 +82,7 @@ export default function GridOption(props) {
|
|||||||
console.log(option)
|
console.log(option)
|
||||||
if (option.selected) {
|
if (option.selected) {
|
||||||
setShowColorPickerModal(true)
|
setShowColorPickerModal(true)
|
||||||
|
addPopup(id, 2, <ColorPickerModal {...colorPickerProps} id={id} />)
|
||||||
} else {
|
} else {
|
||||||
setShowColorPickerModal(false)
|
setShowColorPickerModal(false)
|
||||||
}
|
}
|
||||||
@ -88,10 +96,6 @@ export default function GridOption(props) {
|
|||||||
setColor: setGridColor,
|
setColor: setGridColor,
|
||||||
isShow: showColorPickerModal,
|
isShow: showColorPickerModal,
|
||||||
setIsShow: setShowColorPickerModal,
|
setIsShow: setShowColorPickerModal,
|
||||||
pos: {
|
|
||||||
x: -515,
|
|
||||||
y: -214,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -107,7 +111,7 @@ export default function GridOption(props) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ColorPickerModal {...colorPickerProps} />
|
{/*<ColorPickerModal {...colorPickerProps} />*/}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,11 @@ import { useAxios } from '@/hooks/useAxios'
|
|||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { adsorptionPointModeState, adsorptionRangeState } from '@/store/canvasAtom'
|
import { adsorptionPointModeState, adsorptionRangeState } from '@/store/canvasAtom'
|
||||||
import DimensionLineSetting from '@/components/floor-plan/modal/setting01/dimensionLine/DimensionLineSetting'
|
import DimensionLineSetting from '@/components/floor-plan/modal/setting01/dimensionLine/DimensionLineSetting'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import FontSetting from '@/components/common/font/FontSetting'
|
||||||
|
|
||||||
export default function SecondOption({ setShowFontSettingModal }) {
|
export default function SecondOption() {
|
||||||
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
||||||
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
||||||
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
||||||
@ -19,15 +22,9 @@ export default function SecondOption({ setShowFontSettingModal }) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, post } = useAxios()
|
const { get, post } = useAxios()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const { addPopup } = usePopup()
|
||||||
|
const [showFontSettingModal, setShowFontSettingModal] = useState(false)
|
||||||
const [showDimensionLineSettingModal, setShowDimensionLineSettingModal] = useState(false)
|
const [showDimensionLineSettingModal, setShowDimensionLineSettingModal] = useState(false)
|
||||||
const dimensionLineSettingProps = {
|
|
||||||
isShow: showDimensionLineSettingModal,
|
|
||||||
setIsShow: setShowDimensionLineSettingModal,
|
|
||||||
pos: {
|
|
||||||
x: -515,
|
|
||||||
y: -214,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 데이터를 최초 한 번만 조회
|
// 데이터를 최초 한 번만 조회
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -138,6 +135,21 @@ export default function SecondOption({ setShowFontSettingModal }) {
|
|||||||
setAdsorptionRange(option.range)
|
setAdsorptionRange(option.range)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handlePopup = (type) => {
|
||||||
|
const id = uuidv4()
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'dimensionLine':
|
||||||
|
addPopup(id, 2, <DimensionLineSetting id={id} />)
|
||||||
|
break
|
||||||
|
case 'font1': //문자 글꼴변경
|
||||||
|
case 'font2': //흐름 방향 글꼴 변경
|
||||||
|
case 'font3': //치수 글꼴변경
|
||||||
|
case 'font4': //회로번호 글꼴변경
|
||||||
|
addPopup(id, 2, <FontSetting id={id} setShowFontSettingModal={setShowFontSettingModal} />)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="modal-check-btn-wrap">
|
<div className="modal-check-btn-wrap">
|
||||||
@ -145,7 +157,7 @@ export default function SecondOption({ setShowFontSettingModal }) {
|
|||||||
<div className="flex-check-box for2">
|
<div className="flex-check-box for2">
|
||||||
{settingModalSecondOptions &&
|
{settingModalSecondOptions &&
|
||||||
settingModalSecondOptions.option3.map((item) => (
|
settingModalSecondOptions.option3.map((item) => (
|
||||||
<button key={item.id} className="arr-btn" onClick={() => setShowFontSettingModal(true)}>
|
<button key={item.id} className="arr-btn" onClick={() => handlePopup('font' + item.id)}>
|
||||||
<span>{getMessage(item.name)}</span>
|
<span>{getMessage(item.name)}</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
@ -163,7 +175,8 @@ export default function SecondOption({ setShowFontSettingModal }) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-check-box for-line">
|
<div className="flex-check-box for-line">
|
||||||
<button className="arr-btn" onClick={() => setShowDimensionLineSettingModal(true)}>
|
{/*<button className="arr-btn" onClick={() => setShowDimensionLineSettingModal(true)}>*/}
|
||||||
|
<button className="arr-btn" onClick={() => handlePopup('dimensionLine')}>
|
||||||
<span>{getMessage('modal.canvas.setting.font.plan.absorption.dimension.line')}</span>
|
<span>{getMessage('modal.canvas.setting.font.plan.absorption.dimension.line')}</span>
|
||||||
</button>
|
</button>
|
||||||
<button className="arr-btn">
|
<button className="arr-btn">
|
||||||
@ -180,7 +193,6 @@ export default function SecondOption({ setShowFontSettingModal }) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DimensionLineSetting {...dimensionLineSettingProps} />
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,24 +8,26 @@ import { useMessage } from '@/hooks/useMessage'
|
|||||||
import GridOption from '@/components/floor-plan/modal/setting01/GridOption'
|
import GridOption from '@/components/floor-plan/modal/setting01/GridOption'
|
||||||
import { canGridOptionSeletor } from '@/store/canvasAtom'
|
import { canGridOptionSeletor } from '@/store/canvasAtom'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
export default function SettingModal01(props) {
|
export default function SettingModal01(props) {
|
||||||
const { setShowCanvasSettingModal, setShowDotLineGridModal, setShowFontSettingModal } = props
|
const { setShowDotLineGridModal, setShowFontSettingModal, id } = props
|
||||||
|
console.log(props)
|
||||||
const [buttonAct, setButtonAct] = useState(1)
|
const [buttonAct, setButtonAct] = useState(1)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const canGridOptionSeletorValue = useRecoilValue(canGridOptionSeletor)
|
const canGridOptionSeletorValue = useRecoilValue(canGridOptionSeletor)
|
||||||
|
const { addPopup, closePopup } = usePopup()
|
||||||
const handleBtnClick = (num) => {
|
const handleBtnClick = (num) => {
|
||||||
setButtonAct(num)
|
setButtonAct(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WithDraggable isShow={true} pos={{ x: 1300, y: -950 }}>
|
<WithDraggable isShow={true} pos={{ x: 1270, y: -815 }}>
|
||||||
<div className={`modal-pop-wrap sm mount`}>
|
<div className={`modal-pop-wrap sm mount`}>
|
||||||
<div className="modal-head">
|
<div className="modal-head">
|
||||||
<h1 className="title">{getMessage('modal.canvas.setting')}</h1>
|
<h1 className="title">{getMessage('modal.canvas.setting')}</h1>
|
||||||
<button className="modal-close" onClick={() => setShowCanvasSettingModal(false)}>
|
<button className="modal-close" onClick={() => closePopup(id)}>
|
||||||
닫기
|
닫기
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +47,7 @@ export default function SettingModal01(props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{buttonAct === 1 && <FirstOption />}
|
{buttonAct === 1 && <FirstOption />}
|
||||||
{buttonAct === 2 && <SecondOption setShowFontSettingModal={setShowFontSettingModal} />}
|
{buttonAct === 2 && <SecondOption />}
|
||||||
{buttonAct === 3 && <GridOption setShowDotLineGridModal={setShowDotLineGridModal} />}
|
{buttonAct === 3 && <GridOption setShowDotLineGridModal={setShowDotLineGridModal} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,19 +1,22 @@
|
|||||||
import WithDraggable from '@/components/common/draggable/withDraggable'
|
import WithDraggable from '@/components/common/draggable/withDraggable'
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
export default function DimensionLineSetting(props) {
|
export default function DimensionLineSetting(props) {
|
||||||
const { isShow, setIsShow, pos = { x: 800, y: -950 }, setShowFontSettingModal, setShowColorPickerModal } = props
|
const { id, pos = { x: 970, y: -815 }, setShowColorPickerModal } = props
|
||||||
|
console.log(props)
|
||||||
|
const { closePopup } = usePopup()
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={isShow} pos={pos}>
|
<WithDraggable isShow={true} pos={pos}>
|
||||||
<div className={`modal-pop-wrap xxxm`}>
|
<div className={`modal-pop-wrap xxxm`}>
|
||||||
<div className="modal-head">
|
<div className="modal-head">
|
||||||
<h1 className="title">寸法線 設定 </h1>
|
<h1 className="title">寸法線 設定 </h1>
|
||||||
<button className="modal-close">닫기</button>
|
<button className="modal-close" onClick={() => closePopup(id)}>
|
||||||
|
닫기
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="font-btn-wrap">
|
<div className="font-btn-wrap">
|
||||||
<button className="btn-frame modal" onClick={() => setShowFontSettingModal(true)}>
|
<button className="btn-frame modal">フォント設定</button>
|
||||||
フォント設定
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="line-color-wrap">
|
<div className="line-color-wrap">
|
||||||
<div className="outline-form mb10">
|
<div className="outline-form mb10">
|
||||||
|
|||||||
@ -1,20 +1,32 @@
|
|||||||
import { useRecoilState } from 'recoil'
|
import { useRecoilState } from 'recoil'
|
||||||
import { popupState } from '@/store/popupAtom'
|
import { popupState } from '@/store/popupAtom'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
export function usePopup() {
|
export function usePopup() {
|
||||||
const [popup, setPopup] = useRecoilState(popupState)
|
const [popup, setPopup] = useRecoilState(popupState)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(popup)
|
console.log(popup)
|
||||||
}, [popup])
|
}, [popup])
|
||||||
|
|
||||||
const addPopup = (component) => {
|
const addPopup = (id, depth, component) => {
|
||||||
setPopup({ children: [...popup.children, { id: uuidv4(), component: component }] })
|
setPopup({ children: [...filterDepth(depth), { id: id, depth: depth, component: component }] })
|
||||||
}
|
}
|
||||||
|
|
||||||
const closePopup = (id) => {
|
const closePopup = (id) => {
|
||||||
setPopup({ children: popup.children.filter((child) => child.id !== id) })
|
setPopup({ children: [...popup.children.filter((child) => child.id !== id)] })
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeAll = () => {
|
||||||
|
setPopup({ children: [] })
|
||||||
|
}
|
||||||
|
|
||||||
|
const closePrevPopup = () => {
|
||||||
|
setPopup({ children: [...popup.children.slice(popup.children.length - 1)] })
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterDepth = (depth) => {
|
||||||
|
return [...popup.children.filter((child) => child.depth !== depth)]
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -22,5 +34,6 @@ export function usePopup() {
|
|||||||
setPopup,
|
setPopup,
|
||||||
addPopup,
|
addPopup,
|
||||||
closePopup,
|
closePopup,
|
||||||
|
closeAll,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user