Comparing version 2.1.0-rc.1 to 2.1.0-rc.2
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-force/ v2.1.0-rc.1 Copyright 2020 Mike Bostock | ||
// https://d3js.org/d3-force/ v2.1.0-rc.2 Copyright 2020 Mike Bostock | ||
(function (global, factory) { | ||
@@ -9,3 +9,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-quadtree'), require('d3-dispatch'), require('d3-timer')) : | ||
function center(x, y) { | ||
var nodes, strength = 0.05; | ||
var nodes; | ||
@@ -15,3 +15,3 @@ if (x == null) x = 0; | ||
function force(alpha) { | ||
function force() { | ||
var i, | ||
@@ -27,6 +27,4 @@ n = nodes.length, | ||
sx = (sx / n - x) * alpha * strength; | ||
sy = (sy / n - y) * alpha * strength; | ||
for (i = 0; i < n; ++i) { | ||
node = nodes[i], node.vx -= sx, node.vy -= sy; | ||
for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { | ||
node = nodes[i], node.x -= sx, node.y -= sy; | ||
} | ||
@@ -294,3 +292,2 @@ } | ||
stepper = d3Timer.timer(step), | ||
started = stepper.stop() || 0, | ||
event = d3Dispatch.dispatch("tick", "end"); | ||
@@ -419,5 +416,3 @@ | ||
on: function(name, _) { | ||
return arguments.length > 1 | ||
? (event.on(name, _), started++ || stepper.restart(step), simulation) | ||
: event.on(name); | ||
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); | ||
} | ||
@@ -424,0 +419,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-force/ v2.1.0-rc.1 Copyright 2020 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-quadtree"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-quadtree","d3-dispatch","d3-timer"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function i(n){return function(){return n}}const u=1664525,o=1013904223,f=4294967296;let a=1;function c(n){return n&&(a=Math.abs(u*n)),1e-6*((a=(u*a+o)%f)/f-.5)}function l(n){return n.x+n.vx}function h(n){return n.y+n.vy}function v(n){return n.index}function y(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function d(n){return n.x}function x(n){return n.y}var s=10,g=Math.PI*(3-Math.sqrt(5));n.forceCenter=function(n,t){var e,r=.05;function i(i){var u,o,f=e.length,a=0,c=0;for(u=0;u<f;++u)a+=(o=e[u]).x,c+=o.y;for(a=(a/f-n)*i*r,c=(c/f-t)*i*r,u=0;u<f;++u)(o=e[u]).vx-=a,o.vy-=c}return null==n&&(n=0),null==t&&(t=0),i.initialize=function(n){e=n},i.x=function(t){return arguments.length?(n=+t,i):n},i.y=function(n){return arguments.length?(t=+n,i):t},i},n.forceCollide=function(n){var e,r,u=1,o=1;function f(){for(var n,i,f,v,y,d,x,s=e.length,g=0;g<o;++g)for(i=t.quadtree(e,l,h).visitAfter(a),n=0;n<s;++n)f=e[n],d=r[f.index],x=d*d,v=f.x+f.vx,y=f.y+f.vy,i.visit(p);function p(n,t,e,r,i){var o=n.data,a=n.r,l=d+a;if(!o)return t>v+l||r<v-l||e>y+l||i<y-l;if(o.index>f.index){var h=v-o.x-o.vx,s=y-o.y-o.vy,g=h*h+s*s;g<l*l&&(0===h&&(g+=(h=c())*h),0===s&&(g+=(s=c())*s),g=(l-(g=Math.sqrt(g)))/g*u,f.vx+=(h*=g)*(l=(a*=a)/(x+a)),f.vy+=(s*=g)*l,o.vx-=h*(l=1-l),o.vy-=s*l)}}}function a(n){if(n.data)return n.r=r[n.data.index];for(var t=n.r=0;t<4;++t)n[t]&&n[t].r>n.r&&(n.r=n[t].r)}function v(){if(e){var t,i,u=e.length;for(r=new Array(u),t=0;t<u;++t)i=e[t],r[i.index]=+n(i,t,e)}}return"function"!=typeof n&&(n=i(null==n?1:+n)),f.initialize=function(n){e=n,v()},f.iterations=function(n){return arguments.length?(o=+n,f):o},f.strength=function(n){return arguments.length?(u=+n,f):u},f.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),v(),f):n},f},n.forceLink=function(n){var t,e,r,u,o,f=v,a=function(n){return 1/Math.min(u[n.source.index],u[n.target.index])},l=i(30),h=1;function d(r){for(var i=0,u=n.length;i<h;++i)for(var f,a,l,v,y,d,x,s=0;s<u;++s)a=(f=n[s]).source,v=(l=f.target).x+l.vx-a.x-a.vx||c(),y=l.y+l.vy-a.y-a.vy||c(),v*=d=((d=Math.sqrt(v*v+y*y))-e[s])/d*r*t[s],y*=d,l.vx-=v*(x=o[s]),l.vy-=y*x,a.vx+=v*(x=1-x),a.vy+=y*x}function x(){if(r){var i,a,c=r.length,l=n.length,h=new Map(r.map((n,t)=>[f(n,t,r),n]));for(i=0,u=new Array(c);i<l;++i)(a=n[i]).index=i,"object"!=typeof a.source&&(a.source=y(h,a.source)),"object"!=typeof a.target&&(a.target=y(h,a.target)),u[a.source.index]=(u[a.source.index]||0)+1,u[a.target.index]=(u[a.target.index]||0)+1;for(i=0,o=new Array(l);i<l;++i)a=n[i],o[i]=u[a.source.index]/(u[a.source.index]+u[a.target.index]);t=new Array(l),s(),e=new Array(l),g()}}function s(){if(r)for(var e=0,i=n.length;e<i;++e)t[e]=+a(n[e],e,n)}function g(){if(r)for(var t=0,i=n.length;t<i;++t)e[t]=+l(n[t],t,n)}return null==n&&(n=[]),d.initialize=function(n){r=n,x()},d.links=function(t){return arguments.length?(n=t,x(),d):n},d.id=function(n){return arguments.length?(f=n,d):f},d.iterations=function(n){return arguments.length?(h=+n,d):h},d.strength=function(n){return arguments.length?(a="function"==typeof n?n:i(+n),s(),d):a},d.distance=function(n){return arguments.length?(l="function"==typeof n?n:i(+n),g(),d):l},d},n.forceManyBody=function(){var n,e,r,u,o=i(-30),f=1,a=1/0,l=.81;function h(i){var u,o=n.length,f=t.quadtree(n,d,x).visitAfter(y);for(r=i,u=0;u<o;++u)e=n[u],f.visit(s)}function v(){if(n){var t,e,r=n.length;for(u=new Array(r),t=0;t<r;++t)e=n[t],u[e.index]=+o(e,t,n)}}function y(n){var t,e,r,i,o,f=0,a=0;if(n.length){for(r=i=o=0;o<4;++o)(t=n[o])&&(e=Math.abs(t.value))&&(f+=t.value,a+=e,r+=e*t.x,i+=e*t.y);n.x=r/a,n.y=i/a}else{(t=n).x=t.data.x,t.y=t.data.y;do{f+=u[t.data.index]}while(t=t.next)}n.value=f}function s(n,t,i,o){if(!n.value)return!0;var h=n.x-e.x,v=n.y-e.y,y=o-t,d=h*h+v*v;if(y*y/l<d)return d<a&&(0===h&&(d+=(h=c())*h),0===v&&(d+=(v=c())*v),d<f&&(d=Math.sqrt(f*d)),e.vx+=h*n.value*r/d,e.vy+=v*n.value*r/d),!0;if(!(n.length||d>=a)){(n.data!==e||n.next)&&(0===h&&(d+=(h=c())*h),0===v&&(d+=(v=c())*v),d<f&&(d=Math.sqrt(f*d)));do{n.data!==e&&(y=u[n.data.index]*r/d,e.vx+=h*y,e.vy+=v*y)}while(n=n.next)}}return h.initialize=function(t){n=t,v()},h.strength=function(n){return arguments.length?(o="function"==typeof n?n:i(+n),v(),h):o},h.distanceMin=function(n){return arguments.length?(f=n*n,h):Math.sqrt(f)},h.distanceMax=function(n){return arguments.length?(a=n*n,h):Math.sqrt(a)},h.theta=function(n){return arguments.length?(l=n*n,h):Math.sqrt(l)},h},n.forceRadial=function(n,t,e){var r,u,o,f=i(.1);function a(n){for(var i=0,f=r.length;i<f;++i){var a=r[i],c=a.x-t||1e-6,l=a.y-e||1e-6,h=Math.sqrt(c*c+l*l),v=(o[i]-h)*u[i]*n/h;a.vx+=c*v,a.vy+=l*v}}function c(){if(r){var t,e=r.length;for(u=new Array(e),o=new Array(e),t=0;t<e;++t)o[t]=+n(r[t],t,r),u[t]=isNaN(o[t])?0:+f(r[t],t,r)}}return"function"!=typeof n&&(n=i(+n)),null==t&&(t=0),null==e&&(e=0),a.initialize=function(n){r=n,c()},a.strength=function(n){return arguments.length?(f="function"==typeof n?n:i(+n),c(),a):f},a.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),c(),a):n},a.x=function(n){return arguments.length?(t=+n,a):t},a.y=function(n){return arguments.length?(e=+n,a):e},a},n.forceSimulation=function(n){var t,i=1,u=.001,o=1-Math.pow(u,1/300),f=0,a=.6,c=new Map,l=r.timer(y),h=l.stop()||0,v=e.dispatch("tick","end");function y(){d(),v.call("tick",t),i<u&&(l.stop(),v.call("end",t))}function d(e){var r,u,l=n.length;void 0===e&&(e=1);for(var h=0;h<e;++h)for(i+=(f-i)*o,c.forEach(function(n){n(i)}),r=0;r<l;++r)null==(u=n[r]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function x(){for(var t,e=0,r=n.length;e<r;++e){if((t=n[e]).index=e,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var i=s*Math.sqrt(.5+e),u=e*g;t.x=i*Math.cos(u),t.y=i*Math.sin(u)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(n),t}return null==n&&(n=[]),x(),t={tick:d,restart:function(){return l.restart(y),t},stop:function(){return l.stop(),t},nodes:function(e){return arguments.length?(n=e,x(),c.forEach(p),t):n},alpha:function(n){return arguments.length?(i=+n,t):i},alphaMin:function(n){return arguments.length?(u=+n,t):u},alphaDecay:function(n){return arguments.length?(o=+n,t):+o},alphaTarget:function(n){return arguments.length?(f=+n,t):f},velocityDecay:function(n){return arguments.length?(a=1-n,t):1-a},force:function(n,e){return arguments.length>1?(null==e?c.delete(n):c.set(n,p(e)),t):c.get(n)},find:function(t,e,r){var i,u,o,f,a,c=0,l=n.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(o=(i=t-(f=n[c]).x)*i+(u=e-f.y)*u)<r&&(a=f,r=o);return a},on:function(n,e){return arguments.length>1?(v.on(n,e),h++||l.restart(y),t):v.on(n)}}},n.forceX=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vx+=(r[u]-i.x)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.x=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},n.forceY=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vy+=(r[u]-i.y)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.y=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-force/ v2.1.0-rc.2 Copyright 2020 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-quadtree"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-quadtree","d3-dispatch","d3-timer"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function i(n){return function(){return n}}const u=1664525,o=1013904223,f=4294967296;let a=1;function c(n){return n&&(a=Math.abs(u*n)),1e-6*((a=(u*a+o)%f)/f-.5)}function l(n){return n.x+n.vx}function h(n){return n.y+n.vy}function v(n){return n.index}function y(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function d(n){return n.x}function x(n){return n.y}var g=10,s=Math.PI*(3-Math.sqrt(5));n.forceCenter=function(n,t){var e;function r(){var r,i,u=e.length,o=0,f=0;for(r=0;r<u;++r)o+=(i=e[r]).x,f+=i.y;for(o=o/u-n,f=f/u-t,r=0;r<u;++r)(i=e[r]).x-=o,i.y-=f}return null==n&&(n=0),null==t&&(t=0),r.initialize=function(n){e=n},r.x=function(t){return arguments.length?(n=+t,r):n},r.y=function(n){return arguments.length?(t=+n,r):t},r},n.forceCollide=function(n){var e,r,u=1,o=1;function f(){for(var n,i,f,v,y,d,x,g=e.length,s=0;s<o;++s)for(i=t.quadtree(e,l,h).visitAfter(a),n=0;n<g;++n)f=e[n],d=r[f.index],x=d*d,v=f.x+f.vx,y=f.y+f.vy,i.visit(p);function p(n,t,e,r,i){var o=n.data,a=n.r,l=d+a;if(!o)return t>v+l||r<v-l||e>y+l||i<y-l;if(o.index>f.index){var h=v-o.x-o.vx,g=y-o.y-o.vy,s=h*h+g*g;s<l*l&&(0===h&&(s+=(h=c())*h),0===g&&(s+=(g=c())*g),s=(l-(s=Math.sqrt(s)))/s*u,f.vx+=(h*=s)*(l=(a*=a)/(x+a)),f.vy+=(g*=s)*l,o.vx-=h*(l=1-l),o.vy-=g*l)}}}function a(n){if(n.data)return n.r=r[n.data.index];for(var t=n.r=0;t<4;++t)n[t]&&n[t].r>n.r&&(n.r=n[t].r)}function v(){if(e){var t,i,u=e.length;for(r=new Array(u),t=0;t<u;++t)i=e[t],r[i.index]=+n(i,t,e)}}return"function"!=typeof n&&(n=i(null==n?1:+n)),f.initialize=function(n){e=n,v()},f.iterations=function(n){return arguments.length?(o=+n,f):o},f.strength=function(n){return arguments.length?(u=+n,f):u},f.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),v(),f):n},f},n.forceLink=function(n){var t,e,r,u,o,f=v,a=function(n){return 1/Math.min(u[n.source.index],u[n.target.index])},l=i(30),h=1;function d(r){for(var i=0,u=n.length;i<h;++i)for(var f,a,l,v,y,d,x,g=0;g<u;++g)a=(f=n[g]).source,v=(l=f.target).x+l.vx-a.x-a.vx||c(),y=l.y+l.vy-a.y-a.vy||c(),v*=d=((d=Math.sqrt(v*v+y*y))-e[g])/d*r*t[g],y*=d,l.vx-=v*(x=o[g]),l.vy-=y*x,a.vx+=v*(x=1-x),a.vy+=y*x}function x(){if(r){var i,a,c=r.length,l=n.length,h=new Map(r.map((n,t)=>[f(n,t,r),n]));for(i=0,u=new Array(c);i<l;++i)(a=n[i]).index=i,"object"!=typeof a.source&&(a.source=y(h,a.source)),"object"!=typeof a.target&&(a.target=y(h,a.target)),u[a.source.index]=(u[a.source.index]||0)+1,u[a.target.index]=(u[a.target.index]||0)+1;for(i=0,o=new Array(l);i<l;++i)a=n[i],o[i]=u[a.source.index]/(u[a.source.index]+u[a.target.index]);t=new Array(l),g(),e=new Array(l),s()}}function g(){if(r)for(var e=0,i=n.length;e<i;++e)t[e]=+a(n[e],e,n)}function s(){if(r)for(var t=0,i=n.length;t<i;++t)e[t]=+l(n[t],t,n)}return null==n&&(n=[]),d.initialize=function(n){r=n,x()},d.links=function(t){return arguments.length?(n=t,x(),d):n},d.id=function(n){return arguments.length?(f=n,d):f},d.iterations=function(n){return arguments.length?(h=+n,d):h},d.strength=function(n){return arguments.length?(a="function"==typeof n?n:i(+n),g(),d):a},d.distance=function(n){return arguments.length?(l="function"==typeof n?n:i(+n),s(),d):l},d},n.forceManyBody=function(){var n,e,r,u,o=i(-30),f=1,a=1/0,l=.81;function h(i){var u,o=n.length,f=t.quadtree(n,d,x).visitAfter(y);for(r=i,u=0;u<o;++u)e=n[u],f.visit(g)}function v(){if(n){var t,e,r=n.length;for(u=new Array(r),t=0;t<r;++t)e=n[t],u[e.index]=+o(e,t,n)}}function y(n){var t,e,r,i,o,f=0,a=0;if(n.length){for(r=i=o=0;o<4;++o)(t=n[o])&&(e=Math.abs(t.value))&&(f+=t.value,a+=e,r+=e*t.x,i+=e*t.y);n.x=r/a,n.y=i/a}else{(t=n).x=t.data.x,t.y=t.data.y;do{f+=u[t.data.index]}while(t=t.next)}n.value=f}function g(n,t,i,o){if(!n.value)return!0;var h=n.x-e.x,v=n.y-e.y,y=o-t,d=h*h+v*v;if(y*y/l<d)return d<a&&(0===h&&(d+=(h=c())*h),0===v&&(d+=(v=c())*v),d<f&&(d=Math.sqrt(f*d)),e.vx+=h*n.value*r/d,e.vy+=v*n.value*r/d),!0;if(!(n.length||d>=a)){(n.data!==e||n.next)&&(0===h&&(d+=(h=c())*h),0===v&&(d+=(v=c())*v),d<f&&(d=Math.sqrt(f*d)));do{n.data!==e&&(y=u[n.data.index]*r/d,e.vx+=h*y,e.vy+=v*y)}while(n=n.next)}}return h.initialize=function(t){n=t,v()},h.strength=function(n){return arguments.length?(o="function"==typeof n?n:i(+n),v(),h):o},h.distanceMin=function(n){return arguments.length?(f=n*n,h):Math.sqrt(f)},h.distanceMax=function(n){return arguments.length?(a=n*n,h):Math.sqrt(a)},h.theta=function(n){return arguments.length?(l=n*n,h):Math.sqrt(l)},h},n.forceRadial=function(n,t,e){var r,u,o,f=i(.1);function a(n){for(var i=0,f=r.length;i<f;++i){var a=r[i],c=a.x-t||1e-6,l=a.y-e||1e-6,h=Math.sqrt(c*c+l*l),v=(o[i]-h)*u[i]*n/h;a.vx+=c*v,a.vy+=l*v}}function c(){if(r){var t,e=r.length;for(u=new Array(e),o=new Array(e),t=0;t<e;++t)o[t]=+n(r[t],t,r),u[t]=isNaN(o[t])?0:+f(r[t],t,r)}}return"function"!=typeof n&&(n=i(+n)),null==t&&(t=0),null==e&&(e=0),a.initialize=function(n){r=n,c()},a.strength=function(n){return arguments.length?(f="function"==typeof n?n:i(+n),c(),a):f},a.radius=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),c(),a):n},a.x=function(n){return arguments.length?(t=+n,a):t},a.y=function(n){return arguments.length?(e=+n,a):e},a},n.forceSimulation=function(n){var t,i=1,u=.001,o=1-Math.pow(u,1/300),f=0,a=.6,c=new Map,l=r.timer(v),h=e.dispatch("tick","end");function v(){y(),h.call("tick",t),i<u&&(l.stop(),h.call("end",t))}function y(e){var r,u,l=n.length;void 0===e&&(e=1);for(var h=0;h<e;++h)for(i+=(f-i)*o,c.forEach(function(n){n(i)}),r=0;r<l;++r)null==(u=n[r]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function d(){for(var t,e=0,r=n.length;e<r;++e){if((t=n[e]).index=e,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var i=g*Math.sqrt(.5+e),u=e*s;t.x=i*Math.cos(u),t.y=i*Math.sin(u)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function x(t){return t.initialize&&t.initialize(n),t}return null==n&&(n=[]),d(),t={tick:y,restart:function(){return l.restart(v),t},stop:function(){return l.stop(),t},nodes:function(e){return arguments.length?(n=e,d(),c.forEach(x),t):n},alpha:function(n){return arguments.length?(i=+n,t):i},alphaMin:function(n){return arguments.length?(u=+n,t):u},alphaDecay:function(n){return arguments.length?(o=+n,t):+o},alphaTarget:function(n){return arguments.length?(f=+n,t):f},velocityDecay:function(n){return arguments.length?(a=1-n,t):1-a},force:function(n,e){return arguments.length>1?(null==e?c.delete(n):c.set(n,x(e)),t):c.get(n)},find:function(t,e,r){var i,u,o,f,a,c=0,l=n.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(o=(i=t-(f=n[c]).x)*i+(u=e-f.y)*u)<r&&(a=f,r=o);return a},on:function(n,e){return arguments.length>1?(h.on(n,e),t):h.on(n)}}},n.forceX=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vx+=(r[u]-i.x)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.x=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},n.forceY=function(n){var t,e,r,u=i(.1);function o(n){for(var i,u=0,o=t.length;u<o;++u)(i=t[u]).vy+=(r[u]-i.y)*e[u]*n}function f(){if(t){var i,o=t.length;for(e=new Array(o),r=new Array(o),i=0;i<o;++i)e[i]=isNaN(r[i]=+n(t[i],i,t))?0:+u(t[i],i,t)}}return"function"!=typeof n&&(n=i(null==n?0:+n)),o.initialize=function(n){t=n,f()},o.strength=function(n){return arguments.length?(u="function"==typeof n?n:i(+n),f(),o):u},o.y=function(t){return arguments.length?(n="function"==typeof t?t:i(+t),f(),o):n},o},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-force", | ||
"version": "2.1.0-rc.1", | ||
"version": "2.1.0-rc.2", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "tag": "next" |
export default function(x, y) { | ||
var nodes, strength = 0.05; | ||
var nodes; | ||
@@ -7,3 +7,3 @@ if (x == null) x = 0; | ||
function force(alpha) { | ||
function force() { | ||
var i, | ||
@@ -19,6 +19,4 @@ n = nodes.length, | ||
sx = (sx / n - x) * alpha * strength; | ||
sy = (sy / n - y) * alpha * strength; | ||
for (i = 0; i < n; ++i) { | ||
node = nodes[i], node.vx -= sx, node.vy -= sy; | ||
for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { | ||
node = nodes[i], node.x -= sx, node.y -= sy; | ||
} | ||
@@ -25,0 +23,0 @@ } |
@@ -24,3 +24,2 @@ import {dispatch} from "d3-dispatch"; | ||
stepper = timer(step), | ||
started = stepper.stop() || 0, | ||
event = dispatch("tick", "end"); | ||
@@ -149,7 +148,5 @@ | ||
on: function(name, _) { | ||
return arguments.length > 1 | ||
? (event.on(name, _), started++ || stepper.restart(step), simulation) | ||
: event.on(name); | ||
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); | ||
} | ||
}; | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
87974
1136