remove magical constant, put ghost opacity in the defaults.
--- a/client/js/defaults.js Thu Jun 04 10:04:01 2015 +0200
+++ b/client/js/defaults.js Thu Jun 04 13:44:55 2015 +0200
@@ -86,7 +86,10 @@
buttons_label_color: "#c000c0",
buttons_label_font_size: 9,
+ ghost_opacity : 0.3,
+ /* opacity when the hidden element is revealed */
default_dash_array : [4, 5],
+ /* dash line genometry */
/* NODE DISPLAY OPTIONS */
--- 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;
--- a/client/js/renderer/noderepr.js Thu Jun 04 10:04:01 2015 +0200
+++ b/client/js/renderer/noderepr.js Thu Jun 04 13:44:55 2015 +0200
@@ -417,14 +417,14 @@
this.ghost = false;
this.hidden = true;
if (typeof this.node_image !== 'undefined'){
- this.node_image.opacity = 0;
+ this.node_image.opacity = 0;
}
this.hideButtons();
this.circle.opacity = 0;
this.title.css('opacity', 0);
this.minimap_circle.opacity = 0;
-
-
+
+
_.each(
this.project.get("edges").filter(
function (ed) {
@@ -445,16 +445,16 @@
this.ghost = ghost;
if (this.ghost){
if (typeof this.node_image !== 'undefined'){
- this.node_image.opacity = 0.3;
+ this.node_image.opacity = this.options.ghost_opacity;
}
- this.circle.opacity = 0.3;
- this.title.css('opacity', 0.3);
- this.minimap_circle.opacity = 0.3;
+ this.circle.opacity = this.options.ghost_opacity;
+ this.title.css('opacity', this.options.ghost_opacity);
+ this.minimap_circle.opacity = this.options.ghost_opacity;
} else {
this.hidden = false;
this.redraw();
}
-
+
_.each(
this.project.get("edges").filter(
function (ed) {
@@ -467,7 +467,7 @@
repr.show(_this.ghost);
}
}
- );
+ );
},
hideNeighbors: function(){
var _this = this;
--- a/client/templates/scene.html Thu Jun 04 10:04:01 2015 +0200
+++ b/client/templates/scene.html Thu Jun 04 13:44:55 2015 +0200
@@ -129,7 +129,7 @@
<% } %>
<div class="Rk-Editing-Space<% if (!options.show_top_bar) { %> Rk-Editing-Space-Full<% } %>">
<div class="Rk-Labels"></div>
- <canvas class="Rk-Canvas" <% if (options.resize) { %> resize="" <% } %>></canvas>
+ <canvas class="Rk-Canvas" <% if (options.resize) { %> resize="" <% } %> ></canvas>
<div class="Rk-Notifications"></div>
<div class="Rk-Editor">
<% if (options.show_bins) { %>