summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorjiteshjha2016-07-06 12:46:46 +0530
committerjiteshjha2016-07-06 12:46:46 +0530
commit91acba8d34158b30a663457247b3865881bb116d (patch)
tree5df71910de232e196c5317355de3feb9dc497dfd /index.html
parentc9d07007e241508b3cdbb589bf074340afb05a38 (diff)
downloadxcos-on-web-91acba8d34158b30a663457247b3865881bb116d.tar.gz
xcos-on-web-91acba8d34158b30a663457247b3865881bb116d.tar.bz2
xcos-on-web-91acba8d34158b30a663457247b3865881bb116d.zip
Added explanation for the function
Diffstat (limited to 'index.html')
-rw-r--r--index.html30
1 files changed, 28 insertions, 2 deletions
diff --git a/index.html b/index.html
index 9c1cedb..683bf30 100644
--- a/index.html
+++ b/index.html
@@ -610,22 +610,48 @@
}
else {
+ /*
+ * For reverse edges, (that is, edges from input port to outport) :
+ * If the source is input port, and target is an output port
+ * NOTE: Manipulation of source object and target object
+ * with respect to current edge is not possible,
+ * as mxGraph.prototype.addEdge(@parameters) function is
+ * called just before the creation of the edge.
+ * Hence, the following code creates a identical new edge
+ * to replace the current edge.
+ */
+
if((source.value.indexOf('Input') != -1 && target.value.indexOf('Output') != -1)
|| (target.value == 'CommandPort' && source.value == 'ControlPort')) {
- console.log('sdsd');
+
+ // Begin graph DOM update
graph.getModel().beginUpdate();
+
try {
+
+ // Insert new edge in place of current edge
var newEdge = graph.insertEdge(parent, null, '', target, source);
+
+ // Get points for the current edge from the global edgeState object
var waypoints = edgeState.absolutePoints;
+
+ // Reverse waypoint array
waypoints.reverse();
+
+ // Set the points for the new edge
newEdge.geometry.points = waypoints;
}
finally {
graph.getModel().endUpdate();
}
+ // Return null for the current edge,
+
+ /*
+ * Return null for the current edge,
+ * since we have created a new edge above to replace it
+ */
return null;
- console.log('dsd');
}
// If the edge is legit, return the edge.
return mxGraph.prototype.addEdge.apply(this, arguments);