Browse Source

Merge branch 'develop' of https://github.com/almende/vis into develop

css_transitions
Alex de Mulder 10 years ago
parent
commit
28089c244f
4 changed files with 18 additions and 4 deletions
  1. +6
    -3
      dist/vis.js
  2. +8
    -0
      docs/graph.html
  3. +3
    -1
      src/graph/Edge.js
  4. +1
    -0
      src/graph/Graph.js

+ 6
- 3
dist/vis.js View File

@ -4,8 +4,8 @@
* *
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 0.7.3-SNAPSHOT
* @date 2014-04-14
* @version @@version
* @date @@date
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -10515,10 +10515,12 @@ Edge.prototype.setProperties = function(properties, constants) {
this.fontSize = constants.edges.fontSize; this.fontSize = constants.edges.fontSize;
this.fontFace = constants.edges.fontFace; this.fontFace = constants.edges.fontFace;
this.fontColor = constants.edges.fontColor; this.fontColor = constants.edges.fontColor;
this.fontFill = constants.edges.fontFill;
if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;}
if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;}
if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;}
if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;}
} }
if (properties.title !== undefined) {this.title = properties.title;} if (properties.title !== undefined) {this.title = properties.title;}
@ -10782,7 +10784,7 @@ Edge.prototype._label = function (ctx, text, x, y) {
// TODO: cache the calculated size // TODO: cache the calculated size
ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") + ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") +
this.fontSize + "px " + this.fontFace; this.fontSize + "px " + this.fontFace;
ctx.fillStyle = 'white';
ctx.fillStyle = this.fontFill;
var width = ctx.measureText(text).width; var width = ctx.measureText(text).width;
var height = this.fontSize; var height = this.fontSize;
var left = x - width / 2; var left = x - width / 2;
@ -16091,6 +16093,7 @@ function Graph (container, data, options) {
fontColor: '#343434', fontColor: '#343434',
fontSize: 14, // px fontSize: 14, // px
fontFace: 'arial', fontFace: 'arial',
fontFill: 'white',
dash: { dash: {
length: 10, length: 10,
gap: 5, gap: 5,

+ 8
- 0
docs/graph.html View File

@ -574,6 +574,14 @@ var edges = [
Only applicable when property <code>label</code> is defined.</td> Only applicable when property <code>label</code> is defined.</td>
</tr> </tr>
<tr>
<td>fontFill</td>
<td>string</td>
<td>no</td>
<td>Font fill for the background color of the text label of the edge.
Only applicable when property <code>label</code> is defined.</td>
</tr>
<tr> <tr>
<td>from</td> <td>from</td>
<td>Number | String</td> <td>Number | String</td>

+ 3
- 1
src/graph/Edge.js View File

@ -81,10 +81,12 @@ Edge.prototype.setProperties = function(properties, constants) {
this.fontSize = constants.edges.fontSize; this.fontSize = constants.edges.fontSize;
this.fontFace = constants.edges.fontFace; this.fontFace = constants.edges.fontFace;
this.fontColor = constants.edges.fontColor; this.fontColor = constants.edges.fontColor;
this.fontFill = constants.edges.fontFill;
if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;} if (properties.fontColor !== undefined) {this.fontColor = properties.fontColor;}
if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;} if (properties.fontSize !== undefined) {this.fontSize = properties.fontSize;}
if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;} if (properties.fontFace !== undefined) {this.fontFace = properties.fontFace;}
if (properties.fontFill !== undefined) {this.fontFill = properties.fontFill;}
} }
if (properties.title !== undefined) {this.title = properties.title;} if (properties.title !== undefined) {this.title = properties.title;}
@ -348,7 +350,7 @@ Edge.prototype._label = function (ctx, text, x, y) {
// TODO: cache the calculated size // TODO: cache the calculated size
ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") + ctx.font = ((this.from.selected || this.to.selected) ? "bold " : "") +
this.fontSize + "px " + this.fontFace; this.fontSize + "px " + this.fontFace;
ctx.fillStyle = 'white';
ctx.fillStyle = this.fontFill;
var width = ctx.measureText(text).width; var width = ctx.measureText(text).width;
var height = this.fontSize; var height = this.fontSize;
var left = x - width / 2; var left = x - width / 2;

+ 1
- 0
src/graph/Graph.js View File

@ -72,6 +72,7 @@ function Graph (container, data, options) {
fontColor: '#343434', fontColor: '#343434',
fontSize: 14, // px fontSize: 14, // px
fontFace: 'arial', fontFace: 'arial',
fontFill: 'white',
dash: { dash: {
length: 10, length: 10,
gap: 5, gap: 5,

Loading…
Cancel
Save