grid option 추가
This commit is contained in:
parent
12377b3db7
commit
21e570c8c9
@ -1,6 +1,6 @@
|
|||||||
import Roof2 from '@/components/Roof2'
|
import Roof2 from '@/components/Roof2'
|
||||||
import RoofSelect from '@/app/[locale]/roof2/RoofSelect'
|
|
||||||
import { initCheck } from '@/util/session-util'
|
import { initCheck } from '@/util/session-util'
|
||||||
|
import RoofSelect from '@/app/roof2/RoofSelect'
|
||||||
|
|
||||||
export default async function Roof2Page() {
|
export default async function Roof2Page() {
|
||||||
const session = await initCheck()
|
const session = await initCheck()
|
||||||
|
|||||||
@ -10,7 +10,6 @@ export default function ColorPickerModal(props) {
|
|||||||
const [originColor, setOriginColor] = useState(color)
|
const [originColor, setOriginColor] = useState(color)
|
||||||
const { closePopup } = usePopup()
|
const { closePopup } = usePopup()
|
||||||
|
|
||||||
console.log(props)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOriginColor(color)
|
setOriginColor(color)
|
||||||
}, [isShow])
|
}, [isShow])
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
|||||||
|
|
||||||
export default function CanvasFrame({ plan }) {
|
export default function CanvasFrame({ plan }) {
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
console.log(canvasRef)
|
|
||||||
const { canvas } = useCanvas('canvas')
|
const { canvas } = useCanvas('canvas')
|
||||||
const { handleZoomClear } = useCanvasEvent()
|
const { handleZoomClear } = useCanvasEvent()
|
||||||
const { contextMenu, currentContextMenu, setCurrentContextMenu } = useContextMenu({
|
const { contextMenu, currentContextMenu, setCurrentContextMenu } = useContextMenu({
|
||||||
|
|||||||
@ -15,20 +15,18 @@ import { canvasState, canvasZoomState, currentCanvasPlanState, currentMenuState,
|
|||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { wordDisplaySelector } from '@/store/settingAtom'
|
import { settingModalFirstOptionsState, wordDisplaySelector } from '@/store/settingAtom'
|
||||||
import { MENU } from '@/common/common'
|
import { MENU } from '@/common/common'
|
||||||
|
|
||||||
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
||||||
|
|
||||||
import KO from '@/locales/ko.json'
|
import KO from '@/locales/ko.json'
|
||||||
import JA from '@/locales/ja.json'
|
import JA from '@/locales/ja.json'
|
||||||
import { settingModalFirstOptionsState } from '@/store/settingAtom'
|
|
||||||
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
||||||
import { popupState } from '@/store/popupAtom'
|
import { popupState } from '@/store/popupAtom'
|
||||||
import SettingModal01 from '@/components/floor-plan/modal/setting01/SettingModal01'
|
import SettingModal01 from '@/components/floor-plan/modal/setting01/SettingModal01'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
||||||
import { lineSegment } from '@turf/turf'
|
|
||||||
|
|
||||||
const canvasMenus = [
|
const canvasMenus = [
|
||||||
{ index: 0, name: 'plan.menu.plan.drawing', icon: 'con00', title: MENU.PLAN_DRAWING },
|
{ index: 0, name: 'plan.menu.plan.drawing', icon: 'con00', title: MENU.PLAN_DRAWING },
|
||||||
@ -95,19 +93,7 @@ export default function CanvasMenu(props) {
|
|||||||
const [popup, setPopup] = useRecoilState(popupState)
|
const [popup, setPopup] = useRecoilState(popupState)
|
||||||
|
|
||||||
const SelectOption = [{ name: '瓦53A' }, { name: '瓦53A' }]
|
const SelectOption = [{ name: '瓦53A' }, { name: '瓦53A' }]
|
||||||
useEffect(() => {
|
|
||||||
console.log(canvas)
|
|
||||||
if (canvas) {
|
|
||||||
const circle = new fabric.Circle({
|
|
||||||
left: 300,
|
|
||||||
top: 300,
|
|
||||||
radius: 5,
|
|
||||||
stroke: 'black',
|
|
||||||
})
|
|
||||||
canvas.add(circle)
|
|
||||||
canvas.renderAll()
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
const onClickNav = (menu) => {
|
const onClickNav = (menu) => {
|
||||||
setMenuNumber(menu.index)
|
setMenuNumber(menu.index)
|
||||||
setCurrentMenu(menu.title)
|
setCurrentMenu(menu.title)
|
||||||
|
|||||||
@ -21,17 +21,9 @@ export default function GridOption() {
|
|||||||
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 [showDotLineGridModal, setShowDotLineGridModal] = useState(false)
|
||||||
const { addPopup, closePopup } = usePopup()
|
const { addPopup, closePopup, closePopups } = usePopup()
|
||||||
// const [colorId, setColorId] = useState(uuidv4())
|
const [colorId, setColorId] = useState(uuidv4())
|
||||||
// const [dotLineId, setDotLineId] = useState(uuidv4())
|
const [dotLineId, setDotLineId] = useState(uuidv4())
|
||||||
|
|
||||||
let colorId = null
|
|
||||||
let dotLineId = null
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
colorId = uuidv4()
|
|
||||||
dotLineId = uuidv4()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setGridColor(color.hex)
|
setGridColor(color.hex)
|
||||||
@ -43,7 +35,7 @@ export default function GridOption() {
|
|||||||
}, [showColorPickerModal])
|
}, [showColorPickerModal])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
gridOptions[2].selected = showDotLineGridModal
|
gridOptions[1].selected = showDotLineGridModal
|
||||||
setGridOptions([...gridOptions])
|
setGridOptions([...gridOptions])
|
||||||
}, [showDotLineGridModal])
|
}, [showDotLineGridModal])
|
||||||
|
|
||||||
@ -63,13 +55,11 @@ export default function GridOption() {
|
|||||||
const newGridOptions = [...gridOptions]
|
const newGridOptions = [...gridOptions]
|
||||||
|
|
||||||
// 초기화
|
// 초기화
|
||||||
setShowColorPickerModal(false)
|
// setShowColorPickerModal(false)
|
||||||
setShowDotLineGridModal(false)
|
// setShowDotLineGridModal(false)
|
||||||
setTempGridMode(false)
|
setTempGridMode(false)
|
||||||
setAdsorptionPointAddMode(false)
|
setAdsorptionPointAddMode(false)
|
||||||
closePopup(dotLineId)
|
closePopups([colorId, dotLineId])
|
||||||
closePopup(colorId)
|
|
||||||
//
|
|
||||||
|
|
||||||
newGridOptions.forEach((item) => {
|
newGridOptions.forEach((item) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
@ -78,65 +68,30 @@ export default function GridOption() {
|
|||||||
item.selected = false
|
item.selected = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(colorId, dotLineId)
|
|
||||||
newGridOptions.map((item) => {
|
|
||||||
if (item.id === option.id) {
|
|
||||||
item.selected = !item.selected
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (option.id === 1) {
|
|
||||||
// 점 그리드
|
|
||||||
setAdsorptionPointAddMode(false)
|
|
||||||
setTempGridMode(option.selected)
|
|
||||||
newGridOptions[2].selected = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedOption = newGridOptions.find((item) => item.id === option.id)
|
const selectedOption = newGridOptions.find((item) => item.id === option.id)
|
||||||
if (selectedOption.id === 1) {
|
if (selectedOption.id === 1) {
|
||||||
// 임의 그리드 모드
|
// 임의 그리드 모드
|
||||||
setTempGridMode(selectedOption.selected)
|
// setAdsorptionPointAddMode(false)
|
||||||
|
setTempGridMode(option.selected)
|
||||||
|
// newGridOptions[2].selected = false
|
||||||
} else if (selectedOption.id === 2) {
|
} else if (selectedOption.id === 2) {
|
||||||
// 점 선 그리드 설정 모달
|
// 점 선 그리드 설정 모달
|
||||||
setShowDotLineGridModal(selectedOption.selected)
|
setShowDotLineGridModal(selectedOption.selected)
|
||||||
addPopup(dotLineId, 2, <DotLineGrid setShowDotLineGridModal={setShowDotLineGridModal} id={dotLineId} />)
|
|
||||||
|
addPopup(dotLineId, 2, <DotLineGrid {...dotLineGridProps} />)
|
||||||
} else if (selectedOption.id === 3) {
|
} else if (selectedOption.id === 3) {
|
||||||
// 흡착점 모드
|
// 흡착점 모드
|
||||||
setAdsorptionPointAddMode(selectedOption.selected)
|
setAdsorptionPointAddMode(selectedOption.selected)
|
||||||
} else if (selectedOption.id === 4) {
|
} else if (selectedOption.id === 4) {
|
||||||
// 그리드 색 설정 모달
|
// 그리드 색 설정 모달
|
||||||
setShowColorPickerModal(selectedOption.selected)
|
setShowColorPickerModal(selectedOption.selected)
|
||||||
addPopup(colorId, 2, <ColorPickerModal {...colorPickerProps} id={colorId} />)
|
addPopup(colorId, 2, <ColorPickerModal {...colorPickerProps} />)
|
||||||
if (option.id === 2) {
|
|
||||||
// 점.선 그리드
|
|
||||||
if (option.selected) {
|
|
||||||
addPopup(dotLineId, 2, <DotLineGrid {...dotListGridProps} />)
|
|
||||||
} else {
|
|
||||||
closePopup(dotLineId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.name === 'modal.canvas.setting.grid.absorption.add') {
|
|
||||||
setAdsorptionPointAddMode(!adsorptionPointAddMode)
|
|
||||||
setTempGridMode(false)
|
|
||||||
newGridOptions[0].selected = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.id === 4) {
|
|
||||||
// 그리드 색 설정
|
|
||||||
if (option.selected) {
|
|
||||||
setShowColorPickerModal(true)
|
|
||||||
addPopup(colorId, 2, <ColorPickerModal {...colorPickerProps} />)
|
|
||||||
} else {
|
|
||||||
setShowColorPickerModal(false)
|
|
||||||
closePopup(colorId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setGridOptions(newGridOptions)
|
setGridOptions(newGridOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
const dotListGridProps = {
|
const dotLineGridProps = {
|
||||||
id: dotLineId,
|
id: dotLineId,
|
||||||
setIsShow: setShowDotLineGridModal,
|
setIsShow: setShowDotLineGridModal,
|
||||||
pos: {
|
pos: {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ export function usePopup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const closePopup = (id) => {
|
const closePopup = (id) => {
|
||||||
console.log(id)
|
|
||||||
setPopup({ children: [...popup.children.filter((child) => child.id !== id)] })
|
setPopup({ children: [...popup.children.filter((child) => child.id !== id)] })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user