Socket
Socket
Sign inDemoInstall

d3-brush

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-brush - npm Package Compare versions

Comparing version 1.1.0-rc.1 to 1.1.0-rc.2

30

dist/d3-brush.js

@@ -1,2 +0,2 @@

// https://d3js.org/d3-brush/ v1.1.0-rc.1 Copyright 2019 Mike Bostock
// https://d3js.org/d3-brush/ v1.1.0-rc.2 Copyright 2019 Mike Bostock
(function (global, factory) {

@@ -34,6 +34,14 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-drag'), require('d3-interpolate'), require('d3-selection'), require('d3-transition')) :

function number1(e) {
return [+e[0], +e[1]];
}
function number2(e) {
return [number1(e[0]), number1(e[1])];
}
var X = {
name: "x",
handles: ["e", "w"].map(type),
input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; },
handles: ["w", "e"].map(type),
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }

@@ -45,3 +53,3 @@ };

handles: ["n", "s"].map(type),
input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; },
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }

@@ -52,4 +60,4 @@ };

name: "xy",
handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(type),
input: function(xy) { return xy; },
handles: ["nw", "n", "ne", "w", "e", "sw", "s", "se"].map(type),
input: function(xy) { return xy == null ? null : number2(xy); },
output: function(xy) { return xy; }

@@ -235,3 +243,3 @@ };

function tween(t) {
state.selection = t === 1 && empty(selection1) ? null : i(t);
state.selection = t === 1 && selection1 !== null ? null : i(t);
redraw.call(that);

@@ -241,3 +249,3 @@ emit.brush();

return selection0 && selection1 ? tween : tween(1);
return selection0 !== null && selection1 !== null ? tween : tween(1);
});

