fontsize recoil
This commit is contained in:
parent
478f626970
commit
f0e7fb072c
@ -48,6 +48,7 @@ export default function Roof2() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 100,
|
height: 100,
|
||||||
|
fontSize: fontSize,
|
||||||
})
|
})
|
||||||
|
|
||||||
canvas?.add(rect)
|
canvas?.add(rect)
|
||||||
@ -59,6 +60,7 @@ export default function Roof2() {
|
|||||||
const line = new QLine([50, 50, 200, 50], {
|
const line = new QLine([50, 50, 200, 50], {
|
||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
|
fontSize: fontSize,
|
||||||
})
|
})
|
||||||
|
|
||||||
canvas?.add(line)
|
canvas?.add(line)
|
||||||
@ -79,6 +81,7 @@ export default function Roof2() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
fontSize: fontSize,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,7 +113,18 @@ export default function Roof2() {
|
|||||||
}, [verticalSize, horizontalSize])
|
}, [verticalSize, horizontalSize])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(`fontSize 바꼈다 ${fontSize}`)
|
canvas
|
||||||
|
?.getObjects()
|
||||||
|
.filter(
|
||||||
|
(obj) =>
|
||||||
|
obj.type === 'textbox' ||
|
||||||
|
obj.type === 'text' ||
|
||||||
|
obj.type === 'i-text',
|
||||||
|
)
|
||||||
|
.forEach((obj) => {
|
||||||
|
obj.set({ fontSize: fontSize })
|
||||||
|
})
|
||||||
|
canvas?.renderAll()
|
||||||
}, [fontSize])
|
}, [fontSize])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -4,9 +4,10 @@ export default class QLine extends fabric.Line {
|
|||||||
#length
|
#length
|
||||||
#text
|
#text
|
||||||
#viewLengthText
|
#viewLengthText
|
||||||
|
#fontSize
|
||||||
constructor(points, option) {
|
constructor(points, option) {
|
||||||
super(points, option)
|
super(points, option)
|
||||||
|
this.#fontSize = option.fontSize ?? 16
|
||||||
this.#init(option)
|
this.#init(option)
|
||||||
this.#addControl()
|
this.#addControl()
|
||||||
}
|
}
|
||||||
@ -65,7 +66,7 @@ export default class QLine extends fabric.Line {
|
|||||||
const text = new fabric.Text(this.#length, {
|
const text = new fabric.Text(this.#length, {
|
||||||
left: (this.x1 + this.x2) / 2,
|
left: (this.x1 + this.x2) / 2,
|
||||||
top: (this.y1 + this.y2) / 2,
|
top: (this.y1 + this.y2) / 2,
|
||||||
fontSize: 16,
|
fontSize: this.#fontSize,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
})
|
})
|
||||||
this.#text = text
|
this.#text = text
|
||||||
|
|||||||
@ -3,9 +3,11 @@ import { distanceBetweenPoints } from '@/app/util/canvas-util'
|
|||||||
export default class QPolygon extends fabric.Polygon {
|
export default class QPolygon extends fabric.Polygon {
|
||||||
#viewLengthText
|
#viewLengthText
|
||||||
#text = []
|
#text = []
|
||||||
|
#fontSize
|
||||||
|
|
||||||
constructor(points, option) {
|
constructor(points, option) {
|
||||||
super(points, option)
|
super(points, option)
|
||||||
|
this.#fontSize = option.fontSize ?? 16
|
||||||
this.#init(points)
|
this.#init(points)
|
||||||
this.#addControl()
|
this.#addControl()
|
||||||
}
|
}
|
||||||
@ -77,7 +79,7 @@ export default class QPolygon extends fabric.Polygon {
|
|||||||
const text = new fabric.Text(length.toFixed(0), {
|
const text = new fabric.Text(length.toFixed(0), {
|
||||||
left: midPoint.x,
|
left: midPoint.x,
|
||||||
top: midPoint.y,
|
top: midPoint.y,
|
||||||
fontSize: 16,
|
fontSize: this.#fontSize,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
})
|
})
|
||||||
this.#text.push(text)
|
this.#text.push(text)
|
||||||
|
|||||||
@ -2,8 +2,10 @@ import { fabric } from 'fabric'
|
|||||||
export default class QRect extends fabric.Rect {
|
export default class QRect extends fabric.Rect {
|
||||||
#text = []
|
#text = []
|
||||||
#viewLengthText
|
#viewLengthText
|
||||||
|
#fontSize
|
||||||
constructor(points, option) {
|
constructor(points, option) {
|
||||||
super(points, option)
|
super(points, option)
|
||||||
|
this.#fontSize = points.fontSize ?? 16
|
||||||
this.#init(points)
|
this.#init(points)
|
||||||
this.#addControl()
|
this.#addControl()
|
||||||
}
|
}
|
||||||
@ -77,7 +79,7 @@ export default class QRect extends fabric.Rect {
|
|||||||
const text = new fabric.Text(length.toFixed(0), {
|
const text = new fabric.Text(length.toFixed(0), {
|
||||||
left: (line.start.x + line.end.x) / 2,
|
left: (line.start.x + line.end.x) / 2,
|
||||||
top: (line.start.y + line.end.y) / 2,
|
top: (line.start.y + line.end.y) / 2,
|
||||||
fontSize: 16,
|
fontSize: this.#fontSize,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
})
|
})
|
||||||
this.#text.push(text)
|
this.#text.push(text)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user