Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "vega", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "The Vega visualization grammar.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -52,4 +52,5 @@ var d3 = require('d3'), | ||
prototype.transform = function(nodeInput) { | ||
prototype.transform = function(nodeInput, reset) { | ||
log.debug(nodeInput, ['force']); | ||
reset = reset - (nodeInput.signals.active ? 1 : 0); | ||
@@ -68,3 +69,3 @@ // get variables | ||
if (linkInput.stamp < nodeInput.stamp) linkInput = null; | ||
this.configure(nodeInput, linkInput, interactive); | ||
this.configure(nodeInput, linkInput, interactive, reset); | ||
@@ -81,7 +82,9 @@ // run batch layout | ||
// update active node status | ||
// re-up alpha on parameter change | ||
if (reset || active !== this._prev && active && active.update) { | ||
layout.alpha(this.param('alpha')); // re-start layout | ||
} | ||
// update active node status, | ||
if (active !== this._prev) { | ||
if (active && active.update) { | ||
layout.alpha(this.param('alpha')); // re-start layout | ||
} | ||
this._prev = active; | ||
@@ -104,6 +107,6 @@ } | ||
prototype.configure = function(nodeInput, linkInput, interactive) { | ||
prototype.configure = function(nodeInput, linkInput, interactive, reset) { | ||
// check if we need to run configuration | ||
var layout = this._layout, | ||
run = this._setup || nodeInput.add.length || | ||
update = this._setup || nodeInput.add.length || | ||
linkInput && linkInput.add.length || | ||
@@ -114,3 +117,15 @@ interactive !== this._interactive || | ||
this.param('linkDistance') !== layout.linkDistance(); | ||
if (!run) return; | ||
if (update || reset) { | ||
// a parameter changed, so update tick-only parameters | ||
layout | ||
.size(this.param('size')) | ||
.chargeDistance(this.param('chargeDistance')) | ||
.theta(this.param('theta')) | ||
.gravity(this.param('gravity')) | ||
.friction(this.param('friction')); | ||
} | ||
if (!update) return; // if no more updates needed, return now | ||
this._setup = false; | ||
@@ -147,12 +162,7 @@ this._interactive = interactive; | ||
// configure layout | ||
// configure the rest of the layout | ||
layout | ||
.size(this.param('size')) | ||
.linkStrength(this.param('linkStrength')) | ||
.linkDistance(this.param('linkDistance')) | ||
.charge(this.param('charge')) | ||
.chargeDistance(this.param('chargeDistance')) | ||
.theta(this.param('theta')) | ||
.gravity(this.param('gravity')) | ||
.friction(this.param('friction')) | ||
.nodes(nodes) | ||
@@ -159,0 +169,0 @@ .links(links) |
@@ -45,5 +45,5 @@ var df = require('vega-dataflow'), | ||
var reset = this._stamp < input.stamp && | ||
this.dependency(Deps.SIGNALS).some(function(s) { | ||
return !!input.signals[s]; | ||
}); | ||
this.dependency(Deps.SIGNALS).reduce(function(c, s) { | ||
return c += input.signals[s] ? 1 : 0; | ||
}, 0); | ||
return this.transform(input, reset); | ||
@@ -50,0 +50,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1966099
32187