Merge branch 'dev' into feature/dev-yj-layout

This commit is contained in:
yjnoh 2025-05-08 15:16:41 +09:00
commit cbde82b0ab
5 changed files with 115 additions and 9 deletions

View File

@ -124,7 +124,6 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => { useEffect(() => {
if (constructionList.length > 0) { if (constructionList.length > 0) {
console.log(constructionList)
setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null) setSelectedConstruction(constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp) ?? null)
} else { } else {
setSelectedConstruction(null) setSelectedConstruction(null)
@ -144,6 +143,19 @@ const Trestle = forwardRef((props, ref) => {
return 'no-click' return 'no-click'
} }
const onChangeLength = (e) => {
setLengthBase(e)
dispatch({
type: 'SET_LENGTH',
roof: {
length: e,
moduleTpCd: selectedModules.itemTp ?? '',
roofMatlCd: selectedRoof?.roofMatlCd ?? '',
raftBaseCd: selectedRaftBase?.clCode,
},
})
}
const onChangeRaftBase = (e) => { const onChangeRaftBase = (e) => {
setSelectedRaftBase(e) setSelectedRaftBase(e)
dispatch({ dispatch({
@ -225,7 +237,8 @@ const Trestle = forwardRef((props, ref) => {
snowGdPossYn: constructionList[index].snowGdPossYn, snowGdPossYn: constructionList[index].snowGdPossYn,
cvrYn: constructionList[index].cvrYn, cvrYn: constructionList[index].cvrYn,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
workingWidth: selectedRoof?.length?.toString() ?? '', // workingWidth: selectedRoof?.length?.toString() ?? '',
workingWidth: lengthBase,
}, },
}) })
@ -242,7 +255,7 @@ const Trestle = forwardRef((props, ref) => {
return { return {
...selectedRoof, ...selectedRoof,
hajebichi, hajebichi,
lenBase: lengthBase, length: lengthBase,
eavesMargin, eavesMargin,
ridgeMargin, ridgeMargin,
kerabaMargin, kerabaMargin,
@ -518,7 +531,7 @@ const Trestle = forwardRef((props, ref) => {
type="text" type="text"
className="input-origin block" className="input-origin block"
value={lengthBase} value={lengthBase}
onChange={(e) => setLengthBase(e.target.value)} onChange={(e) => onChangeLength(e.target.value)}
disabled={selectedRoof.lenAuth === 'R'} disabled={selectedRoof.lenAuth === 'R'}
/> />
</div> </div>

View File

@ -10,6 +10,7 @@ const RAFT_BASE_CODE = '203800'
const trestleReducer = (state, action) => { const trestleReducer = (state, action) => {
switch (action.type) { switch (action.type) {
case 'SET_LENGTH':
case 'SET_RAFT_BASE': case 'SET_RAFT_BASE':
case 'SET_TRESTLE_MAKER': case 'SET_TRESTLE_MAKER':
case 'SET_CONST_MTHD': case 'SET_CONST_MTHD':
@ -96,11 +97,15 @@ export function useModuleTrestle(props) {
useEffect(() => { useEffect(() => {
if (trestleState) { if (trestleState) {
handleSetTrestleList() handleSetTrestleList()
if (!trestleState?.trestleMkrCd) { if (!trestleState?.trestleMkrCd) {
setConstMthdList([]) setConstMthdList([])
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -109,6 +114,9 @@ export function useModuleTrestle(props) {
setRoofBaseList([]) setRoofBaseList([])
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -116,12 +124,18 @@ export function useModuleTrestle(props) {
if (!trestleState?.roofBaseCd) { if (!trestleState?.roofBaseCd) {
setConstructionList([]) setConstructionList([])
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
handleSetConstructionList() handleSetConstructionList()
if (!trestleState?.constTp) { if (!trestleState?.constTp) {
setTrestleDetail(null) setTrestleDetail(null)
setEavesMargin(0)
setRidgeMargin(0)
setKerabaMargin(0)
return return
} }
@ -224,7 +238,8 @@ export function useModuleTrestle(props) {
constTp: trestleState.constTp ?? '', constTp: trestleState.constTp ?? '',
mixMatlNo: trestleState.mixMatlNo ?? '', mixMatlNo: trestleState.mixMatlNo ?? '',
roofPitch: trestleState.roofPitch ?? '', roofPitch: trestleState.roofPitch ?? '',
workingWidth: trestleState.workingWidth ?? '', // workingWidth: trestleState.length ?? '',
workingWidth: lengthBase ?? '',
}, },
]) ])
.then((res) => { .then((res) => {

View File

@ -14,7 +14,7 @@ import { useMouse } from '@/hooks/useMouse'
import { useLine } from '@/hooks/useLine' import { useLine } from '@/hooks/useLine'
import { useTempGrid } from '@/hooks/useTempGrid' import { useTempGrid } from '@/hooks/useTempGrid'
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { distanceBetweenPoints } from '@/util/canvas-util' import { calculateIntersection, distanceBetweenPoints, findClosestPoint } from '@/util/canvas-util'
import { fabric } from 'fabric' import { fabric } from 'fabric'
import { calculateAngle } from '@/util/qpolygon-utils' import { calculateAngle } from '@/util/qpolygon-utils'
import { import {
@ -37,12 +37,13 @@ import { useSurfaceShapeBatch } from './useSurfaceShapeBatch'
import { roofDisplaySelector } from '@/store/settingAtom' import { roofDisplaySelector } from '@/store/settingAtom'
import { useRoofFn } from '@/hooks/common/useRoofFn' import { useRoofFn } from '@/hooks/common/useRoofFn'
import PlacementSurfaceLineProperty from '@/components/floor-plan/modal/placementShape/PlacementSurfaceLineProperty' import PlacementSurfaceLineProperty from '@/components/floor-plan/modal/placementShape/PlacementSurfaceLineProperty'
import { useAdsorptionPoint } from '@/hooks/useAdsorptionPoint'
// 배치면 그리기 // 배치면 그리기
export function usePlacementShapeDrawing(id) { export function usePlacementShapeDrawing(id) {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
const roofDisplay = useRecoilValue(roofDisplaySelector) const roofDisplay = useRecoilValue(roofDisplaySelector)
const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseEvent } = const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseLine } =
useEvent() useEvent()
// const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseEvent } = // const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseEvent } =
// useContext(EventContext) // useContext(EventContext)
@ -118,6 +119,7 @@ export function usePlacementShapeDrawing(id) {
}, [type]) }, [type])
const clear = () => { const clear = () => {
addCanvasMouseEventListener('mouse:move', mouseMove)
setLength1(0) setLength1(0)
setLength2(0) setLength2(0)
@ -173,6 +175,80 @@ export function usePlacementShapeDrawing(id) {
} }
} }
/*
mouseMove
*/
const roofs = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
const roofAdsorptionPoints = useRef([])
const intersectionPoints = useRef([])
const { getAdsorptionPoints } = useAdsorptionPoint()
const mouseMove = (e) => {
removeMouseLine();
const pointer = canvas.getPointer(e.e)
const roofsPoints = roofs.map((roof) => roof.points).flat()
roofAdsorptionPoints.current = [...roofsPoints]
const auxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isFixed)
const otherAdsorptionPoints = []
auxiliaryLines.forEach((line1) => {
auxiliaryLines.forEach((line2) => {
if (line1 === line2) {
return
}
const intersectionPoint = calculateIntersection(line1, line2)
if (!intersectionPoint || intersectionPoints.current.some((point) => point.x === intersectionPoint.x && point.y === intersectionPoint.y)) {
return
}
otherAdsorptionPoints.push(intersectionPoint)
})
})
let innerLinePoints = []
canvas
.getObjects()
.filter((obj) => obj.innerLines)
.forEach((polygon) => {
polygon.innerLines.forEach((line) => {
innerLinePoints.push({ x: line.x1, y: line.y1 })
innerLinePoints.push({ x: line.x2, y: line.y2 })
})
})
const adsorptionPoints = [
...getAdsorptionPoints(),
...roofAdsorptionPoints.current,
...otherAdsorptionPoints,
...intersectionPoints.current,
...innerLinePoints,
]
let arrivalPoint = { x: pointer.x, y: pointer.y }
let adsorptionPoint = findClosestPoint(pointer, adsorptionPoints)
if (adsorptionPoint && distanceBetweenPoints(pointer, adsorptionPoint) <= adsorptionRange) {
arrivalPoint = { ...adsorptionPoint }
}
const horizontalLine = new fabric.Line([-1 * canvas.width, arrivalPoint.y, 2 * canvas.width, arrivalPoint.y], {
stroke: 'red',
strokeWidth: 1,
selectable: false,
name: 'mouseLine',
})
const verticalLine = new fabric.Line([arrivalPoint.x, -1 * canvas.height, arrivalPoint.x, 2 * canvas.height], {
stroke: 'red',
strokeWidth: 1,
selectable: false,
name: 'mouseLine',
})
canvas?.add(horizontalLine, verticalLine)
canvas?.renderAll()
}
useEffect(() => { useEffect(() => {
canvas canvas
?.getObjects() ?.getObjects()

View File

@ -206,6 +206,7 @@ export function useCanvasEvent() {
selected.forEach((obj) => { selected.forEach((obj) => {
if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) { if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
obj.set({ stroke: 'red' }) obj.set({ stroke: 'red' })
obj.bringToFront()
} }
}) })
canvas.renderAll() canvas.renderAll()
@ -243,6 +244,7 @@ export function useCanvasEvent() {
selected.forEach((obj) => { selected.forEach((obj) => {
if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) { if (obj.type === 'QPolygon' && currentMenu !== MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING) {
obj.set({ stroke: 'red' }) obj.set({ stroke: 'red' })
obj.bringToFront()
} }
}) })
} }

View File

@ -3,7 +3,7 @@
"welcome": "ようこそ。 {0}さん", "welcome": "ようこそ。 {0}さん",
"header.menus.home": "ホーム", "header.menus.home": "ホーム",
"header.menus.management": "見積書管理画面", "header.menus.management": "見積書管理画面",
"header.menus.management.newStuff": "新規見積登録", "header.menus.management.newStuff": "新規物件登録",
"header.menus.management.detail": "物件詳細", "header.menus.management.detail": "物件詳細",
"header.menus.management.stuffList": "物件検索", "header.menus.management.stuffList": "物件検索",
"header.menus.community": "コミュニティ", "header.menus.community": "コミュニティ",
@ -187,7 +187,7 @@
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.validation.error02": "シリーズを選択してください。", "modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.validation.error02": "シリーズを選択してください。",
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "番号確定", "modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "番号確定",
"modal.circuit.trestle.setting.step.up.allocation": "昇圧設定", "modal.circuit.trestle.setting.step.up.allocation": "昇圧設定",
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "シリアル枚数", "modal.circuit.trestle.setting.step.up.allocation.serial.amount": "直列枚数",
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "総回路数", "modal.circuit.trestle.setting.step.up.allocation.total.amount": "総回路数",
"modal.circuit.trestle.setting.step.up.allocation.connected": "接続する", "modal.circuit.trestle.setting.step.up.allocation.connected": "接続する",
"modal.circuit.trestle.setting.step.up.allocation.circuit.amount": "昇圧回路数", "modal.circuit.trestle.setting.step.up.allocation.circuit.amount": "昇圧回路数",