diff --git a/src/components/fabric/QLine.js b/src/components/fabric/QLine.js index 4ee9535a..86a96845 100644 --- a/src/components/fabric/QLine.js +++ b/src/components/fabric/QLine.js @@ -21,9 +21,7 @@ export const QLine = fabric.util.createClass(fabric.Line, { } this.line = this // 소수점 전부 제거 - points.forEach((point) => { - point = Math.round(point) - }) + points = points.map((point) => Math.round(point)) this.idx = options.idx ?? 0 this.direction = options.direction ?? getDirectionByPoint({ x: this.x1, y: this.y1 }, { x: this.x2, y: this.y2 }) diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index 8068a772..decc99ae 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -24,8 +24,8 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { initialize: function (points, options, canvas) { // 소수점 전부 제거 points.forEach((point) => { - point.x = Math.round(point.x) - point.y = Math.round(point.y) + point.x = Number(point.x.toFixed(1)) + point.y = Number(point.y.toFixed(1)) }) options.selectable = options.selectable ?? true options.sort = options.sort ?? true