@@ -254,3 +262,3 @@ } else {

d3Transition.interrupt(that);
state.selection = selection1 == null || empty(selection1) ? null : selection1;
state.selection = selection1 === null ? null : selection1;
redraw.call(that);

@@ -557,3 +565,3 @@ emit.start().brush().end();

var state = this.__brush || {selection: null};
state.extent = extent.apply(this, arguments);
state.extent = number2(extent.apply(this, arguments));
state.dim = dim;

@@ -564,3 +572,3 @@ return state;

brush.extent = function(_) {
return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;
return arguments.length ? (extent = typeof _ === "function" ? _ : constant(number2(_)), brush) : extent;
};

@@ -567,0 +575,0 @@

@@ -1,2 +0,2 @@

// https://d3js.org/d3-brush/ v1.1.0-rc.1 Copyright 2019 Mike Bostock
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dispatch"),require("d3-drag"),require("d3-interpolate"),require("d3-selection"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-drag","d3-interpolate","d3-selection","d3-transition"],e):e((t=t||self).d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,e,n,r,s,i){"use strict";function a(t){return function(){return t}}function u(t,e,n){this.target=t,this.type=e,this.selection=n}function o(){s.event.stopImmediatePropagation()}function l(){s.event.preventDefault(),s.event.stopImmediatePropagation()}var c={name:"drag"},h={name:"space"},f={name:"handle"},d={name:"center"},p={name:"x",handles:["e","w"].map(_),input:function(t,e){return t&&[[t[0],e[0][1]],[t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},v={name:"y",handles:["n","s"].map(_),input:function(t,e){return t&&[[e[0][0],t[0]],[e[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},m={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(_),input:function(t){return t},output:function(t){return t}},y={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},b={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},w={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},g={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},x={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function _(t){return{type:t}}function M(){return!s.event.button}function k(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function z(){return"ontouchstart"in this}function A(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function q(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function E(t){var m,E=k,K=M,P=z,S=e.dispatch(V,"start","brush","end"),T=6;function V(e){var n=e.property("__brush",O).selectAll(".overlay").data([_("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",y.overlay).merge(n).each(function(){var t=A(this).extent;s.select(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([_("selection")]).enter().append("rect").attr("class","selection").attr("cursor",y.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return y[t.type]}),e.each(j).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",I).filter(P).on("touchstart.brush",I).on("touchmove.brush",G).on("touchend.brush touchcancel.brush",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function j(){var t=s.select(this),e=A(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-T/2:e[0][0]-T/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-T/2:e[0][1]-T/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+T:T}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+T:T})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function C(t,e){return t.__brush.emitter||new D(t,e)}function D(t,e){this.that=t,this.args=e,this.state=t.__brush,this.active=0}function I(){if(s.event.touches){if(s.event.changedTouches.length<s.event.touches.length)return l()}else if(m)return;if(K.apply(this,arguments)){var e,r,a,u,_,M,k,z,E,P,S,T,V,D=this,I=s.event.target.__data__.type,G="selection"===(s.event.metaKey?I="overlay":I)?c:s.event.altKey?d:f,N=t===v?null:g[I],O=t===p?null:x[I],X=A(D),Y=X.extent,B=X.selection,F=Y[0][0],H=Y[0][1],J=Y[1][0],L=Y[1][1],Q=N&&O&&s.event.shiftKey,R=s.mouse(D),U=R,W=C(D,arguments).beforestart();"overlay"===I?X.selection=B=[[e=t===v?F:R[0],a=t===p?H:R[1]],[_=t===v?J:e,k=t===p?L:a]]:(e=B[0][0],a=B[0][1],_=B[1][0],k=B[1][1]),r=e,u=a,M=_,z=k;var Z=s.select(D).attr("pointer-events","none"),$=Z.selectAll(".overlay").attr("cursor",y[I]);if(s.event.touches)W.moved=et,W.ended=rt;else{var tt=s.select(s.event.view).on("keydown.brush",function(){switch(s.event.keyCode){case 16:Q=N&&O;break;case 18:G===f&&(N&&(_=M-E*N,e=r+E*N),O&&(k=z-P*O,a=u+P*O),G=d,nt());break;case 32:G!==f&&G!==d||(N<0?_=M-E:N>0&&(e=r-E),O<0?k=z-P:O>0&&(a=u-P),G=h,$.attr("cursor",y.selection),nt());break;default:return}l()},!0).on("keyup.brush",function(){switch(s.event.keyCode){case 16:Q&&(T=V=Q=!1,nt());break;case 18:G===d&&(N<0?_=M:N>0&&(e=r),O<0?k=z:O>0&&(a=u),G=f,nt());break;case 32:G===h&&(s.event.altKey?(N&&(_=M-E*N,e=r+E*N),O&&(k=z-P*O,a=u+P*O),G=d):(N<0?_=M:N>0&&(e=r),O<0?k=z:O>0&&(a=u),G=f),$.attr("cursor",y[I]),nt());break;default:return}l()},!0).on("mousemove.brush",et,!0).on("mouseup.brush",rt,!0);n.dragDisable(s.event.view)}o(),i.interrupt(D),j.call(D),W.start()}function et(){var t=s.mouse(D);!Q||T||V||(Math.abs(t[0]-U[0])>Math.abs(t[1]-U[1])?V=!0:T=!0),U=t,S=!0,l(),nt()}function nt(){var t;switch(E=U[0]-R[0],P=U[1]-R[1],G){case h:case c:N&&(E=Math.max(F-e,Math.min(J-_,E)),r=e+E,M=_+E),O&&(P=Math.max(H-a,Math.min(L-k,P)),u=a+P,z=k+P);break;case f:N<0?(E=Math.max(F-e,Math.min(J-e,E)),r=e+E,M=_):N>0&&(E=Math.max(F-_,Math.min(J-_,E)),r=e,M=_+E),O<0?(P=Math.max(H-a,Math.min(L-a,P)),u=a+P,z=k):O>0&&(P=Math.max(H-k,Math.min(L-k,P)),u=a,z=k+P);break;case d:N&&(r=Math.max(F,Math.min(J,e-E*N)),M=Math.max(F,Math.min(J,_+E*N))),O&&(u=Math.max(H,Math.min(L,a-P*O)),z=Math.max(H,Math.min(L,k+P*O)))}M<r&&(N*=-1,t=e,e=_,_=t,t=r,r=M,M=t,I in b&&$.attr("cursor",y[I=b[I]])),z<u&&(O*=-1,t=a,a=k,k=t,t=u,u=z,z=t,I in w&&$.attr("cursor",y[I=w[I]])),X.selection&&(B=X.selection),T&&(r=B[0][0],M=B[1][0]),V&&(u=B[0][1],z=B[1][1]),B[0][0]===r&&B[0][1]===u&&B[1][0]===M&&B[1][1]===z||(X.selection=[[r,u],[M,z]],j.call(D),W.brush())}function rt(){if(o(),s.event.touches){if(s.event.touches.length)return;m&&clearTimeout(m),m=setTimeout(function(){m=null},500)}else n.dragEnable(s.event.view,S),tt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Z.attr("pointer-events","all"),$.attr("cursor",y.overlay),X.selection&&(B=X.selection),q(B)&&(X.selection=null,j.call(D)),W.end()}}function G(){C(this,arguments).moved()}function N(){C(this,arguments).ended()}function O(){var e=this.__brush||{selection:null};return e.extent=E.apply(this,arguments),e.dim=t,e}return V.move=function(e,n){e.selection?e.on("start.brush",function(){C(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){C(this,arguments).end()}).tween("brush",function(){var e=this,s=e.__brush,i=C(e,arguments),a=s.selection,u=t.input("function"==typeof n?n.apply(this,arguments):n,s.extent),o=r.interpolate(a,u);function l(t){s.selection=1===t&&q(u)?null:o(t),j.call(e),i.brush()}return a&&u?l:l(1)}):e.each(function(){var e=this,r=arguments,s=e.__brush,a=t.input("function"==typeof n?n.apply(e,r):n,s.extent),u=C(e,r).beforestart();i.interrupt(e),s.selection=null==a||q(a)?null:a,j.call(e),u.start().brush().end()})},D.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(e){s.customEvent(new u(V,e,t.output(this.state.selection)),S.apply,S,[e,this.that,this.args])}},V.extent=function(t){return arguments.length?(E="function"==typeof t?t:a([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),V):E},V.filter=function(t){return arguments.length?(K="function"==typeof t?t:a(!!t),V):K},V.handleSize=function(t){return arguments.length?(T=+t,V):T},V.on=function(){var t=S.on.apply(S,arguments);return t===S?V:t},V}t.brush=function(){return E(m)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},t.brushX=function(){return E(p)},t.brushY=function(){return E(v)},Object.defineProperty(t,"__esModule",{value:!0})});
// https://d3js.org/d3-brush/ v1.1.0-rc.2 Copyright 2019 Mike Bostock
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dispatch"),require("d3-drag"),require("d3-interpolate"),require("d3-selection"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-drag","d3-interpolate","d3-selection","d3-transition"],e):e((t=t||self).d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,e,n,r,s,i){"use strict";function a(t){return function(){return t}}function u(t,e,n){this.target=t,this.type=e,this.selection=n}function o(){s.event.stopImmediatePropagation()}function l(){s.event.preventDefault(),s.event.stopImmediatePropagation()}var c={name:"drag"},h={name:"space"},f={name:"handle"},d={name:"center"};function p(t){return[+t[0],+t[1]]}function v(t){return[p(t[0]),p(t[1])]}var m={name:"x",handles:["w","e"].map(k),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},y={name:"y",handles:["n","s"].map(k),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},b={name:"xy",handles:["nw","n","ne","w","e","sw","s","se"].map(k),input:function(t){return null==t?null:v(t)},output:function(t){return t}},w={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},g={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},x={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},_={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},M={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function k(t){return{type:t}}function z(){return!s.event.button}function A(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function q(){return"ontouchstart"in this}function E(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function K(t){var p,b=A,K=z,P=q,S=e.dispatch(V,"start","brush","end"),T=6;function V(e){var n=e.property("__brush",O).selectAll(".overlay").data([k("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",w.overlay).merge(n).each(function(){var t=E(this).extent;s.select(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([k("selection")]).enter().append("rect").attr("class","selection").attr("cursor",w.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return w[t.type]}),e.each(j).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",I).filter(P).on("touchstart.brush",I).on("touchmove.brush",G).on("touchend.brush touchcancel.brush",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function j(){var t=s.select(this),e=E(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-T/2:e[0][0]-T/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-T/2:e[0][1]-T/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+T:T}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+T:T})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function C(t,e){return t.__brush.emitter||new D(t,e)}function D(t,e){this.that=t,this.args=e,this.state=t.__brush,this.active=0}function I(){if(s.event.touches){if(s.event.changedTouches.length<s.event.touches.length)return l()}else if(p)return;if(K.apply(this,arguments)){var e,r,a,u,v,b,k,z,A,q,P,S,T,V=this,D=s.event.target.__data__.type,I="selection"===(s.event.metaKey?D="overlay":D)?c:s.event.altKey?d:f,G=t===y?null:_[D],N=t===m?null:M[D],O=E(V),X=O.extent,Y=O.selection,B=X[0][0],F=X[0][1],H=X[1][0],J=X[1][1],L=G&&N&&s.event.shiftKey,Q=s.mouse(V),R=Q,U=C(V,arguments).beforestart();"overlay"===D?O.selection=Y=[[e=t===y?B:Q[0],a=t===m?F:Q[1]],[v=t===y?H:e,k=t===m?J:a]]:(e=Y[0][0],a=Y[0][1],v=Y[1][0],k=Y[1][1]),r=e,u=a,b=v,z=k;var W=s.select(V).attr("pointer-events","none"),Z=W.selectAll(".overlay").attr("cursor",w[D]);if(s.event.touches)U.moved=tt,U.ended=nt;else{var $=s.select(s.event.view).on("keydown.brush",function(){switch(s.event.keyCode){case 16:L=G&&N;break;case 18:I===f&&(G&&(v=b-A*G,e=r+A*G),N&&(k=z-q*N,a=u+q*N),I=d,et());break;case 32:I!==f&&I!==d||(G<0?v=b-A:G>0&&(e=r-A),N<0?k=z-q:N>0&&(a=u-q),I=h,Z.attr("cursor",w.selection),et());break;default:return}l()},!0).on("keyup.brush",function(){switch(s.event.keyCode){case 16:L&&(S=T=L=!1,et());break;case 18:I===d&&(G<0?v=b:G>0&&(e=r),N<0?k=z:N>0&&(a=u),I=f,et());break;case 32:I===h&&(s.event.altKey?(G&&(v=b-A*G,e=r+A*G),N&&(k=z-q*N,a=u+q*N),I=d):(G<0?v=b:G>0&&(e=r),N<0?k=z:N>0&&(a=u),I=f),Z.attr("cursor",w[D]),et());break;default:return}l()},!0).on("mousemove.brush",tt,!0).on("mouseup.brush",nt,!0);n.dragDisable(s.event.view)}o(),i.interrupt(V),j.call(V),U.start()}function tt(){var t=s.mouse(V);!L||S||T||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?T=!0:S=!0),R=t,P=!0,l(),et()}function et(){var t;switch(A=R[0]-Q[0],q=R[1]-Q[1],I){case h:case c:G&&(A=Math.max(B-e,Math.min(H-v,A)),r=e+A,b=v+A),N&&(q=Math.max(F-a,Math.min(J-k,q)),u=a+q,z=k+q);break;case f:G<0?(A=Math.max(B-e,Math.min(H-e,A)),r=e+A,b=v):G>0&&(A=Math.max(B-v,Math.min(H-v,A)),r=e,b=v+A),N<0?(q=Math.max(F-a,Math.min(J-a,q)),u=a+q,z=k):N>0&&(q=Math.max(F-k,Math.min(J-k,q)),u=a,z=k+q);break;case d:G&&(r=Math.max(B,Math.min(H,e-A*G)),b=Math.max(B,Math.min(H,v+A*G))),N&&(u=Math.max(F,Math.min(J,a-q*N)),z=Math.max(F,Math.min(J,k+q*N)))}b<r&&(G*=-1,t=e,e=v,v=t,t=r,r=b,b=t,D in g&&Z.attr("cursor",w[D=g[D]])),z<u&&(N*=-1,t=a,a=k,k=t,t=u,u=z,z=t,D in x&&Z.attr("cursor",w[D=x[D]])),O.selection&&(Y=O.selection),S&&(r=Y[0][0],b=Y[1][0]),T&&(u=Y[0][1],z=Y[1][1]),Y[0][0]===r&&Y[0][1]===u&&Y[1][0]===b&&Y[1][1]===z||(O.selection=[[r,u],[b,z]],j.call(V),U.brush())}function nt(){if(o(),s.event.touches){if(s.event.touches.length)return;p&&clearTimeout(p),p=setTimeout(function(){p=null},500)}else n.dragEnable(s.event.view,P),$.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);W.attr("pointer-events","all"),Z.attr("cursor",w.overlay),O.selection&&(Y=O.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(Y)&&(O.selection=null,j.call(V)),U.end()}}function G(){C(this,arguments).moved()}function N(){C(this,arguments).ended()}function O(){var e=this.__brush||{selection:null};return e.extent=v(b.apply(this,arguments)),e.dim=t,e}return V.move=function(e,n){e.selection?e.on("start.brush",function(){C(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){C(this,arguments).end()}).tween("brush",function(){var e=this,s=e.__brush,i=C(e,arguments),a=s.selection,u=t.input("function"==typeof n?n.apply(this,arguments):n,s.extent),o=r.interpolate(a,u);function l(t){s.selection=1===t&&null!==u?null:o(t),j.call(e),i.brush()}return null!==a&&null!==u?l:l(1)}):e.each(function(){var e=this,r=arguments,s=e.__brush,a=t.input("function"==typeof n?n.apply(e,r):n,s.extent),u=C(e,r).beforestart();i.interrupt(e),s.selection=null===a?null:a,j.call(e),u.start().brush().end()})},D.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(e){s.customEvent(new u(V,e,t.output(this.state.selection)),S.apply,S,[e,this.that,this.args])}},V.extent=function(t){return arguments.length?(b="function"==typeof t?t:a(v(t)),V):b},V.filter=function(t){return arguments.length?(K="function"==typeof t?t:a(!!t),V):K},V.handleSize=function(t){return arguments.length?(T=+t,V):T},V.on=function(){var t=S.on.apply(S,arguments);return t===S?V:t},V}t.brush=function(){return K(b)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},t.brushX=function(){return K(m)},t.brushY=function(){return K(y)},Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-brush",
"version": "1.1.0-rc.1",
"version": "1.1.0-rc.2",
"publishConfig": {

@@ -5,0 +5,0 @@ "tag": "next"

@@ -19,3 +19,3 @@ # d3-brush

If you use NPM, `npm install d3-brush`. Otherwise, download the [latest release](https://github.com/d3/d3-brush/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-brush.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
If you use NPM, `npm install d3-brush`. Otherwise, download the [latest release](https://github.com/d3/d3-brush/releases/latest). You can load as a [standalone library](https://d3js.org/d3-brush.v1.min.js) or as part of [D3](https://github.com/d3/d3). ES modules, AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:

@@ -39,4 +39,2 @@ ```html

[Try d3-brush in your browser.](https://tonicdev.com/npm/d3-brush)
## API Reference

@@ -43,0 +41,0 @@

@@ -6,5 +6,5 @@ import {dispatch} from "d3-dispatch";

import {interrupt} from "d3-transition";
import constant from "./constant";
import BrushEvent from "./event";
import noevent, {nopropagation} from "./noevent";
import constant from "./constant.js";
import BrushEvent from "./event.js";
import noevent, {nopropagation} from "./noevent.js";

@@ -16,6 +16,14 @@ var MODE_DRAG = {name: "drag"},

function number1(e) {
return [+e[0], +e[1]];
}
function number2(e) {
return [number1(e[0]), number1(e[1])];
}
var X = {
name: "x",
handles: ["e", "w"].map(type),
input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; },
handles: ["w", "e"].map(type),
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }

@@ -27,3 +35,3 @@ };

handles: ["n", "s"].map(type),
input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; },
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }

@@ -34,4 +42,4 @@ };

name: "xy",
handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(type),
input: function(xy) { return xy; },
handles: ["nw", "n", "ne", "w", "e", "sw", "s", "se"].map(type),
input: function(xy) { return xy == null ? null : number2(xy); },
output: function(xy) { return xy; }

@@ -217,3 +225,3 @@ };

function tween(t) {
state.selection = t === 1 && empty(selection1) ? null : i(t);
state.selection = t === 1 && selection1 !== null ? null : i(t);
redraw.call(that);

@@ -223,3 +231,3 @@ emit.brush();

return selection0 && selection1 ? tween : tween(1);
return selection0 !== null && selection1 !== null ? tween : tween(1);
});

@@ -236,3 +244,3 @@ } else {

interrupt(that);
state.selection = selection1 == null || empty(selection1) ? null : selection1;
state.selection = selection1 === null ? null : selection1;
redraw.call(that);

@@ -539,3 +547,3 @@ emit.start().brush().end();

var state = this.__brush || {selection: null};
state.extent = extent.apply(this, arguments);
state.extent = number2(extent.apply(this, arguments));
state.dim = dim;

@@ -546,3 +554,3 @@ return state;

brush.extent = function(_) {
return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;
return arguments.length ? (extent = typeof _ === "function" ? _ : constant(number2(_)), brush) : extent;
};

@@ -549,0 +557,0 @@

@@ -6,2 +6,2 @@ export {

brushSelection
} from "./brush";
} from "./brush.js";
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc