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