From b8cba10fe20056aa96670903d63bb1f1c839701b Mon Sep 17 00:00:00 2001 From: Jaeyoung Lee Date: Wed, 24 Jul 2024 14:46:50 +0900 Subject: [PATCH] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Roof2.jsx | 41 ++- src/components/fabric/QPolygon.js | 415 +++++++++++++++++++++++------- 2 files changed, 351 insertions(+), 105 deletions(-) diff --git a/src/components/Roof2.jsx b/src/components/Roof2.jsx index d5e511aa..787ea08d 100644 --- a/src/components/Roof2.jsx +++ b/src/components/Roof2.jsx @@ -6,7 +6,7 @@ import QRect from '@/components/fabric/QRect' import QPolygon from '@/components/fabric/QPolygon' import RangeSlider from './ui/RangeSlider' -import { useRecoilState, useRecoilValue } from 'recoil' +import { useRecoilState } from 'recoil' import { canvasSizeState, fontSizeState, sortedPolygonArray } from '@/store/canvasAtom' import { QLine } from '@/components/fabric/QLine' @@ -179,8 +179,19 @@ 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 }, + ] if (canvas) { - const polygon = new QPolygon(type4, { + const polygon = new QPolygon(eightPoint, { fill: 'transparent', stroke: 'black', strokeWidth: 1, @@ -226,7 +237,7 @@ export default function Roof2() { } const addBackgroundInPolygon = (polygon) => { - fabric.Image.fromURL('assets/img/check2.png', function (img) { + fabric.Image.fromURL('assets/img/check2.png', function(img) { // 패턴 객체를 생성합니다. const pattern = new fabric.Pattern({ source: img.getElement(), @@ -260,7 +271,8 @@ export default function Roof2() { {canvas && ( <>
- - - - - - - -