summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2025-06-18 21:59:56 +0530
committerSunil Shetye2025-06-18 21:59:56 +0530
commit5409bb421d3ae3044fc87b467a5f5e5d35242791 (patch)
treeaf25b85bcfa19adbd229622f7a0471ae0f354f2d
parent9c8d1e15b1cb94970c20c27246e1ee10ad3b2ee3 (diff)
downloadCommon-Interface-Project-5409bb421d3ae3044fc87b467a5f5e5d35242791.tar.gz
Common-Interface-Project-5409bb421d3ae3044fc87b467a5f5e5d35242791.tar.bz2
Common-Interface-Project-5409bb421d3ae3044fc87b467a5f5e5d35242791.zip
ignore port rotation in SvgParser also
-rw-r--r--blocks/blocks/xcosblocks/fixtures/xcosblocks.yaml4
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js15
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js28
3 files changed, 7 insertions, 40 deletions
diff --git a/blocks/blocks/xcosblocks/fixtures/xcosblocks.yaml b/blocks/blocks/xcosblocks/fixtures/xcosblocks.yaml
index b36c8f3f..1ecb3c57 100644
--- a/blocks/blocks/xcosblocks/fixtures/xcosblocks.yaml
+++ b/blocks/blocks/xcosblocks/fixtures/xcosblocks.yaml
@@ -13082,8 +13082,8 @@
port_order: 1
port_name: '1'
port_number: '1'
- port_x: -20
- port_y: 0
+ port_x: 0
+ port_y: -20
port_orientation: ImplicitInputPort
port_part: 1
port_dmg: 1
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js
index 3fde9af5..37eb18f6 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js
@@ -3,7 +3,7 @@ import 'mxgraph/javascript/src/css/common.css'
import mxGraphFactory from 'mxgraph'
-import { getRotationParameters, getPins, getPointXY, getXYPos, getSuperBlockDiagram } from './ToolbarTools'
+import { getRotationParameters, getPins, getPointXY, getSuperBlockDiagram } from './ToolbarTools'
import { updateMxGraphXML } from '../../../utils/GalleryUtils'
const {
@@ -73,23 +73,18 @@ export function getSvgMetadata (graph, parent, evt, target, x, y, component) {
if (!allowedDmg.includes(blockport.port_dmg)) { continue }
if (blockport.port_name === 'NC') { continue }
- let xPos = 1 / 2 + blockport.port_x / defaultScale / width
- let yPos = 1 / 2 + blockport.port_y / defaultScale / height
+ const xPos = 1 / 2 + blockport.port_x / defaultScale / width
+ const yPos = 1 / 2 + blockport.port_y / defaultScale / height
const portOrientation = blockport.port_orientation
- const portRotation = blockport.port_rotation
- const rotationParameters = getRotationParameters(portOrientation, portRotation)
+ const rotationParameters = getRotationParameters(portOrientation)
const pins = getPins(portOrientation, v1)
- const pointXY = getPointXY(rotationParameters)
+ const pointXY = getPointXY(rotationParameters, blockName)
const pointX = pointXY.pointX
const pointY = pointXY.pointY
- const xyPos = getXYPos(rotationParameters, xPos, yPos)
- xPos = xyPos.xPos
- yPos = xyPos.yPos
-
const point = new mxPoint(pointX, pointY)
const vp = graph.insertVertex(v1, null, null, xPos, yPos, portSize, portSize, portOrientation)
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
index beaef60b..48c26199 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
@@ -322,34 +322,6 @@ export function getPointXY (rotationParameters, blockname) {
return { pointX, pointY }
}
-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
- }
- return { xPos, yPos }
-}
-
export function getSuperBlockDiagram (xml) {
xml = '<SuperBlockDiagram as="child" background="-1" title="">' + xml + '</SuperBlockDiagram>'
const superBlockDiagram = mxUtils.parseXml(xml)