diff --git a/src/app/api/image/canvas/route.js b/src/app/api/image/canvas/route.js index 317c84a4..2afb6b8f 100644 --- a/src/app/api/image/canvas/route.js +++ b/src/app/api/image/canvas/route.js @@ -35,9 +35,11 @@ const cropImage = async (Key, width, height, left, top) => { }), ) + console.log(Body) + const image = await Jimp.read(Body) image.autocrop({ tolerance: 0.0002, leaveBorder: 10 }) - const editedBuffer = await image.getBufferAsync(Jimp.MIME_PNG) + const editedBuffer = await image.getBuffer('image/png') return editedBuffer @@ -54,7 +56,7 @@ const cropImage = async (Key, width, height, left, top) => { // processedImage = await image.toBuffer() // } - let processedImage + //let processedImage // if (!checkResult) { // processedImage = await sharp(imageBuffer).toBuffer() // } else { @@ -68,7 +70,7 @@ const cropImage = async (Key, width, height, left, top) => { // .png() // .toBuffer() // } - return processedImage + // return processedImage } catch (error) { console.error('Error processing image:', error) throw error diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index f4972c54..1b3fb9ef 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -25,6 +25,7 @@ import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupSta import { useImgLoader } from '@/hooks/floorPlan/useImgLoader' import { usePlan } from '@/hooks/usePlan' import { QcastContext } from '@/app/QcastProvider' +import { fabric } from 'fabric' const ALLOCATION_TYPE = { AUTO: 'auto', @@ -102,10 +103,12 @@ export default function CircuitTrestleSetting({ id }) { } }, []) + // 50%로 만든 다 const handleZoomClear = () => { - setCanvasZoom(100) - canvas.set({ zoom: 1 }) - canvas.viewportTransform = [1, 0, 0, 1, 0, 0] + // setCanvasZoom(100) + const x = canvas.width / 2 + const y = canvas.height / 2 + canvas.zoomToPoint(new fabric.Point(x, y), 0.5) canvas.renderAll() }