연결의 시작 또는 끝 위치에 레이블을 추가하고 싶습니다. 하지만 여기서는 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()는 함수가 아닙니다. 제발 도와주세요. 재배치() 메소드를 구현하려고 시도했지만 작동하지 않는 것으로 보인다. –