Compare commits
19 Commits
aafa5f5948
...
4056206af7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4056206af7 | ||
|
|
bddc753e52 | ||
|
|
c464632b1a | ||
| e4d6d3ab0d | |||
| be399a1b52 | |||
|
|
7c25ad0452 | ||
|
|
c869d6c44d | ||
| 1c6071b67c | |||
| fe8723fd8c | |||
|
|
f45862568f | ||
|
|
7d5a235b95 | ||
|
|
0430be1945 | ||
|
|
f1d2cfea5b | ||
| 2e6fef951c | |||
| 2315bb5eca | |||
| 13547f8a2a | |||
| 87e70d51c1 | |||
| daf5ec9ce2 | |||
| 351df68762 |
@ -244,21 +244,10 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
|||||||
const types = []
|
const types = []
|
||||||
this.lines.forEach((line) => types.push(line.attributes.type))
|
this.lines.forEach((line) => types.push(line.attributes.type))
|
||||||
|
|
||||||
const eavesType = [LINE_TYPE.WALLLINE.EAVES, LINE_TYPE.WALLLINE.HIPANDGABLE]
|
|
||||||
const gableType = [LINE_TYPE.WALLLINE.GABLE, LINE_TYPE.WALLLINE.JERKINHEAD]
|
const gableType = [LINE_TYPE.WALLLINE.GABLE, LINE_TYPE.WALLLINE.JERKINHEAD]
|
||||||
|
|
||||||
// const isEaves = types.every((type) => eavesType.includes(type))
|
|
||||||
const gableOdd = types.filter((type, i) => i % 2 === 0)
|
|
||||||
const gableEven = types.filter((type, i) => i % 2 === 1)
|
|
||||||
const hasShed = types.includes(LINE_TYPE.WALLLINE.SHED)
|
const hasShed = types.includes(LINE_TYPE.WALLLINE.SHED)
|
||||||
|
|
||||||
// A형, B형 박공 지붕
|
|
||||||
/* if (
|
|
||||||
(gableOdd.every((type) => type === LINE_TYPE.WALLLINE.EAVES) && gableEven.every((type) => gableType.includes(type))) ||
|
|
||||||
(gableEven.every((type) => type === LINE_TYPE.WALLLINE.EAVES) && gableOdd.every((type) => gableType.includes(type)))
|
|
||||||
) {
|
|
||||||
drawGabledRoof(this.id, this.canvas, textMode)
|
|
||||||
} else*/
|
|
||||||
if (hasShed) {
|
if (hasShed) {
|
||||||
const sheds = this.lines.filter((line) => line.attributes !== undefined && line.attributes.type === LINE_TYPE.WALLLINE.SHED)
|
const sheds = this.lines.filter((line) => line.attributes !== undefined && line.attributes.type === LINE_TYPE.WALLLINE.SHED)
|
||||||
const areLinesParallel = function (line1, line2) {
|
const areLinesParallel = function (line1, line2) {
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import { useCommonUtils } from '@/hooks/common/useCommonUtils'
|
|||||||
import useMenu from '@/hooks/common/useMenu'
|
import useMenu from '@/hooks/common/useMenu'
|
||||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { canvasSettingState, canvasState, canvasZoomState, currentMenuState, verticalHorizontalModeState } from '@/store/canvasAtom'
|
import { canvasSettingState, canvasState, canvasZoomState, currentMenuState, verticalHorizontalModeState, currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
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'
|
||||||
@ -52,6 +52,7 @@ import { useRoofFn } from '@/hooks/common/useRoofFn'
|
|||||||
import { usePolygon } from '@/hooks/usePolygon'
|
import { usePolygon } from '@/hooks/usePolygon'
|
||||||
import { useTrestle } from '@/hooks/module/useTrestle'
|
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||||
export default function CanvasMenu(props) {
|
export default function CanvasMenu(props) {
|
||||||
|
const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||||
const { selectedMenu, setSelectedMenu } = props
|
const { selectedMenu, setSelectedMenu } = props
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -234,7 +235,7 @@ export default function CanvasMenu(props) {
|
|||||||
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
||||||
setSelectedMenu('module')
|
setSelectedMenu('module')
|
||||||
}
|
}
|
||||||
await reloadCanvasStatus(objectNo, pid)
|
await reloadCanvasStatus(objectNo, currentCanvasPlan?.planNo ?? pid)
|
||||||
break
|
break
|
||||||
case 'estimate':
|
case 'estimate':
|
||||||
if (!isAllComplete()) {
|
if (!isAllComplete()) {
|
||||||
|
|||||||
@ -174,6 +174,19 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onChangeHajebichi = (e) => {
|
||||||
|
setHajebichi(e)
|
||||||
|
dispatch({
|
||||||
|
type: 'SET_HAJEBICHI',
|
||||||
|
roof: {
|
||||||
|
moduleTpCd: selectedModules.itemTp ?? '',
|
||||||
|
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
|
||||||
|
raft: selectedRaftBase?.clCode,
|
||||||
|
hajebichi: e,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onChangeTrestleMaker = (e) => {
|
const onChangeTrestleMaker = (e) => {
|
||||||
setSelectedTrestle(e)
|
setSelectedTrestle(e)
|
||||||
dispatch({
|
dispatch({
|
||||||
@ -578,7 +591,7 @@ const Trestle = forwardRef((props, ref) => {
|
|||||||
type="text"
|
type="text"
|
||||||
className="input-origin block"
|
className="input-origin block"
|
||||||
disabled={selectedRoof.roofPchAuth === 'R'}
|
disabled={selectedRoof.roofPchAuth === 'R'}
|
||||||
onChange={(e) => setHajebichi(e.target.value)}
|
onChange={(e) => onChangeHajebichi(e.target.value)}
|
||||||
value={hajebichi}
|
value={hajebichi}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { pcsCheckState } from '@/store/circuitTrestleAtom'
|
import { pcsCheckState } from '@/store/circuitTrestleAtom'
|
||||||
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { isNullOrUndefined } from '@/util/common-utils'
|
import { isNullOrUndefined } from '@/util/common-utils'
|
||||||
@ -38,6 +39,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
} = props
|
} = props
|
||||||
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
|
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
|
||||||
|
|
||||||
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [selectedRow, setSelectedRow] = useState(null)
|
const [selectedRow, setSelectedRow] = useState(null)
|
||||||
const globalLocale = useRecoilValue(globalLocaleStore)
|
const globalLocale = useRecoilValue(globalLocaleStore)
|
||||||
@ -132,7 +134,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
mixMatlNo: item.mixMatlNo,
|
mixMatlNo: item.mixMatlNo,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getPcsModelList({ pcsMkrCd, pcsSerList, moduleItemList }).then((res) => {
|
getPcsModelList({ pcsMkrCd, pcsSerList, moduleItemList, storeId: sessionState.storeId }).then((res) => {
|
||||||
if (res?.result.code === 200 && res?.data) {
|
if (res?.result.code === 200 && res?.data) {
|
||||||
setModels(
|
setModels(
|
||||||
res.data.map((model) => {
|
res.data.map((model) => {
|
||||||
@ -177,7 +179,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
|
|
||||||
if (selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.MULTI) {
|
if (selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.MULTI) {
|
||||||
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
|
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
|
||||||
} else if (!selectedModels.find((m) => m.itemId === selectedRow.itemId)) {
|
} else if (!selectedModels.find((m) => m.itemId === selectedRow.itemId && m.pcsSerCd === selectedRow.pcsSerCd)) {
|
||||||
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
|
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
|
||||||
}
|
}
|
||||||
setSelectedRow(null)
|
setSelectedRow(null)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export default function WallMerge({ offsetRef, radioTypeRef }) {
|
|||||||
<div className="eaves-keraba-th">
|
<div className="eaves-keraba-th">
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop">
|
||||||
<input type="radio" name="radio01" id="ra01" value="1" checked={type === '1'} onChange={(e) => onChange(e)} />
|
<input type="radio" name="radio01" id="ra01" value="1" checked={type === '1'} onChange={(e) => onChange(e)} />
|
||||||
<label htmlFor="ra01">{getMessage('has.sleeve')}</label>
|
<label htmlFor="ra01">{getMessage('has.not.sleeve')}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="eaves-keraba-td">
|
<div className="eaves-keraba-td">
|
||||||
@ -31,7 +31,7 @@ export default function WallMerge({ offsetRef, radioTypeRef }) {
|
|||||||
<div className="eaves-keraba-th">
|
<div className="eaves-keraba-th">
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop">
|
||||||
<input type="radio" name="radio01" id="ra02" value="2" checked={type === '2'} onChange={(e) => onChange(e)} />
|
<input type="radio" name="radio01" id="ra02" value="2" checked={type === '2'} onChange={(e) => onChange(e)} />
|
||||||
<label htmlFor="ra02">{getMessage('has.not.sleeve')}</label>
|
<label htmlFor="ra02">{getMessage('has.sleeve')}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="eaves-keraba-td">
|
<div className="eaves-keraba-td">
|
||||||
|
|||||||
@ -952,9 +952,18 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
//팝업에서 넘어온 우편정보
|
//팝업에서 넘어온 우편정보
|
||||||
const setZipInfo = (info) => {
|
const setZipInfo = (info) => {
|
||||||
setPrefValue(info.prefId)
|
|
||||||
form.setValue('prefId', info.prefId)
|
prefCodeList.map((row) => {
|
||||||
form.setValue('prefName', info.address1)
|
if (row.prefName == info.address1) {
|
||||||
|
setPrefValue(row.prefId)
|
||||||
|
form.setValue('prefId', row.prefId)
|
||||||
|
form.setValue('prefName', info.address1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//setPrefValue(info.prefId)
|
||||||
|
// form.setValue('prefId', info.prefId)
|
||||||
|
// form.setValue('prefName', info.address1)
|
||||||
form.setValue('address', info.address2 + info.address3)
|
form.setValue('address', info.address2 + info.address3)
|
||||||
form.setValue('zipNo', info.zipNo)
|
form.setValue('zipNo', info.zipNo)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { getQueryString } from '@/util/common-utils'
|
import { getQueryString } from '@/util/common-utils'
|
||||||
|
import { useRecoilValue } from 'recoil'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 마스터 컨트롤러 훅
|
* 마스터 컨트롤러 훅
|
||||||
@ -11,6 +13,7 @@ export function useMasterController() {
|
|||||||
const { get, post, put } = useAxios()
|
const { get, post, put } = useAxios()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지붕재 목록 조회
|
* 지붕재 목록 조회
|
||||||
@ -34,7 +37,7 @@ export function useMasterController() {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const paramString = `?${paramArr.map((item) => `arrRoofMatlCd=${item}`).join('&')}`
|
const paramString = `?${paramArr.map((item) => `arrRoofMatlCd=${item}`).join('&')}`
|
||||||
return await get({ url: `/api/v1/master/getModuleTypeItemList${paramString}` }).then((res) => {
|
return await get({ url: `/api/v1/master/getModuleTypeItemList${paramString}&storeId=${sessionState.storeId}` }).then((res) => {
|
||||||
// console.log('🚀🚀 ~ getModuleTypeItemList ~ res:', res)
|
// console.log('🚀🚀 ~ getModuleTypeItemList ~ res:', res)
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const trestleReducer = (state, action) => {
|
|||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'SET_LENGTH':
|
case 'SET_LENGTH':
|
||||||
case 'SET_RAFT_BASE':
|
case 'SET_RAFT_BASE':
|
||||||
|
case 'SET_HAJEBICHI':
|
||||||
case 'SET_TRESTLE_MAKER':
|
case 'SET_TRESTLE_MAKER':
|
||||||
case 'SET_CONST_MTHD':
|
case 'SET_CONST_MTHD':
|
||||||
case 'SET_ROOF_BASE':
|
case 'SET_ROOF_BASE':
|
||||||
|
|||||||
@ -2726,16 +2726,26 @@ export const useTrestle = () => {
|
|||||||
moduleRowResultData.touchedHalfSurfaceBracketCnt += 1
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 1
|
||||||
} else if (!halfBottomLeftModule && !findSamePointInBottom(exposedBottomModules, module, direction)) {
|
} else if (!halfBottomLeftModule && !findSamePointInBottom(exposedBottomModules, module, direction)) {
|
||||||
// 왼쪽 아래가 없고, 하단에 같은 점이 없는 경우는 touched는 1개, exposed는 2개
|
// 왼쪽 아래가 없고, 하단에 같은 점이 없는 경우는 touched는 1개, exposed는 2개
|
||||||
moduleRowResultData.exposedHalfBottomBracketCnt += 1
|
if (level % 2 === 0) {
|
||||||
moduleRowResultData.touchedHalfSurfaceBracketCnt += 2
|
moduleRowResultData.exposedHalfBottomBracketCnt += 1
|
||||||
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 2
|
||||||
|
} else {
|
||||||
|
moduleRowResultData.exposedHalfBottomBracketCnt += 2
|
||||||
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 1
|
||||||
|
}
|
||||||
} else if (!halfBottomRightModule && findSamePointInBottom(exposedBottomModules, module, direction)) {
|
} else if (!halfBottomRightModule && findSamePointInBottom(exposedBottomModules, module, direction)) {
|
||||||
// 오른쪽 아래가 없고, 하단에 같은 점이 있는 경우는 exposed는 2개, touched는 1개
|
// 오른쪽 아래가 없고, 하단에 같은 점이 있는 경우는 exposed는 2개, touched는 1개
|
||||||
moduleRowResultData.exposedHalfBottomBracketCnt += 1
|
moduleRowResultData.exposedHalfBottomBracketCnt += 1
|
||||||
moduleRowResultData.touchedHalfSurfaceBracketCnt += 2
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 2
|
||||||
} else if (!halfBottomRightModule && !findSamePointInBottom(exposedBottomModules, module, direction)) {
|
} else if (!halfBottomRightModule && !findSamePointInBottom(exposedBottomModules, module, direction)) {
|
||||||
// 오른쪽 아래가 없고, 하단에 같은 점이 없는 경우는 exposed는 1개, touched는 2개
|
// 오른쪽 아래가 없고, 하단에 같은 점이 없는 경우는 exposed는 1개, touched는 2개
|
||||||
moduleRowResultData.exposedHalfBottomBracketCnt += 2
|
if (level % 2 === 0) {
|
||||||
moduleRowResultData.touchedHalfSurfaceBracketCnt += 1
|
moduleRowResultData.exposedHalfBottomBracketCnt += 2
|
||||||
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 1
|
||||||
|
} else {
|
||||||
|
moduleRowResultData.exposedHalfBottomBracketCnt += 1
|
||||||
|
moduleRowResultData.touchedHalfSurfaceBracketCnt += 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2774,6 +2784,20 @@ export const useTrestle = () => {
|
|||||||
if (rackYn === 'N') {
|
if (rackYn === 'N') {
|
||||||
if (rackQty !== 3) {
|
if (rackQty !== 3) {
|
||||||
moduleRowResultData.exposedHalfTopBracketCnt += rackQty / 2
|
moduleRowResultData.exposedHalfTopBracketCnt += rackQty / 2
|
||||||
|
} else {
|
||||||
|
if (halfTopLeftModule) {
|
||||||
|
if (level % 2 === 0) {
|
||||||
|
moduleRowResultData.exposedHalfTopBracketCnt += 2
|
||||||
|
} else {
|
||||||
|
moduleRowResultData.exposedHalfTopBracketCnt += 1
|
||||||
|
}
|
||||||
|
} else if (halfTopRightModule) {
|
||||||
|
if (level % 2 === 0) {
|
||||||
|
moduleRowResultData.exposedHalfTopBracketCnt += 1
|
||||||
|
} else {
|
||||||
|
moduleRowResultData.exposedHalfTopBracketCnt += 2
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!halfTopLeftModule && !halfTopRightModule) {
|
} else if (!halfTopLeftModule && !halfTopRightModule) {
|
||||||
|
|||||||
@ -61,8 +61,7 @@ export function useEavesGableEdit(id) {
|
|||||||
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
||||||
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
wallLines.forEach((wallLine) => {
|
wallLines.forEach((wallLine) => {
|
||||||
const id = wallLine.id
|
wallLine.lines = outerLines.filter((line) => line.attributes?.wallId === wallLine.id).sort((a, b) => a.idx - b.idx)
|
||||||
wallLine.lines = outerLines.filter((line) => line.attributes?.wallId === id)
|
|
||||||
})
|
})
|
||||||
wallLines.forEach((wallLine) => {
|
wallLines.forEach((wallLine) => {
|
||||||
convertPolygonToLines(wallLine)
|
convertPolygonToLines(wallLine)
|
||||||
@ -77,6 +76,41 @@ export function useEavesGableEdit(id) {
|
|||||||
convertLinesToPolygon(wallLine)
|
convertLinesToPolygon(wallLine)
|
||||||
})
|
})
|
||||||
initEvent()
|
initEvent()
|
||||||
|
|
||||||
|
const outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
|
|
||||||
|
outerLines.forEach((line) => {
|
||||||
|
let stroke, strokeWidth
|
||||||
|
if (line.attributes) {
|
||||||
|
if (line.attributes.type === LINE_TYPE.WALLLINE.EAVES || line.attributes.type === LINE_TYPE.WALLLINE.HIPANDGABLE) {
|
||||||
|
stroke = '#45CD7D'
|
||||||
|
strokeWidth = 4
|
||||||
|
} else if (line.attributes.type === LINE_TYPE.WALLLINE.GABLE || line.attributes.type === LINE_TYPE.WALLLINE.JERKINHEAD) {
|
||||||
|
stroke = '#3FBAE6'
|
||||||
|
strokeWidth = 4
|
||||||
|
} else {
|
||||||
|
stroke = '#000000'
|
||||||
|
strokeWidth = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
line.set({
|
||||||
|
visible: true,
|
||||||
|
stroke,
|
||||||
|
strokeWidth,
|
||||||
|
selectable: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
line.bringToFront()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
||||||
|
roofs.forEach((roof) => {
|
||||||
|
roof.innerLines.forEach((line) => {
|
||||||
|
line.set({ selectable: true })
|
||||||
|
line.bringToFront()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -106,6 +140,7 @@ export function useEavesGableEdit(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mouseDownEvent = (e) => {
|
const mouseDownEvent = (e) => {
|
||||||
|
canvas.discardActiveObject()
|
||||||
if (!e.target || (e.target && e.target.name !== 'outerLine')) {
|
if (!e.target || (e.target && e.target.name !== 'outerLine')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,18 +3,16 @@ import { fabric } from 'fabric'
|
|||||||
|
|
||||||
import { actionHandler, anchorWrapper, polygonPositionHandler } from '@/util/canvas-util'
|
import { actionHandler, anchorWrapper, polygonPositionHandler } from '@/util/canvas-util'
|
||||||
|
|
||||||
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
||||||
import { canvasSizeState, canvasState, canvasZoomState, fontSizeState } from '@/store/canvasAtom'
|
import { canvasSizeState, canvasState, canvasZoomState, fontSizeState } from '@/store/canvasAtom'
|
||||||
import { QLine } from '@/components/fabric/QLine'
|
import { QLine } from '@/components/fabric/QLine'
|
||||||
import { QPolygon } from '@/components/fabric/QPolygon'
|
import { QPolygon } from '@/components/fabric/QPolygon'
|
||||||
import { defineQLine } from '@/util/qline-utils'
|
import { defineQLine } from '@/util/qline-utils'
|
||||||
import { defineQPloygon } from '@/util/qpolygon-utils'
|
import { defineQPolygon } from '@/util/qpolygon-utils'
|
||||||
import { writeImage } from '@/lib/canvas'
|
import { writeImage } from '@/lib/canvas'
|
||||||
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
import { useCanvasEvent } from '@/hooks/useCanvasEvent'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
|
||||||
import { useFont } from '@/hooks/common/useFont'
|
import { useFont } from '@/hooks/common/useFont'
|
||||||
import { OBJECT_PROTOTYPE, POLYGON_TYPE, RELOAD_TYPE_PROTOTYPE, SAVE_KEY } from '@/common/common'
|
import { OBJECT_PROTOTYPE, SAVE_KEY } from '@/common/common'
|
||||||
import { usePlan } from './usePlan'
|
|
||||||
import { imageDisplaySelector } from '@/store/settingAtom'
|
import { imageDisplaySelector } from '@/store/settingAtom'
|
||||||
|
|
||||||
export function useCanvas(id) {
|
export function useCanvas(id) {
|
||||||
@ -140,7 +138,7 @@ export function useCanvas(id) {
|
|||||||
QPolygon.prototype.canvas = canvas
|
QPolygon.prototype.canvas = canvas
|
||||||
QLine.prototype.canvas = canvas
|
QLine.prototype.canvas = canvas
|
||||||
defineQLine()
|
defineQLine()
|
||||||
defineQPloygon()
|
defineQPolygon()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,6 +374,8 @@ export function useCanvas(id) {
|
|||||||
/**
|
/**
|
||||||
* 이미지로 저장하는 함수
|
* 이미지로 저장하는 함수
|
||||||
* @param {string} title - 저장할 이미지 이름
|
* @param {string} title - 저장할 이미지 이름
|
||||||
|
* @param userId
|
||||||
|
* @param setThumbnails
|
||||||
*/
|
*/
|
||||||
const saveImage = async (title = 'canvas', userId, setThumbnails) => {
|
const saveImage = async (title = 'canvas', userId, setThumbnails) => {
|
||||||
removeMouseLines()
|
removeMouseLines()
|
||||||
|
|||||||
@ -551,6 +551,30 @@ export function isPointOnLine({ x1, y1, x2, y2 }, { x, y }, epsilon = 2) {
|
|||||||
|
|
||||||
return withinXRange && withinYRange
|
return withinXRange && withinYRange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 라인위에 좌표가 존재하는지 확인한다. 위 함수가 끝포인트를 계산 못하는 경우가 발생하여 신규 추가.
|
||||||
|
* @param line - 라인 좌표
|
||||||
|
* @param point - 확인 좌표
|
||||||
|
* @param tolerance - 오차 허용 범위 (기본값 0.1)
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isPointOnLineNew({ x1, y1, x2, y2 }, { x, y }, tolerance = 0.1) {
|
||||||
|
// 1. 거리 계산을 통한 방법
|
||||||
|
const d1 = Math.sqrt(Math.pow(x - x1, 2) + Math.pow(y - y1, 2))
|
||||||
|
const d2 = Math.sqrt(Math.pow(x - x2, 2) + Math.pow(y - y2, 2))
|
||||||
|
const lineLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2))
|
||||||
|
|
||||||
|
// 점이 선분 위에 있다면, 두 끝점까지의 거리의 합이 선분의 길이와 같아야 함
|
||||||
|
const diff = Math.abs(d1 + d2 - lineLength)
|
||||||
|
|
||||||
|
// 2. 점이 선분의 범위 내에 있는지 확인
|
||||||
|
const isWithinBounds =
|
||||||
|
x >= Math.min(x1, x2) - tolerance && x <= Math.max(x1, x2) + tolerance && y >= Math.min(y1, y2) - tolerance && y <= Math.max(y1, y2) + tolerance
|
||||||
|
|
||||||
|
return diff <= tolerance && isWithinBounds
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 점과 가까운 line 찾기
|
* 점과 가까운 line 찾기
|
||||||
* @param point
|
* @param point
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user