Browse Source

- Added labelHighlightBold option to edges and nodes.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
78c5f38568
9 changed files with 26174 additions and 26146 deletions
  1. +1
    -0
      HISTORY.md
  2. +26150
    -26144
      dist/vis.js
  3. +7
    -0
      docs/network/edges.html
  4. +7
    -0
      docs/network/nodes.html
  5. +1
    -0
      lib/network/modules/EdgesHandler.js
  6. +1
    -0
      lib/network/modules/NodesHandler.js
  7. +1
    -0
      lib/network/modules/components/Edge.js
  8. +2
    -2
      lib/network/modules/components/shared/Label.js
  9. +4
    -0
      lib/network/options.js

+ 1
- 0
HISTORY.md View File

@ -26,6 +26,7 @@ http://visjs.org
- Added getDataset to all manipulation functions. Thanks @ericvandever! - Added getDataset to all manipulation functions. Thanks @ericvandever!
- Fixed #1039, icon now returns correct distance to border - Fixed #1039, icon now returns correct distance to border
- Added blurEdge and hoverEdge events. - Added blurEdge and hoverEdge events.
- Added labelHighlightBold option to edges and nodes.
### Graph2d ### Graph2d

+ 26150
- 26144
dist/vis.js
File diff suppressed because it is too large
View File


+ 7
- 0
docs/network/edges.html View File

@ -125,6 +125,7 @@ var options = {
hidden: false, hidden: false,
hoverWidth: 1.5, hoverWidth: 1.5,
label: undefined, label: undefined,
labelHighlightBold: true,
length: undefined, length: undefined,
physics: true, physics: true,
scaling:{ scaling:{
@ -407,6 +408,12 @@ var options: {
<td><code>undefined</code></td> <td><code>undefined</code></td>
<td>The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.</td> <td>The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.</td>
</tr> </tr>
<tr>
<td>labelHighlightBold</td>
<td>Boolean</td>
<td><code>true</code></td>
<td>Determines whether or not the label becomes bold when the edge is selected.</td>
</tr>
<tr> <tr>
<td>length</td> <td>length</td>
<td>Number</td> <td>Number</td>

+ 7
- 0
docs/network/nodes.html View File

@ -129,6 +129,7 @@ var options = {
}, },
image: undefined, image: undefined,
label: undefined, label: undefined,
labelHighlightBold: true,
level: undefined, level: undefined,
mass: 1, mass: 1,
physics: true, physics: true,
@ -414,6 +415,12 @@ network.setOptions(options);
<td><code>undefined</code></td> <td><code>undefined</code></td>
<td>The label is the piece of text shown in or under the node, depending on the shape.</td> <td>The label is the piece of text shown in or under the node, depending on the shape.</td>
</tr> </tr>
<tr>
<td>labelHighlightBold</td>
<td>Boolean</td>
<td><code>true</code></td>
<td>Determines whether or not the label becomes bold when the node is selected.</td>
</tr>
<tr> <tr>
<td>level</td> <td>level</td>
<td>Number</td> <td>Number</td>

+ 1
- 0
lib/network/modules/EdgesHandler.js View File

@ -47,6 +47,7 @@ class EdgesHandler {
hidden: false, hidden: false,
hoverWidth: 1.5, hoverWidth: 1.5,
label: undefined, label: undefined,
labelHighlightBold: true,
length: undefined, length: undefined,
physics: true, physics: true,
scaling:{ scaling:{

+ 1
- 0
lib/network/modules/NodesHandler.js View File

@ -61,6 +61,7 @@ class NodesHandler {
}, },
image: undefined, // --> URL image: undefined, // --> URL
label: undefined, label: undefined,
labelHighlightBold: true,
level: undefined, level: undefined,
mass: 1, mass: 1,
physics: true, physics: true,

+ 1
- 0
lib/network/modules/components/Edge.js View File

@ -98,6 +98,7 @@ class Edge {
'hidden', 'hidden',
'hoverWidth', 'hoverWidth',
'label', 'label',
'labelHighlightBold',
'length', 'length',
'line', 'line',
'opacity', 'opacity',

+ 2
- 2
lib/network/modules/components/shared/Label.js View File

@ -120,7 +120,7 @@ class Label {
[x, yLine] = this._setAlignment(ctx, x, yLine, baseline); [x, yLine] = this._setAlignment(ctx, x, yLine, baseline);
// configure context for drawing the text // configure context for drawing the text
ctx.font = (selected ? 'bold ' : '') + fontSize + "px " + this.options.font.face;
ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + fontSize + "px " + this.options.font.face;
ctx.fillStyle = fontColor; ctx.fillStyle = fontColor;
ctx.textAlign = 'center'; ctx.textAlign = 'center';
@ -244,7 +244,7 @@ class Label {
if (this.options.label !== undefined) { if (this.options.label !== undefined) {
lines = String(this.options.label).split('\n'); lines = String(this.options.label).split('\n');
lineCount = lines.length; lineCount = lines.length;
ctx.font = (selected ? 'bold ' : '') + this.options.font.size + "px " + this.options.font.face;
ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + this.options.font.size + "px " + this.options.font.face;
width = ctx.measureText(lines[0]).width; width = ctx.measureText(lines[0]).width;
for (let i = 1; i < lineCount; i++) { for (let i = 1; i < lineCount; i++) {
let lineWidth = ctx.measureText(lines[i]).width; let lineWidth = ctx.measureText(lines[i]).width;

+ 4
- 0
lib/network/options.js View File

@ -51,6 +51,7 @@ let allOptions = {
hidden: {boolean}, hidden: {boolean},
hoverWidth: {'function': 'function',number}, hoverWidth: {'function': 'function',number},
label: {string,'undefined': 'undefined'}, label: {string,'undefined': 'undefined'},
labelHighlightBold: {boolean},
length: {number,'undefined': 'undefined'}, length: {number,'undefined': 'undefined'},
physics: {boolean}, physics: {boolean},
scaling: { scaling: {
@ -181,6 +182,7 @@ let allOptions = {
id: {string, number}, id: {string, number},
image: {string,'undefined': 'undefined'}, // --> URL image: {string,'undefined': 'undefined'}, // --> URL
label: {string,'undefined': 'undefined'}, label: {string,'undefined': 'undefined'},
labelHighlightBold: {boolean},
level: {number,'undefined': 'undefined'}, level: {number,'undefined': 'undefined'},
mass: {number}, mass: {number},
physics: {boolean}, physics: {boolean},
@ -311,6 +313,7 @@ let configureOptions = {
}, },
//group: 'string', //group: 'string',
hidden: false, hidden: false,
labelHighlightBold: true,
//icon: { //icon: {
// face: 'string', //'FontAwesome', // face: 'string', //'FontAwesome',
// code: 'string', //'\uf007', // code: 'string', //'\uf007',
@ -364,6 +367,7 @@ let configureOptions = {
}, },
hidden: false, hidden: false,
hoverWidth: [1.5, 0, 5, 0.1], hoverWidth: [1.5, 0, 5, 0.1],
labelHighlightBold: true,
physics: true, physics: true,
scaling: { scaling: {
min: [1, 0, 100, 1], min: [1, 0, 100, 1],

Loading…
Cancel
Save