add toFixed attribute in QPolygon
This commit is contained in:
parent
c1ee05138b
commit
b57c3fe943
@ -202,6 +202,7 @@ export const SAVE_KEY = [
|
||||
'fontStyle',
|
||||
'fontWeight',
|
||||
'dormerAttributes',
|
||||
'toFixed',
|
||||
]
|
||||
|
||||
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]
|
||||
|
||||
@ -23,6 +23,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
initOptions: null,
|
||||
direction: null,
|
||||
arrow: null,
|
||||
toFixed: 1,
|
||||
initialize: function (points, options, canvas) {
|
||||
this.lines = []
|
||||
this.texts = []
|
||||
@ -33,11 +34,12 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
this.innerLines = []
|
||||
this.children = []
|
||||
this.separatePolygon = []
|
||||
this.toFixed = options.toFixed ?? 1
|
||||
|
||||
// 소수점 전부 제거
|
||||
points.forEach((point) => {
|
||||
point.x = Number(point.x.toFixed(1))
|
||||
point.y = Number(point.y.toFixed(1))
|
||||
point.x = Number(point.x.toFixed(this.toFixed))
|
||||
point.y = Number(point.y.toFixed(this.toFixed))
|
||||
})
|
||||
options.selectable = options.selectable ?? true
|
||||
options.sort = options.sort ?? true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user