Browse Source

fixed node label becoming undefined

fixed cluster sector scaling
fixed cluster font scaling
v3_develop
Alex de Mulder 10 years ago
parent
commit
3ae5cda499
4 changed files with 25596 additions and 25598 deletions
  1. +25591
    -25592
      dist/vis.js
  2. +2
    -4
      lib/network/Node.js
  3. +1
    -1
      lib/network/mixins/ClusterMixin.js
  4. +2
    -1
      lib/network/mixins/SectorsMixin.js

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


+ 2
- 4
lib/network/Node.js View File

@ -54,7 +54,6 @@ function Node(properties, imagelist, grouplist, networkConstants) {
this.preassignedLevel = false;
this.hierarchyEnumerated = false;
this.labelDimensions = {top:0,left:0,width:0,height:0,yLine:0}; // could be cached
this.dirtyLabel = true;
this.imagelist = imagelist;
@ -146,10 +145,9 @@ Node.prototype.setProperties = function(properties, constants) {
];
util.selectiveDeepExtend(fields, this.options, properties);
this.originalLabel = undefined;
// basic properties
if (properties.id !== undefined) {this.id = properties.id;}
if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label; this.dirtyLabel = true;}
if (properties.label !== undefined) {this.label = properties.label; this.originalLabel = properties.label;}
if (properties.title !== undefined) {this.title = properties.title;}
if (properties.x !== undefined) {this.x = properties.x;}
if (properties.y !== undefined) {this.y = properties.y;}
@ -731,7 +729,7 @@ Node.prototype._resizeEllipse = function (ctx) {
}
var defaultSize = this.width;
// scaling used for clustering
// scaling used for clustering
this.width += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeWidthFactor;
this.height += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeHeightFactor;
this.options.radius += Math.min(this.clusterSize - 1, this.maxNodeSizeIncrements) * this.clusterSizeRadiusFactor;

+ 1
- 1
lib/network/mixins/ClusterMixin.js View File

@ -369,7 +369,7 @@ exports._expelChildFromParent = function(parentNode, containedNodeId, recursive,
// undo the changes from the clustering operation on the parent node
parentNode.options.mass -= childNode.options.mass;
parentNode.clusterSize -= childNode.clusterSize;
parentNode.options.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*parentNode.clusterSize);
parentNode.options.fontSize = Math.min(this.constants.clustering.maxFontSize, this.constants.nodes.fontSize + this.constants.clustering.fontSizeMultiplier*(parentNode.clusterSize-1));
parentNode.dynamicEdgesLength = parentNode.dynamicEdges.length;
// place the child node near the parent, not at the exact same location to avoid chaos in the system

+ 2
- 1
lib/network/mixins/SectorsMixin.js View File

@ -1,4 +1,5 @@
var util = require('../../util');
var Node = require('../Node');
/**
* Creation of the SectorMixin var.
@ -537,7 +538,7 @@ exports._drawSectorNodes = function(ctx,sectorType) {
node.y = 0.5 * (maxY + minY);
node.width = 2 * (node.x - minX);
node.height = 2 * (node.y - minY);
node.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2));
node.options.radius = Math.sqrt(Math.pow(0.5*node.width,2) + Math.pow(0.5*node.height,2));
node.setScale(this.scale);
node._drawCircle(ctx);
}

Loading…
Cancel
Save