Permalink
Browse files

Fix Linkurious/linkurious.js#7

  • Loading branch information...
1 parent 18af075 commit 33542131794780487eb5a8238b6ba9f3656fcce6 @sheymann sheymann committed Sep 9, 2014
@@ -21,6 +21,10 @@ This plugin extends Sigma.js settings in a transparent way to render edge labels
* type: *string*
* default value: `#000`
+ * **defaultEdgeLabelActiveColor**
+ * type: *string*
+ * default value: `rgb(236, 81, 72)`
+
* **defaultEdgeLabelSize**
* type: *number*
* default value: `10`
@@ -66,3 +70,7 @@ This plugin provides the following edge label renderers:
- `arrow` (use default)
- `curve`
- `curvedArrow`
+
+## Compatibility
+
+This plugin is compatible with `sigma.plugins.activeState`.
@@ -18,6 +18,8 @@
// {string}
defaultEdgeLabelColor: '#000',
// {string}
+ defaultEdgeLabelActiveColor: '#000',
+ // {string}
defaultEdgeLabelSize: 10,
// {string} Indicates how to choose the edge labels size. Available values:
// "fixed", "proportional"
@@ -70,11 +70,31 @@
context.save();
- context.font = (settings('fontStyle') ? settings('fontStyle') + ' ' : '') +
- fontSize + 'px ' + settings('font');
- context.fillStyle = (settings('edgeLabelColor') === 'edge') ?
- (edge.color || settings('defaultEdgeColor')) :
- settings('defaultEdgeLabelColor');
+
+ if (edge.active) {
+ context.font = [
+ settings('activeFontStyle'),
+ fontSize + 'px',
+ settings('activeFont') || settings('font')
+ ].join(' ');
+
+ context.fillStyle =
+ settings('edgeActiveColor') === 'edge' ?
+ (edge.active_color || settings('defaultEdgeActiveColor')) :
+ settings('defaultEdgeLabelActiveColor');
+ }
+ else {
+ context.font = [
+ settings('fontStyle'),
+ fontSize + 'px',
+ settings('font')
+ ].join(' ');
+
+ context.fillStyle =
+ (settings('edgeLabelColor') === 'edge') ?
+ (edge.color || settings('defaultEdgeColor')) :
+ settings('defaultEdgeLabelColor');
+ }
context.textAlign = 'center';
context.textBaseline = 'alphabetic';
@@ -55,11 +55,30 @@
context.save();
- context.font = (settings('fontStyle') ? settings('fontStyle') + ' ' : '') +
- fontSize + 'px ' + settings('font');
- context.fillStyle = (settings('edgeLabelColor') === 'edge') ?
- (edge.color || settings('defaultEdgeColor')) :
- settings('defaultEdgeLabelColor');
+ if (edge.active) {
+ context.font = [
+ settings('activeFontStyle'),
+ fontSize + 'px',
+ settings('activeFont') || settings('font')
+ ].join(' ');
+
+ context.fillStyle =
+ settings('edgeActiveColor') === 'edge' ?
+ (edge.active_color || settings('defaultEdgeActiveColor')) :
+ settings('defaultEdgeLabelActiveColor');
+ }
+ else {
+ context.font = [
+ settings('fontStyle'),
+ fontSize + 'px',
+ settings('font')
+ ].join(' ');
+
+ context.fillStyle =
+ (settings('edgeLabelColor') === 'edge') ?
+ (edge.color || settings('defaultEdgeColor')) :
+ settings('defaultEdgeLabelColor');
+ }
context.textAlign = 'center';
context.textBaseline = 'alphabetic';

0 comments on commit 3354213

Please sign in to comment.