1 // this is really just a test overlay, so its undocumented and doesnt take any parameters. but i was loth to delete it.
2 jsPlumb.Overlays.GuideLines = function() {
6 this.type = "GuideLines";
7 AbstractOverlay.apply(this, arguments);
8 jsPlumb.jsPlumbUIComponent.apply(this, arguments);
9 this.draw = function(connector, currentConnectionPaintStyle, connectorDimensions) {
11 var head = connector.pointAlongPathFrom(self.loc, self.length / 2),
12 mid = connector.pointOnPath(self.loc),
13 tail = jsPlumbGeom.pointOnLine(head, mid, self.length),
14 tailLine = jsPlumbGeom.perpendicularLineTo(head, tail, 40),
15 headLine = jsPlumbGeom.perpendicularLineTo(tail, head, 20);
17 self.paint(connector, [head, tail, tailLine, headLine], self.lineWidth, "red", null, connectorDimensions);
19 return [Math.min(head.x, tail.x), Math.min(head.y, tail.y), Math.max(head.x, tail.x), Math.max(head.y,tail.y)];
22 this.computeMaxSize = function() { return 50; };
24 this.cleanup = function() { }; // nothing to clean up for GuideLines
28 jsPlumb.Overlays.svg.GuideLines = function() {
29 var path = null, self = this, path2 = null, p1_1, p1_2;
30 jsPlumb.Overlays.GuideLines.apply(this, arguments);
31 this.paint = function(connector, d, lineWidth, strokeStyle, fillStyle) {
34 connector.svg.appendChild(path);
35 self.attachListeners(path, connector);
36 self.attachListeners(path, self);
39 connector.svg.appendChild(p1_1);
40 self.attachListeners(p1_1, connector);
41 self.attachListeners(p1_1, self);
44 connector.svg.appendChild(p1_2);
45 self.attachListeners(p1_2, connector);
46 self.attachListeners(p1_2, self);
51 "d" : makePath(d[0], d[1]),
57 "d" : makePath(d[2][0], d[2][1]),
63 "d" : makePath(d[3][0], d[3][1]),
69 var makePath = function(d1, d2) {
70 return "M " + d1.x + "," + d1.y +
71 " L" + d2.x + "," + d2.y;