Q컴포넌트 생성시 폰트사이즈는 필수
This commit is contained in:
parent
3d7d2ab0dc
commit
2e3a933dbb
@ -100,11 +100,11 @@ export default function Roof2() {
|
||||
|
||||
setCanvasSize(() => ({
|
||||
vertical: verticalSize,
|
||||
horizontal: horizontalSize
|
||||
horizontal: horizontalSize,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 값 변경시
|
||||
*/
|
||||
|
||||
@ -5,9 +5,13 @@ export default class QLine extends fabric.Line {
|
||||
#text
|
||||
#viewLengthText
|
||||
#fontSize
|
||||
type = 'QLine'
|
||||
constructor(points, option) {
|
||||
if (option.fontSize) {
|
||||
throw new Error('Font size is required.')
|
||||
}
|
||||
super(points, option)
|
||||
this.#fontSize = option.fontSize ?? 16
|
||||
this.#fontSize = option.fontSize
|
||||
this.#init(option)
|
||||
this.#addControl()
|
||||
}
|
||||
|
||||
@ -4,10 +4,14 @@ export default class QPolygon extends fabric.Polygon {
|
||||
#viewLengthText
|
||||
#text = []
|
||||
#fontSize
|
||||
type = 'QPolygon'
|
||||
|
||||
constructor(points, option) {
|
||||
if (option.fontSize) {
|
||||
throw new Error('Font size is required.')
|
||||
}
|
||||
super(points, option)
|
||||
this.#fontSize = option.fontSize ?? 16
|
||||
this.#fontSize = option.fontSize
|
||||
this.#init(points)
|
||||
this.#addControl()
|
||||
}
|
||||
@ -48,6 +52,14 @@ export default class QPolygon extends fabric.Polygon {
|
||||
})
|
||||
}
|
||||
|
||||
setTexts(texts) {
|
||||
this.#text = texts
|
||||
}
|
||||
|
||||
getTexts() {
|
||||
return this.#text
|
||||
}
|
||||
|
||||
#addLengthText() {
|
||||
if (this.#text.length > 0) {
|
||||
this.#text.forEach((text) => {
|
||||
|
||||
@ -3,15 +3,19 @@ export default class QRect extends fabric.Rect {
|
||||
#text = []
|
||||
#viewLengthText
|
||||
#fontSize
|
||||
constructor(points, option) {
|
||||
super(points, option)
|
||||
this.#fontSize = points.fontSize ?? 16
|
||||
this.#init(points)
|
||||
type = 'QRect'
|
||||
constructor(option) {
|
||||
if (option.fontSize) {
|
||||
throw new Error('Font size is required.')
|
||||
}
|
||||
super(option)
|
||||
this.#fontSize = option.fontSize
|
||||
this.#init(option)
|
||||
this.#addControl()
|
||||
}
|
||||
|
||||
#init(points) {
|
||||
this.#viewLengthText = points.viewLengthText ?? true
|
||||
#init(option) {
|
||||
this.#viewLengthText = option.viewLengthText ?? true
|
||||
}
|
||||
|
||||
setViewLengthText(bool) {
|
||||
@ -79,7 +83,7 @@ export default class QRect extends fabric.Rect {
|
||||
const text = new fabric.Text(length.toFixed(0), {
|
||||
left: (line.start.x + line.end.x) / 2,
|
||||
top: (line.start.y + line.end.y) / 2,
|
||||
fontSize: this.#fontSize,
|
||||
fontSize: this.fontSize,
|
||||
selectable: false,
|
||||
})
|
||||
this.#text.push(text)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user