From 3fa147b12e7f9800ac2bdd88dfe1ef13a035ec3b Mon Sep 17 00:00:00 2001 From: yjnoh Date: Wed, 4 Sep 2024 12:45:52 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8F=B4=EB=A6=AC=EA=B3=A4=20context=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/context-menu/QPolygonContextMenu.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/common/context-menu/QPolygonContextMenu.jsx b/src/components/common/context-menu/QPolygonContextMenu.jsx index 5c886816..8558ee72 100644 --- a/src/components/common/context-menu/QPolygonContextMenu.jsx +++ b/src/components/common/context-menu/QPolygonContextMenu.jsx @@ -7,12 +7,12 @@ export default function QPolygonContextMenu(props) { // const children = useRecoilValue(modalContent) const [contextMenu, setContextMenu] = useState({ visible: false, x: 0, y: 0 }) - const optionName = canvasProps.getActiveObject().initOptions.name + const polygon = canvasProps.getActiveObject() //액티브된 객체를 가져옴 let contextType = '' - if (optionName.indexOf('guide') > -1) { - contextType = 'surface' + if (polygon.initOptions.name.indexOf('guide') > -1) { + contextType = 'surface' //면형상 } useEffect(() => { @@ -20,6 +20,9 @@ export default function QPolygonContextMenu(props) { const handleContextMenu = (e) => { e.preventDefault() //기존 contextmenu 막고 + + // Fabric.js 상의 객체에 직접 이벤트를 트리거할 수는 없으므로, + // 캔버스 요소에 이벤트를 디스패치하여 처리 setContextMenu({ visible: true, x: e.pageX, y: e.pageY }) canvasProps.upperCanvasEl.removeEventListener('contextmenu', handleContextMenu) //한번 노출 후 이벤트 삭제 } @@ -72,9 +75,6 @@ export default function QPolygonContextMenu(props) { {contextType === 'surface' ? ( <> -
  • handleMenuClick(4)}> - 모듈,회로구성 -
  • handleMenuClick(4)}> 모듈 채우기