외벽선편집및오프셋 active line 색 변경
This commit is contained in:
parent
acc7a73e20
commit
6eb9535dfc
@ -1,4 +1,4 @@
|
|||||||
import { canvasState } from '@/store/canvasAtom'
|
import { canvasState, currentObjectState } from '@/store/canvasAtom'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
@ -21,6 +21,8 @@ export function useWallLineOffsetSetting(setShowWallLineOffsetSettingModal) {
|
|||||||
const arrow1Ref = useRef(null)
|
const arrow1Ref = useRef(null)
|
||||||
const arrow2Ref = useRef(null)
|
const arrow2Ref = useRef(null)
|
||||||
|
|
||||||
|
const currentObject = useRecoilValue(currentObjectState)
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
const drawLine = (point1, point2, idx, direction = currentWallLineRef.current.direction) => {
|
const drawLine = (point1, point2, idx, direction = currentWallLineRef.current.direction) => {
|
||||||
@ -87,6 +89,7 @@ export function useWallLineOffsetSetting(setShowWallLineOffsetSettingModal) {
|
|||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
canvas?.discardActiveObject()
|
||||||
removeOuterLineEditCircle()
|
removeOuterLineEditCircle()
|
||||||
addCanvasMouseEventListener('mouse:down', mouseDown)
|
addCanvasMouseEventListener('mouse:down', mouseDown)
|
||||||
if (type === TYPES.WALL_LINE_EDIT) {
|
if (type === TYPES.WALL_LINE_EDIT) {
|
||||||
@ -94,6 +97,20 @@ export function useWallLineOffsetSetting(setShowWallLineOffsetSettingModal) {
|
|||||||
}
|
}
|
||||||
}, [type])
|
}, [type])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === 'outerLine')
|
||||||
|
.forEach((line) => {
|
||||||
|
line.set({ stroke: 'black' })
|
||||||
|
})
|
||||||
|
|
||||||
|
if (currentObject?.name === 'outerLine') {
|
||||||
|
currentObject.set({ stroke: '#EA10AC' })
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}, [currentObject])
|
||||||
|
|
||||||
const removeOuterLineEditCircle = () => {
|
const removeOuterLineEditCircle = () => {
|
||||||
canvas.remove(...canvas.getObjects().filter((obj) => obj.name === 'outerLineEditCircleStart' || obj.name === 'outerLineEditCircleEnd'))
|
canvas.remove(...canvas.getObjects().filter((obj) => obj.name === 'outerLineEditCircleStart' || obj.name === 'outerLineEditCircleEnd'))
|
||||||
}
|
}
|
||||||
@ -106,7 +123,6 @@ export function useWallLineOffsetSetting(setShowWallLineOffsetSettingModal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentWallLineRef.current = e.target
|
currentWallLineRef.current = e.target
|
||||||
console.log(currentWallLineRef.current.idx, currentWallLineRef.current.direction)
|
|
||||||
if (type === TYPES.WALL_LINE_EDIT) {
|
if (type === TYPES.WALL_LINE_EDIT) {
|
||||||
addCircleByLine(currentWallLineRef.current)
|
addCircleByLine(currentWallLineRef.current)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user