client/js/renderer/edge.js
changeset 462 255b66d1ce78
parent 461 48235ed6b07d
child 532 030f2e4c0664
--- a/client/js/renderer/edge.js	Thu Jun 04 10:04:01 2015 +0200
+++ b/client/js/renderer/edge.js	Thu Jun 04 13:44:55 2015 +0200
@@ -102,20 +102,22 @@
                 _handle = _v.divide(3),
                 _color = (this.model.has("style") && this.model.get("style").color) || (this.model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"),
                 _dash = (this.model.has("style") && this.model.get("style").dash) ? this.options.default_dash_array : null,
-                opacity = 1;
+                _opacity;
 
             if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) {
-                opacity = 0.5;
+                _opacity = 0.5;
                 this.line.dashArray = [2, 2];
             } else {
-                opacity = 1;
+                _opacity = this.ghost ? this.options.ghost_opacity : 1;
                 this.line.dashArray = null;
             }
 
             var old_act_btn = this.active_buttons;
 
-            var array_opacity =
-                (this.model.has("style") && this.model.get("style").arrow) || !this.model.has("style") || (typeof this.model.get("style").arrow === 'undefined') ? opacity : 0;
+            this.arrow.visible =
+                (this.model.has("style") && this.model.get("style").arrow) ||
+                !this.model.has("style") ||
+                typeof this.model.get("style").arrow === 'undefined';
 
             this.active_buttons = this.model.get("delete_scheduled") ? this.pending_delete_buttons : this.normal_buttons;
 
@@ -128,13 +130,11 @@
                 });
             }
 
-
-
             this.paper_coords = _p0b.add(_p1b).divide(2);
             this.line.strokeWidth = _strokeWidth;
             this.line.strokeColor = _color;
             this.line.dashArray = _dash;
-            this.line.opacity = this.ghost ? 0.3 : opacity;
+            this.line.opacity = _opacity;
             this.line.segments[0].point = _p0a;
             this.line.segments[1].point = this.paper_coords;
             this.line.segments[1].handleIn = _handle.multiply(-1);
@@ -143,7 +143,7 @@
             this.arrow.scale(_arrow_scale / this.arrow_scale);
             this.arrow_scale = _arrow_scale;
             this.arrow.fillColor = _color;
-            this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name
+            this.arrow.opacity = _opacity;
             this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);
             this.arrow.position = this.paper_coords;
 
@@ -166,7 +166,7 @@
                 transform: "rotate(" + _a + "deg)",
                 "-moz-transform": "rotate(" + _a + "deg)",
                 "-webkit-transform": "rotate(" + _a + "deg)",
-                opacity: this.ghost ? 0.3 : opacity
+                opacity: _opacity
             });
             this.text_angle = _a;
 
@@ -184,7 +184,7 @@
         hide: function(){
             this.hidden = true;
             this.ghost = false;
-            
+
             this.text.hide();
             this.line.visible = false;
             this.arrow.visible = false;
@@ -199,7 +199,7 @@
                 this.minimap_line.opacity = 0.3;
             } else {
                 this.hidden = false;
-                
+
                 this.text.css('opacity', 1);
                 this.line.opacity = 1;
                 this.arrow.opacity = 1;