diff options
author | Sunil Shetye | 2025-06-12 18:19:24 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-06-12 18:19:24 +0530 |
commit | 566ee37ec1d620390c4a00a79cba7773e75f4ddd (patch) | |
tree | 3694a49541ae0c37813af179e4975b1899884291 | |
parent | 12ec60d4854674f5e3cafdb51f270d250e8c4bca (diff) | |
download | Common-Interface-Project-566ee37ec1d620390c4a00a79cba7773e75f4ddd.tar.gz Common-Interface-Project-566ee37ec1d620390c4a00a79cba7773e75f4ddd.tar.bz2 Common-Interface-Project-566ee37ec1d620390c4a00a79cba7773e75f4ddd.zip |
cleanup
4 files changed, 79 insertions, 83 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js index 3e33805e..55487fee 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js @@ -155,13 +155,11 @@ export default function loadGrid (container, sidebar, outline, setMainDiagramBac graph.addListener(mxEvent.DOUBLE_CLICK, function (sender, evt) { const cell = evt.getProperty('cell') - console.log("cell1:", cell) if (cell !== undefined && cell.CellType === 'Component') { const blockType = styleToObject(cell.style).default // Extract block type like 'SUPER_f' if (blockType === 'SUPER_f') { - console.log("CE:", typeof cell.SuperBlockDiagram, cell.SuperBlockDiagram) // Save current diagram setMainDiagramBackup(getCurrentDiagramXML(graph.getModel())) @@ -177,7 +175,6 @@ export default function loadGrid (container, sidebar, outline, setMainDiagramBac } // Load subdiagram directly into canvas - console.log('subDiagramXML:', subDiagramXML) renderGalleryXML(subDiagramXML) // Show close button @@ -318,17 +315,17 @@ export default function loadGrid (container, sidebar, outline, setMainDiagramBac const styleObject = styleToObject(source.style) let style = 'Link' switch (styleObject.default) { - case 'ExplicitOutputPort': case 'ExplicitInputPort': - style = 'ExplicitLink' - break + case 'ExplicitOutputPort': case 'ExplicitInputPort': + style = 'ExplicitLink' + break - case 'ImplicitOutputPort': case 'ImplicitInputPort': - style = 'ImplicitLink' - break + case 'ImplicitOutputPort': case 'ImplicitInputPort': + style = 'ImplicitLink' + break - case 'CommandPort': case 'ControlPort': - style = 'CommandControlLink' - break + case 'CommandPort': case 'ControlPort': + style = 'CommandControlLink' + break } text = style + '\n' + 'UID: ' + cell.id + '\n' + diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js index baee92d1..de42b7de 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js @@ -6,8 +6,7 @@ import mxGraphFactory from 'mxgraph' import { getRotationParameters, getPins, getPointXY, getXYPos, getSuperblockdiagram } from './ToolbarTools' const { - mxPoint, - mxUtils + mxPoint } = new mxGraphFactory() // we need to divide the svg width and height by the same number in order to maintain the aspect ratio. diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js index e2956df0..23ca543e 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js @@ -270,33 +270,33 @@ export function getRotationParameters (stylename, rotation) { export function getPins (portOrientation, v1) { let pins switch (portOrientation) { - case 'ExplicitInputPort': - v1.explicitInputPorts += 1 - pins = v1.pins?.explicitInputPorts - break - case 'ImplicitInputPort': - v1.implicitInputPorts += 1 - pins = v1.pins?.implicitInputPorts - break - case 'ControlPort': - v1.controlPorts += 1 - pins = v1.pins?.controlPorts - break - case 'ExplicitOutputPort': - v1.explicitOutputPorts += 1 - pins = v1.pins?.explicitOutputPorts - break - case 'ImplicitOutputPort': - v1.implicitOutputPorts += 1 - pins = v1.pins?.implicitOutputPorts - break - case 'CommandPort': - v1.commandPorts += 1 - pins = v1.pins?.commandPorts - break - default: - pins = null - break + case 'ExplicitInputPort': + v1.explicitInputPorts += 1 + pins = v1.pins?.explicitInputPorts + break + case 'ImplicitInputPort': + v1.implicitInputPorts += 1 + pins = v1.pins?.implicitInputPorts + break + case 'ControlPort': + v1.controlPorts += 1 + pins = v1.pins?.controlPorts + break + case 'ExplicitOutputPort': + v1.explicitOutputPorts += 1 + pins = v1.pins?.explicitOutputPorts + break + case 'ImplicitOutputPort': + v1.implicitOutputPorts += 1 + pins = v1.pins?.implicitOutputPorts + break + case 'CommandPort': + v1.commandPorts += 1 + pins = v1.pins?.commandPorts + break + default: + pins = null + break } return pins } @@ -305,26 +305,26 @@ export function getPointXY (rotationParameters) { let pointX let pointY switch (rotationParameters.rotatename) { - case 'ExplicitInputPort': - pointX = -portSize - pointY = -portSize / 2 - break - case 'ControlPort': - pointX = -portSize / 2 - pointY = -portSize - break - case 'ExplicitOutputPort': - pointX = 0 - pointY = -portSize / 2 - break - case 'CommandPort': - pointX = -portSize / 2 - pointY = 0 - break - default: - pointX = -portSize / 2 - pointY = -portSize / 2 - break + case 'ExplicitInputPort': + pointX = -portSize + pointY = -portSize / 2 + break + case 'ControlPort': + pointX = -portSize / 2 + pointY = -portSize + break + case 'ExplicitOutputPort': + pointX = 0 + pointY = -portSize / 2 + break + case 'CommandPort': + pointX = -portSize / 2 + pointY = 0 + break + default: + pointX = -portSize / 2 + pointY = -portSize / 2 + break } return { pointX, pointY } } @@ -332,27 +332,27 @@ export function getPointXY (rotationParameters) { export function getXYPos (rotationParameters, xPos, yPos) { const xPosOld = xPos switch (rotationParameters.portdirection) { - case PORTDIRECTIONS.L2T: - case PORTDIRECTIONS.T2L: - xPos = yPos - yPos = xPosOld - break - case PORTDIRECTIONS.L2R: - xPos = 1 - xPosOld - /* same yPos */ - break - case PORTDIRECTIONS.L2B: - xPos = yPos - yPos = 1 - xPosOld - break - case PORTDIRECTIONS.T2R: - xPos = 1 - yPos - yPos = xPosOld - break - case PORTDIRECTIONS.T2B: - /* same xPos */ - yPos = 1 - yPos - break + case PORTDIRECTIONS.L2T: + case PORTDIRECTIONS.T2L: + xPos = yPos + yPos = xPosOld + break + case PORTDIRECTIONS.L2R: + xPos = 1 - xPosOld + /* same yPos */ + break + case PORTDIRECTIONS.L2B: + xPos = yPos + yPos = 1 - xPosOld + break + case PORTDIRECTIONS.T2R: + xPos = 1 - yPos + yPos = xPosOld + break + case PORTDIRECTIONS.T2B: + /* same xPos */ + yPos = 1 - yPos + break } return { xPos, yPos } } diff --git a/blocks/eda-frontend/src/pages/SchematicEditor.js b/blocks/eda-frontend/src/pages/SchematicEditor.js index 358d2753..507bd6d2 100644 --- a/blocks/eda-frontend/src/pages/SchematicEditor.js +++ b/blocks/eda-frontend/src/pages/SchematicEditor.js @@ -56,7 +56,7 @@ export default function SchematicEditor (props) { const updatedDOM1 = getSuperblockdiagram(updatedXML) console.log('updatedDOM1:', typeof updatedDOM1, updatedDOM1) - const xpath = "/SuperBlockDiagram/mxGraphModel/root/mxCell[@style]" + const xpath = '/SuperBlockDiagram/mxGraphModel/root/mxCell[@style]' const xpathResult = document.evaluate( xpath, updatedDOM1, |