Compare commits
No commits in common. "1ccabd3efb7c5252134eb3b09a0b7041aa7b1bc2" and "5a73b3787fc65b7d6f67fca80b6994d5c9fd5938" have entirely different histories.
1ccabd3efb
...
5a73b3787f
@ -88,12 +88,9 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
||||
addLengthText() {
|
||||
const thisText = this.canvas.getObjects().find((obj) => obj.name === 'lengthText' && obj.parentId === this.id)
|
||||
|
||||
if (thisText) {
|
||||
if (this.attributes?.actualSize) {
|
||||
thisText.set({ actualSize: this.attributes.actualSize })
|
||||
}
|
||||
if (this.attributes?.planeSize) {
|
||||
thisText.set({ planeSize: this.attributes.planeSize })
|
||||
if (this.textMode === 'none') {
|
||||
if (thisText) {
|
||||
this.canvas.remove(thisText)
|
||||
}
|
||||
} else {
|
||||
this.setLength()
|
||||
@ -104,6 +101,11 @@ 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
|
||||
@ -120,8 +122,6 @@ 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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user