qline 실치수 표시 부분 수정
This commit is contained in:
parent
ddd3eaf82a
commit
9369c1c952
@ -84,9 +84,12 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
|||||||
addLengthText() {
|
addLengthText() {
|
||||||
const thisText = this.canvas.getObjects().find((obj) => obj.name === 'lengthText' && obj.parentId === this.id)
|
const thisText = this.canvas.getObjects().find((obj) => obj.name === 'lengthText' && obj.parentId === this.id)
|
||||||
|
|
||||||
if (this.textMode === 'none') {
|
if (thisText) {
|
||||||
if (thisText) {
|
if (this.attributes?.actualSize) {
|
||||||
this.canvas.remove(thisText)
|
thisText.set({ actualSize: this.attributes.actualSize })
|
||||||
|
}
|
||||||
|
if (this.attributes?.planeSize) {
|
||||||
|
thisText.set({ planeSize: this.attributes.planeSize })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setLength()
|
this.setLength()
|
||||||
@ -97,11 +100,6 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
|||||||
const x2 = this.left + this.width * scaleX
|
const x2 = this.left + this.width * scaleX
|
||||||
const y2 = this.top + this.height * scaleY
|
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
|
let left, top
|
||||||
if (this.direction === 'left' || this.direction === 'right') {
|
if (this.direction === 'left' || this.direction === 'right') {
|
||||||
left = (x1 + x2) / 2
|
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 degree = (Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI
|
||||||
|
|
||||||
const text = new fabric.Textbox(this.getLength().toString(), {
|
const text = new fabric.Textbox(this.getLength().toString(), {
|
||||||
|
actualSize: this.attributes?.actualSize,
|
||||||
|
planeSize: this.attributes?.planeSize,
|
||||||
left: left,
|
left: left,
|
||||||
top: top,
|
top: top,
|
||||||
fontSize: this.fontSize,
|
fontSize: this.fontSize,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user