I want to add label at start or end position of connection. But here I did not found locator except ManhattanMidpointLocator. So how can I do this? How can I place label at where on connection?
Please find my code as below,
draw2d.LabelConnection = function() {
draw2d.Connection.call(this);
this.sourcePort = null;
this.targetPort = null;
this.lineSegments = [];
this.setColor(new draw2d.Color(0, 255, 0));
this.setLineWidth(2);
var label = new draw2d.Label("Message");
label.setBackgroundColor(new draw2d.Color(230, 230, 250));
label.setBorder(new draw2d.LineBorder(1));
this.addFigure(label, new draw2d.Locator());
};
draw2d.LabelConnection.prototype = new draw2d.Connection();
draw2d.LabelConnection.prototype.type = "draw2d.LabelConnection";
The above code shows label at (0,0) position. plz help me out.
Use:
Connection.getStartPoint() to determine the start poit of the connection instead to retrieve all segments of the connection.
Greetings