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) => {
|
||||
setScale(e)
|
||||
const polygon = canvas?.getActiveObject()
|
||||
|
||||
if (polygon.type !== 'QPolygon') {
|
||||
return
|
||||
}
|
||||
|
||||
polygon.setScaleX(e)
|
||||
|
||||
canvas?.renderAll()
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +213,12 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
},
|
||||
setFontSize(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) {
|
||||
this.callSuper('_render', ctx)
|
||||
@ -700,6 +705,14 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
text.set({ visible: isView })
|
||||
})
|
||||
},
|
||||
setScaleX(scale) {
|
||||
this.scaleX = scale
|
||||
this.addLengthText()
|
||||
},
|
||||
setScaleY(scale) {
|
||||
this.scaleY = scale
|
||||
this.addLengthText()
|
||||
},
|
||||
divideLine() {
|
||||
splitPolygonWithLines(this)
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user