이미지 불러오기 제거

This commit is contained in:
hyojun.choi 2024-06-18 18:02:09 +09:00
parent d809e23b01
commit 9dc29714d2
2 changed files with 2 additions and 30 deletions

View File

@ -16,7 +16,6 @@ export default function Roof() {
handleRotate,
attachCustomControlOnPolygon,
saveImage,
loadImage
} = useCanvas('canvas')
const addRect = () => {
@ -189,11 +188,6 @@ export default function Roof() {
>
이미지 저장
</button>
<input
type="file"
accept="image/*"
onChange={loadImage}
/>
</div>
<div

View File

@ -67,7 +67,8 @@ export function useCanvas(id) {
canvas?.off('object:modified')
canvas?.off('object:removed')
canvas?.off('object:added')
canvas?.off('mouse:move', drawMouseLines);
canvas?.off('mouse:down', handleMouseDown);
}
/**
* 눈금 그리기
@ -447,28 +448,6 @@ export function useCanvas(id) {
link.click();
}
/**
* 이미지로 저장한 내용을 업로드 canvas에 그리기
*/
const loadImage = (e) => {
const file = e.target.files[0];
const reader = new FileReader();
reader.onload = function(e) {
const dataURL = e.target.result;
fabric.Image.fromURL(dataURL, function(img) {
// 이미지 객체 생성
img.selectable = false
canvas?.add(img);
canvas?.renderAll();
});
};
reader.readAsDataURL(file);
}
return {
canvas,
@ -483,6 +462,5 @@ export function useCanvas(id) {
handleRotate,
attachCustomControlOnPolygon,
saveImage,
loadImage
}
}