qline 실치수 표시 부분 수정

This commit is contained in:
Jaeyoung Lee 2026-01-09 17:15:18 +09:00
parent ddd3eaf82a
commit 9369c1c952

View File

@ -84,9 +84,12 @@ export const QLine = fabric.util.createClass(fabric.Line, {
addLengthText() {
const thisText = this.canvas.getObjects().find((obj) => obj.name === 'lengthText' && obj.parentId === this.id)
if (this.textMode === 'none') {
if (thisText) {
this.canvas.remove(thisText)
if (thisText) {
if (this.attributes?.actualSize) {
thisText.set({ actualSize: this.attributes.actualSize })
}
if (this.attributes?.planeSize) {
thisText.set({ planeSize: this.attributes.planeSize })
}
} else {
this.setLength()
@ -97,11 +100,6 @@ export const QLine = fabric.util.createClass(fabric.Line, {
const x2 = this.left + this.width * scaleX
const y2 = this.top + this.height * scaleY
if (thisText) {
thisText.set({ text: this.getLength().toString(), left: (x1 + x2) / 2, top: (y1 + y2) / 2 })
this.text = thisText
return
}
let left, top
if (this.direction === 'left' || this.direction === 'right') {
left = (x1 + x2) / 2
@ -118,6 +116,8 @@ export const QLine = fabric.util.createClass(fabric.Line, {
const degree = (Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI
const text = new fabric.Textbox(this.getLength().toString(), {
actualSize: this.attributes?.actualSize,
planeSize: this.attributes?.planeSize,
left: left,
top: top,
fontSize: this.fontSize,