From 89007b79ace4861d1bab4a506d997b774795ae64 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 22 Jul 2024 18:35:45 +0900 Subject: [PATCH] test --- src/components/Roof2.jsx | 34 +++- src/components/fabric/QPolygon.js | 276 ++++++++++++++++-------------- src/hooks/useCanvas.js | 30 ++-- src/hooks/useMode.js | 1 + src/util/canvas-util.js | 45 ++++- src/util/qline-utils.js | 12 ++ src/util/qpolygon-utils.js | 251 +++++++++++++++++++++++++++ 7 files changed, 496 insertions(+), 153 deletions(-) create mode 100644 src/util/qline-utils.js create mode 100644 src/util/qpolygon-utils.js diff --git a/src/components/Roof2.jsx b/src/components/Roof2.jsx index f8ffdd8f..eadb2c33 100644 --- a/src/components/Roof2.jsx +++ b/src/components/Roof2.jsx @@ -12,7 +12,7 @@ import { QLine } from '@/components/fabric/QLine' import { getTests, getCanvasState, insertCanvasState } from '@/lib/canvas' export default function Roof2() { - const { canvas, handleRedo, handleUndo, setCanvasBackgroundWithDots, saveImage, addCanvas, changeCanvas } = useCanvas('canvas') + const { canvas, handleRedo, handleUndo, setCanvasBackgroundWithDots, saveImage, addCanvas } = useCanvas('canvas') //canvas 기본 사이즈 const [canvasSize, setCanvasSize] = useRecoilState(canvasSizeState) @@ -174,8 +174,31 @@ export default function Roof2() { { x: 1088, y: 991 }, { x: 1088, y: 42 }, ] + + const eightPoint = [ + { x: 240, y: 130 }, + { x: 240, y: 630 }, + { x: 640, y: 630 }, + { x: 640, y: 480 }, + { x: 440, y: 480 }, + { x: 440, y: 280 }, + { x: 740, y: 280 }, + { x: 740, y: 130 }, + ] + + const eightPoint2 = [ + { x: 197, y: 215 }, + { x: 197, y: 815 }, + { x: 397, y: 815 }, + { x: 397, y: 1115 }, + { x: 697, y: 1115 }, + { x: 697, y: 815 }, + { x: 897, y: 815 }, + { x: 897, y: 215 }, + ] + if (canvas) { - const polygon = new QPolygon(type4, { + const polygon = new QPolygon(eightPoint, { fill: 'transparent', stroke: 'black', strokeWidth: 1, @@ -212,7 +235,7 @@ export default function Roof2() { [200, 200, 500, 500], { stroke: 'black', - strokeWidth: 1, + strokeWidth: 5, fontSize: fontSize, selectable: true, }, @@ -378,11 +401,14 @@ export default function Roof2() { - */} +