diff -r 5e0746deaf0d -r fdff56da097d client/js/renderer/edge.js --- a/client/js/renderer/edge.js Tue Jul 26 18:24:33 2016 +0200 +++ b/client/js/renderer/edge.js Wed Jul 27 13:55:18 2016 +0200 @@ -15,6 +15,7 @@ this.type = "Edge"; this.hidden = false; this.ghost = false; + this.highlighted = false; this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); this.bundle = this.renderer.addToBundles(this); @@ -73,7 +74,7 @@ }, redraw: function() { var from = this.model.get("from"), - to = this.model.get("to"); + to = this.model.get("to"); if (!from || !to || (this.hidden && !this.ghost)) { return; } @@ -100,7 +101,9 @@ _a = _v.angle, _textdelta = _ortho.multiply(this.options.edge_label_distance + 0.5 * _arrow_scale * this.options.edge_arrow_width), _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"), + _color = (this.highlighted && this.options.highlighted_edge_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; @@ -158,7 +161,11 @@ } var _text = this.model.get("title") || this.renkan.translate(this.options.label_untitled_edges) || ""; _text = Utils.shortenText(_text, this.options.node_label_max_length); - this.text.text(_text); + if (typeof this.highlighted === "object") { + this.text.html(this.highlighted.replace(_(_text).escape(),'$1')); + } else { + this.text.text(_text); + } var _textpos = this.paper_coords.add(_textdelta); this.text.css({ left: _textpos.x, @@ -276,6 +283,23 @@ this.renderer.paperShift(_delta); } }, + highlight: function(textToReplace) { + var hlvalue = textToReplace || true; + if (this.highlighted === hlvalue) { + return; + } + this.highlighted = hlvalue; + this.redraw(); + this.renderer.throttledPaperDraw(); + }, + unhighlight: function() { + if (!this.highlighted) { + return; + } + this.highlighted = false; + this.redraw(); + this.renderer.throttledPaperDraw(); + }, destroy: function() { this._super("destroy"); this.line.remove();