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',
'onlyOffset',
'isChidory',
'textVisible',
]
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,
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', () => {

View File

@ -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),

View File

@ -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()
}