100 _a = _v.angle, |
100 _a = _v.angle, |
101 _textdelta = _ortho.multiply(this.options.edge_label_distance + 0.5 * _arrow_scale * this.options.edge_arrow_width), |
101 _textdelta = _ortho.multiply(this.options.edge_label_distance + 0.5 * _arrow_scale * this.options.edge_arrow_width), |
102 _handle = _v.divide(3), |
102 _handle = _v.divide(3), |
103 _color = (this.model.has("style") && this.model.get("style").color) || (this.model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
103 _color = (this.model.has("style") && this.model.get("style").color) || (this.model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
104 _dash = (this.model.has("style") && this.model.get("style").dash) ? this.options.default_dash_array : null, |
104 _dash = (this.model.has("style") && this.model.get("style").dash) ? this.options.default_dash_array : null, |
105 opacity = 1; |
105 _opacity; |
106 |
106 |
107 if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) { |
107 if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) { |
108 opacity = 0.5; |
108 _opacity = 0.5; |
109 this.line.dashArray = [2, 2]; |
109 this.line.dashArray = [2, 2]; |
110 } else { |
110 } else { |
111 opacity = 1; |
111 _opacity = this.ghost ? this.options.ghost_opacity : 1; |
112 this.line.dashArray = null; |
112 this.line.dashArray = null; |
113 } |
113 } |
114 |
114 |
115 var old_act_btn = this.active_buttons; |
115 var old_act_btn = this.active_buttons; |
116 |
116 |
117 var array_opacity = |
117 this.arrow.visible = |
118 (this.model.has("style") && this.model.get("style").arrow) || !this.model.has("style") || (typeof this.model.get("style").arrow === 'undefined') ? opacity : 0; |
118 (this.model.has("style") && this.model.get("style").arrow) || |
|
119 !this.model.has("style") || |
|
120 typeof this.model.get("style").arrow === 'undefined'; |
119 |
121 |
120 this.active_buttons = this.model.get("delete_scheduled") ? this.pending_delete_buttons : this.normal_buttons; |
122 this.active_buttons = this.model.get("delete_scheduled") ? this.pending_delete_buttons : this.normal_buttons; |
121 |
123 |
122 if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) { |
124 if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) { |
123 old_act_btn.forEach(function(b) { |
125 old_act_btn.forEach(function(b) { |
126 this.active_buttons.forEach(function(b) { |
128 this.active_buttons.forEach(function(b) { |
127 b.show(); |
129 b.show(); |
128 }); |
130 }); |
129 } |
131 } |
130 |
132 |
131 |
|
132 |
|
133 this.paper_coords = _p0b.add(_p1b).divide(2); |
133 this.paper_coords = _p0b.add(_p1b).divide(2); |
134 this.line.strokeWidth = _strokeWidth; |
134 this.line.strokeWidth = _strokeWidth; |
135 this.line.strokeColor = _color; |
135 this.line.strokeColor = _color; |
136 this.line.dashArray = _dash; |
136 this.line.dashArray = _dash; |
137 this.line.opacity = this.ghost ? 0.3 : opacity; |
137 this.line.opacity = _opacity; |
138 this.line.segments[0].point = _p0a; |
138 this.line.segments[0].point = _p0a; |
139 this.line.segments[1].point = this.paper_coords; |
139 this.line.segments[1].point = this.paper_coords; |
140 this.line.segments[1].handleIn = _handle.multiply(-1); |
140 this.line.segments[1].handleIn = _handle.multiply(-1); |
141 this.line.segments[1].handleOut = _handle; |
141 this.line.segments[1].handleOut = _handle; |
142 this.line.segments[2].point = _p1a; |
142 this.line.segments[2].point = _p1a; |
143 this.arrow.scale(_arrow_scale / this.arrow_scale); |
143 this.arrow.scale(_arrow_scale / this.arrow_scale); |
144 this.arrow_scale = _arrow_scale; |
144 this.arrow_scale = _arrow_scale; |
145 this.arrow.fillColor = _color; |
145 this.arrow.fillColor = _color; |
146 this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name |
146 this.arrow.opacity = _opacity; |
147 this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center); |
147 this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center); |
148 this.arrow.position = this.paper_coords; |
148 this.arrow.position = this.paper_coords; |
149 |
149 |
150 this.arrow_angle = _a; |
150 this.arrow_angle = _a; |
151 if (_a > 90) { |
151 if (_a > 90) { |
164 left: _textpos.x, |
164 left: _textpos.x, |
165 top: _textpos.y, |
165 top: _textpos.y, |
166 transform: "rotate(" + _a + "deg)", |
166 transform: "rotate(" + _a + "deg)", |
167 "-moz-transform": "rotate(" + _a + "deg)", |
167 "-moz-transform": "rotate(" + _a + "deg)", |
168 "-webkit-transform": "rotate(" + _a + "deg)", |
168 "-webkit-transform": "rotate(" + _a + "deg)", |
169 opacity: this.ghost ? 0.3 : opacity |
169 opacity: _opacity |
170 }); |
170 }); |
171 this.text_angle = _a; |
171 this.text_angle = _a; |
172 |
172 |
173 var _pc = this.paper_coords; |
173 var _pc = this.paper_coords; |
174 this.all_buttons.forEach(function(b) { |
174 this.all_buttons.forEach(function(b) { |
197 this.line.opacity = 0.3; |
197 this.line.opacity = 0.3; |
198 this.arrow.opacity = 0.3; |
198 this.arrow.opacity = 0.3; |
199 this.minimap_line.opacity = 0.3; |
199 this.minimap_line.opacity = 0.3; |
200 } else { |
200 } else { |
201 this.hidden = false; |
201 this.hidden = false; |
202 |
202 |
203 this.text.css('opacity', 1); |
203 this.text.css('opacity', 1); |
204 this.line.opacity = 1; |
204 this.line.opacity = 1; |
205 this.arrow.opacity = 1; |
205 this.arrow.opacity = 1; |
206 this.minimap_line.opacity = 1; |
206 this.minimap_line.opacity = 1; |
207 } |
207 } |