diff --git a/src/hooks/surface/useRoofLinePropertySetting.js b/src/hooks/surface/useRoofLinePropertySetting.js index 22fde4b6..ba5eedee 100644 --- a/src/hooks/surface/useRoofLinePropertySetting.js +++ b/src/hooks/surface/useRoofLinePropertySetting.js @@ -12,6 +12,7 @@ const LINE_COLOR = { GABLE: '#3FBAE6', RIDGE: '#9e9e9e', DEFAULT: '#000000', + ACTIVE: '#EA10AC', } export function useRoofLinePropertySetting(id, roof) { @@ -23,9 +24,9 @@ export function useRoofLinePropertySetting(id, roof) { const { getMessage } = useMessage() useEffect(() => { - if (currentObject) { + if (currentObject && currentObject.name === 'roofLine') { currentObject.set({ - stroke: '#EA10AC', + stroke: LINE_COLOR.ACTIVE, strokeWidth: 4, }) } @@ -35,17 +36,18 @@ export function useRoofLinePropertySetting(id, roof) { roof.lines.forEach((line) => { canvas.add(line) line.set({ - stroke: '#000000', + stroke: LINE_COLOR.DEFAULT, strokeWidth: 4, visible: true, + name: 'roofLine', }) line.bringToFront() - // line.setViewLengthText(false) }) canvas.renderAll() } const handleSetEaves = () => { + if (!currentObject) return currentObject.set({ attributes: { ...currentObject.attributes, @@ -60,6 +62,7 @@ export function useRoofLinePropertySetting(id, roof) { } const handleSetGable = () => { + if (!currentObject) return currentObject.set({ attributes: { ...currentObject.attributes, @@ -74,6 +77,7 @@ export function useRoofLinePropertySetting(id, roof) { } const handleSetRidge = () => { + if (!currentObject) return currentObject.set({ attributes: { ...currentObject.attributes, @@ -93,7 +97,11 @@ export function useRoofLinePropertySetting(id, roof) { } const lastLine = history.current.pop() - delete lastLine.attributes + // delete lastLine.attributes + lastLine.attributes = { + ...lastLine.attributes, + type: null, + } lastLine.set({ stroke: LINE_COLOR.DEFAULT, strokeWidth: 4,