modulePoints 추가
This commit is contained in:
parent
44508faf04
commit
e60989d318
@ -1,17 +1,18 @@
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import { wordDisplaySelector } from '@/store/settingAtom'
|
import { wordDisplaySelector } from '@/store/settingAtom'
|
||||||
import { useEvent } from '@/hooks/useEvent'
|
import { useEvent } from '@/hooks/useEvent'
|
||||||
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
||||||
import { commonUtilsState, dimensionLineSettingsState } from '@/store/commonUtilsAtom'
|
import { commonUtilsState, dimensionLineSettingsState } from '@/store/commonUtilsAtom'
|
||||||
import { fontSelector } from '@/store/fontAtom'
|
import { fontSelector } from '@/store/fontAtom'
|
||||||
import { canvasState, currentMenuState } from '@/store/canvasAtom'
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
import Distance from '@/components/floor-plan/modal/distance/Distance'
|
import Distance from '@/components/floor-plan/modal/distance/Distance'
|
||||||
import { usePolygon } from '@/hooks/usePolygon'
|
import { usePolygon } from '@/hooks/usePolygon'
|
||||||
import { useObjectBatch } from '@/hooks/object/useObjectBatch'
|
import { useObjectBatch } from '@/hooks/object/useObjectBatch'
|
||||||
import { BATCH_TYPE } from '@/common/common'
|
import { BATCH_TYPE } from '@/common/common'
|
||||||
|
import { useMouse } from '@/hooks/useMouse'
|
||||||
|
|
||||||
export function useCommonUtils() {
|
export function useCommonUtils() {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -25,6 +26,7 @@ export function useCommonUtils() {
|
|||||||
const { addPopup, closeAll, targetClose } = usePopup()
|
const { addPopup, closeAll, targetClose } = usePopup()
|
||||||
const { drawDirectionArrow, addLengthText } = usePolygon()
|
const { drawDirectionArrow, addLengthText } = usePolygon()
|
||||||
const { applyDormers } = useObjectBatch({})
|
const { applyDormers } = useObjectBatch({})
|
||||||
|
const { getIntersectMousePoint } = useMouse()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
commonTextMode()
|
commonTextMode()
|
||||||
@ -213,7 +215,7 @@ export function useCommonUtils() {
|
|||||||
addCanvasMouseEventListener('mouse:down', (e) => {
|
addCanvasMouseEventListener('mouse:down', (e) => {
|
||||||
let groupObjects = []
|
let groupObjects = []
|
||||||
|
|
||||||
const pointer = canvas.getPointer(e.e)
|
const pointer = getIntersectMousePoint(e)
|
||||||
|
|
||||||
let point
|
let point
|
||||||
|
|
||||||
@ -654,7 +656,11 @@ export function useCommonUtils() {
|
|||||||
clonedObj.setCoords()
|
clonedObj.setCoords()
|
||||||
clonedObj.fire('modified')
|
clonedObj.fire('modified')
|
||||||
clonedObj.fire('polygonMoved')
|
clonedObj.fire('polygonMoved')
|
||||||
clonedObj.set({ direction: obj.direction, directionText: obj.directionText, roofMaterial: obj.roofMaterial })
|
clonedObj.set({
|
||||||
|
direction: obj.direction,
|
||||||
|
directionText: obj.directionText,
|
||||||
|
roofMaterial: obj.roofMaterial,
|
||||||
|
})
|
||||||
|
|
||||||
obj.lines.forEach((line, index) => {
|
obj.lines.forEach((line, index) => {
|
||||||
clonedObj.lines[index].set({ attributes: line.attributes })
|
clonedObj.lines[index].set({ attributes: line.attributes })
|
||||||
|
|||||||
@ -210,6 +210,14 @@ export function useEvent() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const modulePoints = []
|
||||||
|
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
modules.forEach((module) => {
|
||||||
|
module.points.forEach((point) => {
|
||||||
|
modulePoints.push({ x: point.x, y: point.y })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
let adsorptionPoints = [
|
let adsorptionPoints = [
|
||||||
...getAdsorptionPoints(),
|
...getAdsorptionPoints(),
|
||||||
...roofAdsorptionPoints.current,
|
...roofAdsorptionPoints.current,
|
||||||
@ -229,6 +237,7 @@ export function useEvent() {
|
|||||||
y: line.y2,
|
y: line.y2,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
...modulePoints,
|
||||||
]
|
]
|
||||||
|
|
||||||
adsorptionPoints = removeDuplicatePoints(adsorptionPoints)
|
adsorptionPoints = removeDuplicatePoints(adsorptionPoints)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user