Qpolygon 추가시 다른 Qpoiygon의 길이 사라지는 현상 수정

This commit is contained in:
hyojun.choi 2024-09-04 15:15:24 +09:00
parent 9187123225
commit 3804d612d4

View File

@ -101,6 +101,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
toObject: function (propertiesToInclude) { toObject: function (propertiesToInclude) {
return fabric.util.object.extend(this.callSuper('toObject', propertiesToInclude), { return fabric.util.object.extend(this.callSuper('toObject', propertiesToInclude), {
id: this.id,
type: this.type, type: this.type,
text: this.text, text: this.text,
hips: this.hips, hips: this.hips,
@ -163,11 +164,13 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
}, },
addLengthText() { addLengthText() {
if (this.texts.length > 0) { this.canvas
this.texts.forEach((text) => { ?.getObjects()
.filter((obj) => obj.name === 'lengthText' && obj.parent === this)
.forEach((text) => {
this.canvas.remove(text) this.canvas.remove(text)
}) })
}
let points = this.getCurrentPoints() let points = this.getCurrentPoints()
points.forEach((start, i) => { points.forEach((start, i) => {