65 this.to_representation = this.renderer.getRepresentationByModel(to); |
65 this.to_representation = this.renderer.getRepresentationByModel(to); |
66 if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") { |
66 if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") { |
67 return; |
67 return; |
68 } |
68 } |
69 var _p0a = this.from_representation.paper_coords, |
69 var _p0a = this.from_representation.paper_coords, |
70 _p1a = this.to_representation.paper_coords, |
70 _p1a = this.to_representation.paper_coords, |
71 _v = _p1a.subtract(_p0a), |
71 _v = _p1a.subtract(_p0a), |
72 _r = _v.length, |
72 _r = _v.length, |
73 _u = _v.divide(_r), |
73 _u = _v.divide(_r), |
74 _ortho = new paper.Point([- _u.y, _u.x]), |
74 _ortho = new paper.Point([- _u.y, _u.x]), |
75 _group_pos = this.bundle.getPosition(this), |
75 _group_pos = this.bundle.getPosition(this), |
76 _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ), |
76 _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ), |
77 _p0b = _p0a.add(_delta), /* Adding a 4 px difference */ |
77 _p0b = _p0a.add(_delta), /* Adding a 4 px difference */ |
78 _p1b = _p1a.add(_delta), /* to differentiate bundled links */ |
78 _p1b = _p1a.add(_delta), /* to differentiate bundled links */ |
79 _a = _v.angle, |
79 _a = _v.angle, |
80 _textdelta = _ortho.multiply(this.options.edge_label_distance), |
80 _textdelta = _ortho.multiply(this.options.edge_label_distance), |
81 _handle = _v.divide(3), |
81 _handle = _v.divide(3), |
82 _color = this.model.get("color") || this.model.get("color") || (this.model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
82 _color = (this.model.has("style") && this.model.get("style").color) || (this.model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
83 opacity = 1; |
83 _dash = (this.model.has("style") && this.model.get("style").dash) ? this.options.default_dash_array : null, |
|
84 opacity = 1; |
84 |
85 |
85 if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) { |
86 if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) { |
86 opacity = 0.5; |
87 opacity = 0.5; |
87 this.line.dashArray = [2, 2]; |
88 this.line.dashArray = [2, 2]; |
88 } else { |
89 } else { |
101 this.active_buttons.forEach(function(b) { |
102 this.active_buttons.forEach(function(b) { |
102 b.show(); |
103 b.show(); |
103 }); |
104 }); |
104 } |
105 } |
105 |
106 |
|
107 |
|
108 |
106 this.paper_coords = _p0b.add(_p1b).divide(2); |
109 this.paper_coords = _p0b.add(_p1b).divide(2); |
107 this.line.strokeColor = _color; |
110 this.line.strokeColor = _color; |
|
111 this.line.dashArray = _dash; |
108 this.line.opacity = opacity; |
112 this.line.opacity = opacity; |
109 this.line.segments[0].point = _p0a; |
113 this.line.segments[0].point = _p0a; |
110 this.line.segments[1].point = this.paper_coords; |
114 this.line.segments[1].point = this.paper_coords; |
111 this.line.segments[1].handleIn = _handle.multiply(-1); |
115 this.line.segments[1].handleIn = _handle.multiply(-1); |
112 this.line.segments[1].handleOut = _handle; |
116 this.line.segments[1].handleOut = _handle; |