textVisbile 속성 추가

This commit is contained in:
hyojun.choi 2025-02-19 16:47:02 +09:00
parent 1894f2702e
commit 575b507262
4 changed files with 9 additions and 1 deletions

View File

@ -187,6 +187,7 @@ export const SAVE_KEY = [
'circuit', 'circuit',
'onlyOffset', 'onlyOffset',
'isChidory', 'isChidory',
'textVisible',
] ]
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype] export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype]

View File

@ -13,6 +13,7 @@ export const QLine = fabric.util.createClass(fabric.Line, {
area: 0, area: 0,
children: [], children: [],
padding: 5, padding: 5,
textVisible: true,
initialize: function (points, options, length = 0) { initialize: function (points, options, length = 0) {
// 소수점 전부 제거 // 소수점 전부 제거
@ -29,6 +30,7 @@ export const QLine = fabric.util.createClass(fabric.Line, {
this.idx = options.idx ?? 0 this.idx = options.idx ?? 0
this.direction = options.direction ?? getDirectionByPoint({ x: this.x1, y: this.y1 }, { x: this.x2, y: this.y2 }) 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.textMode = options.textMode ?? 'plane' // plane:복시도, actual:실측, none:표시안함
this.textVisible = options.textVisible ?? true
if (length !== 0) { if (length !== 0) {
this.length = length this.length = length
} else { } else {
@ -40,6 +42,9 @@ export const QLine = fabric.util.createClass(fabric.Line, {
}, },
init: function () { init: function () {
if (!this.textVisible) {
return
}
this.addLengthText() this.addLengthText()
this.on('moving', () => { this.on('moving', () => {

View File

@ -177,6 +177,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
attributes: { attributes: {
offset: 0, offset: 0,
}, },
textVisible: false,
parent: this, parent: this,
parentId: this.id, parentId: this.id,
direction: getDirectionByPoint(point, nextPoint), direction: getDirectionByPoint(point, nextPoint),

View File

@ -33,13 +33,14 @@ export function useRoofLinePropertySetting(id, roof) {
const roofLinesInit = () => { const roofLinesInit = () => {
roof.lines.forEach((line) => { roof.lines.forEach((line) => {
canvas.add(line)
line.set({ line.set({
stroke: '#000000', stroke: '#000000',
strokeWidth: 4, strokeWidth: 4,
visible: true, visible: true,
}) })
line.bringToFront() line.bringToFront()
line.setViewLengthText(false) // line.setViewLengthText(false)
}) })
canvas.renderAll() canvas.renderAll()
} }