vega-force
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
@@ -82,3 +82,4 @@ (function (global, factory) { | ||
if (ops[i].name === 'links' && (op = ops[i].op.source)) { | ||
dataflow.touch(op); break; | ||
dataflow.pulse(op, dataflow.changeset().reflow()); | ||
break; | ||
} | ||
@@ -85,0 +86,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-force")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-force"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3)}(this,function(e,t,a,r){"use strict";function n(e){t.Transform.call(this,null,e)}function o(e,t){return function(){e.touch(t).run()}}function i(e,t){var a=r.forceSimulation(e),n=!1,o=a.stop,i=a.restart;return a.stopped=function(){return n},a.restart=function(){return n=!1,i()},a.stop=function(){return n=!0,o()},f(a,t,!0).on("end",function(){n=!0})}function f(e,t,r){var n,o,i,f=a.array(t.forces);for(n=0,o=d.length;n<o;++n)i=d[n],i!==m&&t.modified(i)&&e[i](t[i]);for(n=0,o=f.length;n<o;++n)(r||t.modified(m,n))&&e.force(m+n,u(f[n]));for(o=e.numForces||0;n<o;++n)e.force(m+n,null);return e.numForces=f.length,e}function u(e){var t,r;s.hasOwnProperty(e.force)||a.error("Unrecognized force: "+e.force),t=s[e.force]();for(r in e)a.isFunction(t[r])&&t[r](e[r]);return t}var s={center:r.forceCenter,collide:r.forceCollide,nbody:r.forceManyBody,link:r.forceLink,x:r.forceX,y:r.forceY},m="forces",d=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],c=["static","iterations"],l=["x","y","vx","vy"],p=a.inherits(n,t.Transform);p.transform=function(e,t){var a=this.value,r=t.changed(t.ADD_REM),n=e.modified(d),u=e.iterations||300;if(a?(r&&(t.modifies("index"),a.nodes(t.source)),n&&f(a,e)):(this.value=a=i(t.source,e),a.on("tick",o(t.dataflow,this)),e.static||(r=!0,a.tick()),t.modifies("index")),n||r||e.modified(c)||t.changed()&&e.restart)if(a.alpha(Math.max(a.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(a.alphaMin(),1/u)),e.static)for(a.stop();--u>=0;)a.tick();else if(a.stopped()&&a.restart(),!r)return t.StopPropagation;return this.finish(e,t)},p.finish=function(e,t){for(var a,r=t.dataflow,n=this._argops,o=0,i=n.length;o<i;++o)if(a=n[o],a.name===m&&"link"===a.op._argval.force)for(var f,u=a.op._argops,s=0,d=u.length;s<d;++s)if("links"===u[s].name&&(f=u[s].op.source)){r.touch(f);break}return t.reflow(e.modified()).modifies(l)};var y={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:["x","y","vx","vy"]}]};t.register(y,n),e.transform=t.transform,e.definition=t.definition,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-force")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-force"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3)}(this,function(e,t,a,r){"use strict";function n(e){t.Transform.call(this,null,e)}function o(e,t){return function(){e.touch(t).run()}}function i(e,t){var a=r.forceSimulation(e),n=!1,o=a.stop,i=a.restart;return a.stopped=function(){return n},a.restart=function(){return n=!1,i()},a.stop=function(){return n=!0,o()},f(a,t,!0).on("end",function(){n=!0})}function f(e,t,r){var n,o,i,f=a.array(t.forces);for(n=0,o=d.length;n<o;++n)i=d[n],i!==m&&t.modified(i)&&e[i](t[i]);for(n=0,o=f.length;n<o;++n)(r||t.modified(m,n))&&e.force(m+n,u(f[n]));for(o=e.numForces||0;n<o;++n)e.force(m+n,null);return e.numForces=f.length,e}function u(e){var t,r;s.hasOwnProperty(e.force)||a.error("Unrecognized force: "+e.force),t=s[e.force]();for(r in e)a.isFunction(t[r])&&t[r](e[r]);return t}var s={center:r.forceCenter,collide:r.forceCollide,nbody:r.forceManyBody,link:r.forceLink,x:r.forceX,y:r.forceY},m="forces",d=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],c=["static","iterations"],l=["x","y","vx","vy"],p=a.inherits(n,t.Transform);p.transform=function(e,t){var a=this.value,r=t.changed(t.ADD_REM),n=e.modified(d),u=e.iterations||300;if(a?(r&&(t.modifies("index"),a.nodes(t.source)),n&&f(a,e)):(this.value=a=i(t.source,e),a.on("tick",o(t.dataflow,this)),e.static||(r=!0,a.tick()),t.modifies("index")),n||r||e.modified(c)||t.changed()&&e.restart)if(a.alpha(Math.max(a.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(a.alphaMin(),1/u)),e.static)for(a.stop();--u>=0;)a.tick();else if(a.stopped()&&a.restart(),!r)return t.StopPropagation;return this.finish(e,t)},p.finish=function(e,t){for(var a,r=t.dataflow,n=this._argops,o=0,i=n.length;o<i;++o)if(a=n[o],a.name===m&&"link"===a.op._argval.force)for(var f,u=a.op._argops,s=0,d=u.length;s<d;++s)if("links"===u[s].name&&(f=u[s].op.source)){r.pulse(f,r.changeset().reflow());break}return t.reflow(e.modified()).modifies(l)};var y={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:["x","y","vx","vy"]}]};t.register(y,n),e.transform=t.transform,e.definition=t.definition,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vega-force", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.3", | ||
"description": "Force simulation transform for Vega dataflows.", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"d3-force": "1", | ||
"vega-dataflow": ">=2.0.0-beta.4", | ||
"vega-dataflow": ">=2.0.0-beta.27", | ||
"vega-util": "1" | ||
@@ -33,0 +33,0 @@ }, |
@@ -83,3 +83,4 @@ import {Transform} from 'vega-dataflow'; | ||
if (ops[i].name === 'links' && (op = ops[i].op.source)) { | ||
dataflow.touch(op); break; | ||
dataflow.pulse(op, dataflow.changeset().reflow()); | ||
break; | ||
} | ||
@@ -86,0 +87,0 @@ } |
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
19454
378