fix: canvas 체크 로직 수정

This commit is contained in:
yoosangwook 2024-08-01 11:28:27 +09:00
parent e26c751e73
commit 495b95e991

View File

@ -42,18 +42,18 @@ export function useCanvas(id) {
useEffect(() => {
canvas
?.getObjects()
.filter((obj) => obj.type === 'textbox' || obj.type === 'text' || obj.type === 'i-text')
?.filter((obj) => obj.type === 'textbox' || obj.type === 'text' || obj.type === 'i-text')
.forEach((obj) => {
obj.set({ fontSize: fontSize })
})
canvas
?.getObjects()
.filter((obj) => obj.type === 'QLine' || obj.type === 'QPolygon' || obj.type === 'QRect')
?.filter((obj) => obj.type === 'QLine' || obj.type === 'QPolygon' || obj.type === 'QRect')
.forEach((obj) => {
obj.setFontSize(fontSize)
})
canvas?.renderAll()
canvas?.getObjects().length > 0 && canvas?.renderAll()
}, [fontSize])
/**
@ -103,7 +103,7 @@ export function useCanvas(id) {
}
const initialize = () => {
canvas?.clear()
canvas.getObjects().length > 0 && canvas?.clear()
// settings for all canvas in the app
fabric.Object.prototype.transparentCorners = false
fabric.Object.prototype.cornerColor = '#2BEBC8'