我想在連接的開始或結束位置添加標籤。但是在這裏我沒有找到除ManhattanMidpointLocator之外的定位器。那我該怎麼做?如何將標籤放置在連接處?
請找到下面我的代碼,如何在draw2d的特定位置添加圖形?
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";
上面的代碼顯示在(0,0)位置的標籤。 plz幫助我。
我使用Connection.getStartPoint()方法,它給了我錯誤locator.relocate()不是一個函數。請幫助我。我試圖實施relocate()方法,但它似乎不工作。 – 2012-07-19 06:33:36