diff --git a/src/components/fabric/QLine.js b/src/components/fabric/QLine.js index 2a0bbca0..65575731 100644 --- a/src/components/fabric/QLine.js +++ b/src/components/fabric/QLine.js @@ -35,10 +35,6 @@ export const QLine = fabric.util.createClass(fabric.Line, { this.startPoint = { x: this.x1, y: this.y1 } this.endPoint = { x: this.x2, y: this.y2 } - - if (canvas) { - this.canvas = canvas - } }, init: function () { diff --git a/src/hooks/roofcover/useRoofShapePassivitySetting.js b/src/hooks/roofcover/useRoofShapePassivitySetting.js index f054e23e..02f56fa7 100644 --- a/src/hooks/roofcover/useRoofShapePassivitySetting.js +++ b/src/hooks/roofcover/useRoofShapePassivitySetting.js @@ -88,10 +88,10 @@ export function useRoofShapePassivitySetting(id) { const lines = canvas.getObjects().filter((obj) => obj.name === 'outerLine') let stroke, strokeWidth lines.forEach((line) => { - if (line.attributes.type === LINE_TYPE.WALLLINE.EAVES || line.attributes.type === LINE_TYPE.WALLLINE.HIPANDGABLE) { + 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) { + } else if (line.attributes?.type === LINE_TYPE.WALLLINE.GABLE || line.attributes?.type === LINE_TYPE.WALLLINE.JERKINHEAD) { stroke = '#3FBAE6' strokeWidth = 4 } else { @@ -136,7 +136,7 @@ export function useRoofShapePassivitySetting(id) { const index = lines.findIndex((line) => line === selectedLine) const nextLine = lines[index + 1] || lines[0] - if (nextLine.attributes.isFixed) { + if (nextLine.attributes?.isFixed) { canvas.discardActiveObject() return }