diff --git a/src/common/common.js b/src/common/common.js index 9aad21d6..0424fcfd 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -187,6 +187,7 @@ export const SAVE_KEY = [ 'circuit', 'onlyOffset', 'isChidory', + 'textVisible', ] export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype] diff --git a/src/components/fabric/QLine.js b/src/components/fabric/QLine.js index 7fc1afc1..9c9791c9 100644 --- a/src/components/fabric/QLine.js +++ b/src/components/fabric/QLine.js @@ -13,6 +13,7 @@ export const QLine = fabric.util.createClass(fabric.Line, { area: 0, children: [], padding: 5, + textVisible: true, initialize: function (points, options, length = 0) { // 소수점 전부 제거 @@ -29,6 +30,7 @@ export const QLine = fabric.util.createClass(fabric.Line, { this.idx = options.idx ?? 0 this.direction = options.direction ?? getDirectionByPoint({ x: this.x1, y: this.y1 }, { x: this.x2, y: this.y2 }) this.textMode = options.textMode ?? 'plane' // plane:복시도, actual:실측, none:표시안함 + this.textVisible = options.textVisible ?? true if (length !== 0) { this.length = length } else { @@ -40,6 +42,9 @@ export const QLine = fabric.util.createClass(fabric.Line, { }, init: function () { + if (!this.textVisible) { + return + } this.addLengthText() this.on('moving', () => { diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index 23e0de55..b0c46798 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -177,6 +177,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { attributes: { offset: 0, }, + textVisible: false, parent: this, parentId: this.id, direction: getDirectionByPoint(point, nextPoint), diff --git a/src/hooks/surface/useRoofLinePropertySetting.js b/src/hooks/surface/useRoofLinePropertySetting.js index 184d7f4e..22fde4b6 100644 --- a/src/hooks/surface/useRoofLinePropertySetting.js +++ b/src/hooks/surface/useRoofLinePropertySetting.js @@ -33,13 +33,14 @@ export function useRoofLinePropertySetting(id, roof) { const roofLinesInit = () => { roof.lines.forEach((line) => { + canvas.add(line) line.set({ stroke: '#000000', strokeWidth: 4, visible: true, }) line.bringToFront() - line.setViewLengthText(false) + // line.setViewLengthText(false) }) canvas.renderAll() }