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