summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuchita Lad2025-06-05 15:59:05 +0530
committerSuchita Lad2025-06-05 15:59:05 +0530
commit93d0cce84bd1f69849ea81ee8b6ca1be7508840d (patch)
tree251f7722ffb6c33f96326530b2b81668211780c3
parentde7a74c5fb9d0dd15799f81889e5432e5ecb697d (diff)
downloadCommon-Interface-Project-93d0cce84bd1f69849ea81ee8b6ca1be7508840d.tar.gz
Common-Interface-Project-93d0cce84bd1f69849ea81ee8b6ca1be7508840d.tar.bz2
Common-Interface-Project-93d0cce84bd1f69849ea81ee8b6ca1be7508840d.zip
Added edge adding code to subdiagram of super_f block
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js28
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js2
-rw-r--r--blocks/eda-frontend/src/redux/saveSchematicSlice.js2
3 files changed, 29 insertions, 3 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
index f435ce7a..fd59ae5b 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
@@ -88,6 +88,20 @@ export function getCurrentDiagramXML () {
return mxUtils.getXml(node)
}
+function getXY (cell) {
+ let x, y
+
+ if (cell.geometry?.relative === true && cell.parent?.geometry) {
+ x = cell.parent.geometry.x + (cell.geometry.x * cell.parent.geometry.width)
+ y = cell.parent.geometry.y + (cell.geometry.y * cell.parent.geometry.height)
+ } else {
+ x = cell.geometry.x
+ y = cell.geometry.y
+ }
+
+ return [x, y]
+}
+
export default function loadGrid (container, sidebar, outline, setMainDiagramBackup, setActiveSuperBlockCell) {
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
@@ -265,10 +279,22 @@ export default function loadGrid (container, sidebar, outline, setMainDiagramBac
if (source == null || target == null) {
return null
}
+ const edge = mxGraph.prototype.addEdge.apply(this, arguments)
+
+ const [tarx, tary] = getXY(source)
+ const [tar2x, tar2y] = getXY(target)
- return mxGraph.prototype.addEdge.apply(this, arguments)
+ edge.sourceVertex = source.id
+ edge.targetVertex = target.id
+ edge.tarx = tarx
+ edge.tary = tary
+ edge.tar2x = tar2x
+ edge.tar2y = tar2y
+
+ return edge
}
+
// Adds a special tooltip for edges
graph.setTooltips(true)
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js b/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
index 29bfd009..e585f489 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
@@ -358,7 +358,7 @@ export default function SchematicToolbar ({ _mobileClose, gridRef }) {
}
const readXmlFile = (xmlDoc, dataDump, title) => {
- const firstCell = xmlDoc.documentElement.children[0].children[0]
+ const firstCell = xmlDoc.documentElement.children[0].children[0].children[0]
const firstCellAttrs = firstCell.attributes
const appname = firstCellAttrs.appname.value
const description = (firstCellAttrs.description !== undefined) ? firstCellAttrs.description.value : ''
diff --git a/blocks/eda-frontend/src/redux/saveSchematicSlice.js b/blocks/eda-frontend/src/redux/saveSchematicSlice.js
index a36b9468..282b0b57 100644
--- a/blocks/eda-frontend/src/redux/saveSchematicSlice.js
+++ b/blocks/eda-frontend/src/redux/saveSchematicSlice.js
@@ -262,7 +262,7 @@ const saveSchematicSlice = createSlice({
state.description = action.payload.description
state.isSaved = true
state.isShared = action.payload.shared
- state.title = action.payload.name
+ state.title = action.payload.title
state.xmlData = action.payload.data_dump
state.scriptDump = action.payload.script_dump
state.showDot = action.payload.script_dump !== ''