polygon scaleX,Y 추가 및 fontSize 함수 수정
This commit is contained in:
parent
566de9b290
commit
0119e3fac2
@ -596,10 +596,13 @@ export default function Roof2(props) {
|
|||||||
const changeLength = (e) => {
|
const changeLength = (e) => {
|
||||||
setScale(e)
|
setScale(e)
|
||||||
const polygon = canvas?.getActiveObject()
|
const polygon = canvas?.getActiveObject()
|
||||||
|
|
||||||
if (polygon.type !== 'QPolygon') {
|
if (polygon.type !== 'QPolygon') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
polygon.setScaleX(e)
|
||||||
|
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -213,7 +213,12 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
|||||||
},
|
},
|
||||||
setFontSize(fontSize) {
|
setFontSize(fontSize) {
|
||||||
this.fontSize = fontSize
|
this.fontSize = fontSize
|
||||||
this.text.set({ fontSize })
|
this.canvas
|
||||||
|
?.getObjects()
|
||||||
|
.filter((obj) => obj.name === 'lengthText' && obj.parent === this)
|
||||||
|
.forEach((text) => {
|
||||||
|
text.set({ fontSize: fontSize })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
_render: function (ctx) {
|
_render: function (ctx) {
|
||||||
this.callSuper('_render', ctx)
|
this.callSuper('_render', ctx)
|
||||||
@ -700,6 +705,14 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
|||||||
text.set({ visible: isView })
|
text.set({ visible: isView })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
setScaleX(scale) {
|
||||||
|
this.scaleX = scale
|
||||||
|
this.addLengthText()
|
||||||
|
},
|
||||||
|
setScaleY(scale) {
|
||||||
|
this.scaleY = scale
|
||||||
|
this.addLengthText()
|
||||||
|
},
|
||||||
divideLine() {
|
divideLine() {
|
||||||
splitPolygonWithLines(this)
|
splitPolygonWithLines(this)
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user