vega-force
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -19,3 +19,3 @@ (function (global, factory) { | ||
'alpha', 'alphaMin', 'alphaTarget', | ||
'velocityDecay', 'drag', 'forces' | ||
'velocityDecay', 'forces' | ||
]; | ||
@@ -149,3 +149,3 @@ var ForceConfig = ['static', 'iterations']; | ||
{ "name": "alphaTarget", "type": "number", "default": 0 }, | ||
{ "name": "drag", "type": "number", "default": 0.6 }, | ||
{ "name": "velocityDecay", "type": "number", "default": 0.4 }, | ||
{ "name": "forces", "type": "param", "array": true, | ||
@@ -152,0 +152,0 @@ "params": [ |
@@ -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=m.length;n<o;++n)i=m[n],i!==d&&t.modified(i)&&e[i](t[i]);for(n=0,o=f.length;n<o;++n)(r||t.modified(d,n))&&e.force(d+n,u(f[n]));for(o=e.numForces||0;n<o;++n)e.force(d+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},d="forces",m=["alpha","alphaMin","alphaTarget","velocityDecay","drag","forces"],c=["static","iterations"],p=["x","y","vx","vy"],l=a.inherits(n,t.Transform);l.transform=function(e,t){var a=this.value,r=t.changed(t.ADD_REM),n=e.modified(m),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)},l.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===d&&"link"===a.op._argval.force)for(var f,u=a.op._argops,s=0,m=u.length;s<m;++s)if("links"===u[s].name&&(f=u[s].op.source)){r.touch(f);break}return t.reflow(e.modified()).modifies(p)};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:"drag",type:"number",default:.6},{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.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})}); |
@@ -11,3 +11,3 @@ export default { | ||
{ "name": "alphaTarget", "type": "number", "default": 0 }, | ||
{ "name": "drag", "type": "number", "default": 0.6 }, | ||
{ "name": "velocityDecay", "type": "number", "default": 0.4 }, | ||
{ "name": "forces", "type": "param", "array": true, | ||
@@ -14,0 +14,0 @@ "params": [ |
{ | ||
"name": "vega-force", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Force simulation transform for Vega dataflows.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -20,3 +20,3 @@ import {Transform} from 'vega-dataflow'; | ||
'alpha', 'alphaMin', 'alphaTarget', | ||
'velocityDecay', 'drag', 'forces' | ||
'velocityDecay', 'forces' | ||
], | ||
@@ -23,0 +23,0 @@ ForceConfig = ['static', 'iterations'], |
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
19352