fix: Remove redundant code

development
ilexwg 2019-12-12 14:28:34 +08:00
parent e28c111f48
commit 7f37080cf2
2 changed files with 13 additions and 19 deletions

View File

@ -1,6 +1,6 @@
<!--
Copyright (c) 2006-2013, JGraph Ltd
Anchors example for mxGraph. This example demonstrates defining
fixed connection points for all shapes.
-->
@ -18,7 +18,7 @@
<!-- Example code -->
<script type="text/javascript">
// Overridden to define per-shape connection points
mxGraph.prototype.getAllConnectionConstraints = function(terminal, source)
{
@ -26,20 +26,17 @@
{
if (terminal.shape.stencil != null)
{
if (terminal.shape.stencil != null)
{
return terminal.shape.stencil.constraints;
}
return terminal.shape.stencil.constraints;
}
else if (terminal.shape.constraints != null)
{
return terminal.shape.constraints;
}
}
return null;
};
// Defines the default constraints for all shapes
mxShape.prototype.constraints = [new mxConnectionConstraint(new mxPoint(0.25, 0), true),
new mxConnectionConstraint(new mxPoint(0.5, 0), true),
@ -53,7 +50,7 @@
new mxConnectionConstraint(new mxPoint(0.25, 1), true),
new mxConnectionConstraint(new mxPoint(0.5, 1), true),
new mxConnectionConstraint(new mxPoint(0.75, 1), true)];
// Edges have no connection points
mxPolyline.prototype.constraints = null;
@ -76,25 +73,25 @@
// Creates the graph inside the given container
var graph = new mxGraph(container);
graph.setConnectable(true);
// Enables connect preview for the default edge style
graph.connectionHandler.createEdgeState = function(me)
{
var edge = graph.createEdge(null, null, null, null, null);
return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge));
};
// Specifies the default edge style
graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
// Enables rubberband selection
new mxRubberband(graph);
// Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0).
var parent = graph.getDefaultParent();
// Adds cells to the model in a single step
graph.getModel().beginUpdate();
try

View File

@ -19,10 +19,7 @@ window.onload = function () {
{
if (terminal.shape.stencil != null)
{
if (terminal.shape.stencil != null)
{
return terminal.shape.stencil.constraints;
}
return terminal.shape.stencil.constraints;
}
else if (terminal.shape.constraints != null)
{