Socket
Socket
Sign inDemoInstall

d3-brush

Package Overview
Dependencies
Maintainers
2
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 2.0.0 to 2.0.1

4

dist/d3-brush.js

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

// https://d3js.org/d3-brush/ v2.0.0 Copyright 2020 Mike Bostock
// https://d3js.org/d3-brush/ v2.0.1 Copyright 2020 Mike Bostock
(function (global, factory) {

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

redraw.call(that);
emit.start();
emit.start(event);

@@ -437,0 +437,0 @@ function moved(event) {

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

// https://d3js.org/d3-brush/ v2.0.0 Copyright 2020 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,i,s){"use strict";var u=t=>()=>t;function o(t,{sourceEvent:e,target:n,selection:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function a(t){t.preventDefault(),t.stopImmediatePropagation()}var l={name:"drag"},c={name:"space"},h={name:"handle"},f={name:"center"};const{abs:d,max:p,min:b}=Math;function y(t){return[+t[0],+t[1]]}function v(t){return[y(t[0]),y(t[1])]}var m={name:"x",handles:["w","e"].map(E),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]]}},w={name:"y",handles:["n","s"].map(E),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]]}},g={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(E),input:function(t){return null==t?null:v(t)},output:function(t){return t}},_={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"},x={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},k={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},z={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},A={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function E(t){return{type:t}}function q(t){return!t.ctrlKey&&!t.button}function K(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function P(){return navigator.maxTouchPoints||"ontouchstart"in this}function T(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function V(t){var y,g=K,V=q,j=P,M=!0,S=e.dispatch("start","brush","end"),B=6;function C(e){var n=e.property("__brush",Y).selectAll(".overlay").data([E("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",_.overlay).merge(n).each(function(){var t=T(this).extent;i.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([E("selection")]).enter().append("rect").attr("class","selection").attr("cursor",_.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 _[t.type]}),e.each(D).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",G).filter(j).on("touchstart.brush",G).on("touchmove.brush",N).on("touchend.brush touchcancel.brush",X).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(){var t=i.select(this),e=T(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]-B/2:e[0][0]-B/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-B/2:e[0][1]-B/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+B:B}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+B:B})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function I(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new O(t,e,n):r}function O(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function G(e){if((!y||e.touches)&&V.apply(this,arguments)){var r,u,o,v,g,E,q,K,P,j,S,B=this,C=e.target.__data__.type,O="selection"===(M&&e.metaKey?C="overlay":C)?l:M&&e.altKey?f:h,G=t===w?null:z[C],N=t===m?null:A[C],X=T(B),Y=X.extent,F=X.selection,H=Y[0][0],J=Y[0][1],L=Y[1][0],Q=Y[1][1],R=0,U=0,W=G&&N&&M&&e.shiftKey,Z=Array.from(e.touches||[e],t=>{const e=t.identifier;return(t=i.pointer(t,B)).point0=t.slice(),t.identifier=e,t});if("overlay"===C){F&&(P=!0);const e=[Z[0],Z[1]||Z[0]];X.selection=F=[[r=t===w?H:b(e[0][0],e[1][0]),o=t===m?J:b(e[0][1],e[1][1])],[g=t===w?L:p(e[0][0],e[1][0]),q=t===m?Q:p(e[0][1],e[1][1])]],Z.length>1&&it()}else r=F[0][0],o=F[0][1],g=F[1][0],q=F[1][1];u=r,v=o,E=g,K=q;var $=i.select(B).attr("pointer-events","none"),tt=$.selectAll(".overlay").attr("cursor",_[C]);s.interrupt(B);var et=I(B,arguments,!0).beforestart();if(e.touches)et.moved=rt,et.ended=st;else{var nt=i.select(e.view).on("mousemove.brush",rt,!0).on("mouseup.brush",st,!0);M&&nt.on("keydown.brush",function(t){switch(t.keyCode){case 16:W=G&&N;break;case 18:O===h&&(G&&(g=E-R*G,r=u+R*G),N&&(q=K-U*N,o=v+U*N),O=f,it());break;case 32:O!==h&&O!==f||(G<0?g=E-R:G>0&&(r=u-R),N<0?q=K-U:N>0&&(o=v-U),O=c,tt.attr("cursor",_.selection),it());break;default:return}a(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:W&&(j=S=W=!1,it());break;case 18:O===f&&(G<0?g=E:G>0&&(r=u),N<0?q=K:N>0&&(o=v),O=h,it());break;case 32:O===c&&(t.altKey?(G&&(g=E-R*G,r=u+R*G),N&&(q=K-U*N,o=v+U*N),O=f):(G<0?g=E:G>0&&(r=u),N<0?q=K:N>0&&(o=v),O=h),tt.attr("cursor",_[C]),it());break;default:return}a(t)},!0),n.dragDisable(e.view)}D.call(B),et.start()}function rt(t){for(const e of t.changedTouches||[t])for(const t of Z)t.identifier===e.identifier&&(t.cur=i.pointer(e,B));if(W&&!j&&!S&&1===Z.length){const t=Z[0];d(t.cur[0]-t[0])>d(t.cur[1]-t[1])?S=!0:j=!0}for(const t of Z)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);P=!0,a(t),it(t)}function it(t){const e=Z[0],n=e.point0;var i;switch(R=e[0]-n[0],U=e[1]-n[1],O){case c:case l:G&&(R=p(H-r,b(L-g,R)),u=r+R,E=g+R),N&&(U=p(J-o,b(Q-q,U)),v=o+U,K=q+U);break;case h:Z[1]?(G&&(u=p(H,b(L,Z[0][0])),E=p(H,b(L,Z[1][0])),G=1),N&&(v=p(J,b(Q,Z[0][1])),K=p(J,b(Q,Z[1][1])),N=1)):(G<0?(R=p(H-r,b(L-r,R)),u=r+R,E=g):G>0&&(R=p(H-g,b(L-g,R)),u=r,E=g+R),N<0?(U=p(J-o,b(Q-o,U)),v=o+U,K=q):N>0&&(U=p(J-q,b(Q-q,U)),v=o,K=q+U));break;case f:G&&(u=p(H,b(L,r-R*G)),E=p(H,b(L,g+R*G))),N&&(v=p(J,b(Q,o-U*N)),K=p(J,b(Q,q+U*N)))}E<u&&(G*=-1,i=r,r=g,g=i,i=u,u=E,E=i,C in x&&tt.attr("cursor",_[C=x[C]])),K<v&&(N*=-1,i=o,o=q,q=i,i=v,v=K,K=i,C in k&&tt.attr("cursor",_[C=k[C]])),X.selection&&(F=X.selection),j&&(u=F[0][0],E=F[1][0]),S&&(v=F[0][1],K=F[1][1]),F[0][0]===u&&F[0][1]===v&&F[1][0]===E&&F[1][1]===K||(X.selection=[[u,v],[E,K]],D.call(B),et.brush(t))}function st(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;y&&clearTimeout(y),y=setTimeout(function(){y=null},500)}else n.dragEnable(t.view,P),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);$.attr("pointer-events","all"),tt.attr("cursor",_.overlay),X.selection&&(F=X.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(F)&&(X.selection=null,D.call(B)),et.end(t)}}function N(t){I(this,arguments).moved(t)}function X(t){I(this,arguments).ended(t)}function Y(){var e=this.__brush||{selection:null};return e.extent=v(g.apply(this,arguments)),e.dim=t,e}return C.move=function(e,n){e.tween?e.on("start.brush",function(t){I(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){I(this,arguments).end(t)}).tween("brush",function(){var e=this,i=e.__brush,s=I(e,arguments),u=i.selection,o=t.input("function"==typeof n?n.apply(this,arguments):n,i.extent),a=r.interpolate(u,o);function l(t){i.selection=1===t&&null===o?null:a(t),D.call(e),s.brush()}return null!==u&&null!==o?l:l(1)}):e.each(function(){var e=this,r=arguments,i=e.__brush,u=t.input("function"==typeof n?n.apply(e,r):n,i.extent),o=I(e,r).beforestart();s.interrupt(e),i.selection=null===u?null:u,D.call(e),o.start().brush().end()})},C.clear=function(t){C.move(t,null)},O.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t){return this.starting?(this.starting=!1,this.emit("start",t)):this.emit("brush",t),this},brush:function(t){return this.emit("brush",t),this},end:function(t){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t)),this},emit:function(e,n){var r=i.select(this.that).datum();S.call(e,this.that,new o(e,{sourceEvent:n,target:C,selection:t.output(this.state.selection),dispatch:S}),r)}},C.extent=function(t){return arguments.length?(g="function"==typeof t?t:u(v(t)),C):g},C.filter=function(t){return arguments.length?(V="function"==typeof t?t:u(!!t),C):V},C.touchable=function(t){return arguments.length?(j="function"==typeof t?t:u(!!t),C):j},C.handleSize=function(t){return arguments.length?(B=+t,C):B},C.keyModifiers=function(t){return arguments.length?(M=!!t,C):M},C.on=function(){var t=S.on.apply(S,arguments);return t===S?C:t},C}t.brush=function(){return V(g)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},t.brushX=function(){return V(m)},t.brushY=function(){return V(w)},Object.defineProperty(t,"__esModule",{value:!0})});
// https://d3js.org/d3-brush/ v2.0.1 Copyright 2020 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,i,s){"use strict";var u=t=>()=>t;function o(t,{sourceEvent:e,target:n,selection:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function a(t){t.preventDefault(),t.stopImmediatePropagation()}var l={name:"drag"},c={name:"space"},h={name:"handle"},f={name:"center"};const{abs:d,max:p,min:b}=Math;function y(t){return[+t[0],+t[1]]}function v(t){return[y(t[0]),y(t[1])]}var m={name:"x",handles:["w","e"].map(E),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]]}},w={name:"y",handles:["n","s"].map(E),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]]}},g={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(E),input:function(t){return null==t?null:v(t)},output:function(t){return t}},_={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"},x={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},k={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},z={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},A={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function E(t){return{type:t}}function q(t){return!t.ctrlKey&&!t.button}function K(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function P(){return navigator.maxTouchPoints||"ontouchstart"in this}function T(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function V(t){var y,g=K,V=q,j=P,M=!0,S=e.dispatch("start","brush","end"),B=6;function C(e){var n=e.property("__brush",Y).selectAll(".overlay").data([E("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",_.overlay).merge(n).each(function(){var t=T(this).extent;i.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([E("selection")]).enter().append("rect").attr("class","selection").attr("cursor",_.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 _[t.type]}),e.each(D).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",G).filter(j).on("touchstart.brush",G).on("touchmove.brush",N).on("touchend.brush touchcancel.brush",X).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(){var t=i.select(this),e=T(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]-B/2:e[0][0]-B/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-B/2:e[0][1]-B/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+B:B}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+B:B})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function I(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new O(t,e,n):r}function O(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function G(e){if((!y||e.touches)&&V.apply(this,arguments)){var r,u,o,v,g,E,q,K,P,j,S,B=this,C=e.target.__data__.type,O="selection"===(M&&e.metaKey?C="overlay":C)?l:M&&e.altKey?f:h,G=t===w?null:z[C],N=t===m?null:A[C],X=T(B),Y=X.extent,F=X.selection,H=Y[0][0],J=Y[0][1],L=Y[1][0],Q=Y[1][1],R=0,U=0,W=G&&N&&M&&e.shiftKey,Z=Array.from(e.touches||[e],t=>{const e=t.identifier;return(t=i.pointer(t,B)).point0=t.slice(),t.identifier=e,t});if("overlay"===C){F&&(P=!0);const e=[Z[0],Z[1]||Z[0]];X.selection=F=[[r=t===w?H:b(e[0][0],e[1][0]),o=t===m?J:b(e[0][1],e[1][1])],[g=t===w?L:p(e[0][0],e[1][0]),q=t===m?Q:p(e[0][1],e[1][1])]],Z.length>1&&it()}else r=F[0][0],o=F[0][1],g=F[1][0],q=F[1][1];u=r,v=o,E=g,K=q;var $=i.select(B).attr("pointer-events","none"),tt=$.selectAll(".overlay").attr("cursor",_[C]);s.interrupt(B);var et=I(B,arguments,!0).beforestart();if(e.touches)et.moved=rt,et.ended=st;else{var nt=i.select(e.view).on("mousemove.brush",rt,!0).on("mouseup.brush",st,!0);M&&nt.on("keydown.brush",function(t){switch(t.keyCode){case 16:W=G&&N;break;case 18:O===h&&(G&&(g=E-R*G,r=u+R*G),N&&(q=K-U*N,o=v+U*N),O=f,it());break;case 32:O!==h&&O!==f||(G<0?g=E-R:G>0&&(r=u-R),N<0?q=K-U:N>0&&(o=v-U),O=c,tt.attr("cursor",_.selection),it());break;default:return}a(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:W&&(j=S=W=!1,it());break;case 18:O===f&&(G<0?g=E:G>0&&(r=u),N<0?q=K:N>0&&(o=v),O=h,it());break;case 32:O===c&&(t.altKey?(G&&(g=E-R*G,r=u+R*G),N&&(q=K-U*N,o=v+U*N),O=f):(G<0?g=E:G>0&&(r=u),N<0?q=K:N>0&&(o=v),O=h),tt.attr("cursor",_[C]),it());break;default:return}a(t)},!0),n.dragDisable(e.view)}D.call(B),et.start(e)}function rt(t){for(const e of t.changedTouches||[t])for(const t of Z)t.identifier===e.identifier&&(t.cur=i.pointer(e,B));if(W&&!j&&!S&&1===Z.length){const t=Z[0];d(t.cur[0]-t[0])>d(t.cur[1]-t[1])?S=!0:j=!0}for(const t of Z)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);P=!0,a(t),it(t)}function it(t){const e=Z[0],n=e.point0;var i;switch(R=e[0]-n[0],U=e[1]-n[1],O){case c:case l:G&&(R=p(H-r,b(L-g,R)),u=r+R,E=g+R),N&&(U=p(J-o,b(Q-q,U)),v=o+U,K=q+U);break;case h:Z[1]?(G&&(u=p(H,b(L,Z[0][0])),E=p(H,b(L,Z[1][0])),G=1),N&&(v=p(J,b(Q,Z[0][1])),K=p(J,b(Q,Z[1][1])),N=1)):(G<0?(R=p(H-r,b(L-r,R)),u=r+R,E=g):G>0&&(R=p(H-g,b(L-g,R)),u=r,E=g+R),N<0?(U=p(J-o,b(Q-o,U)),v=o+U,K=q):N>0&&(U=p(J-q,b(Q-q,U)),v=o,K=q+U));break;case f:G&&(u=p(H,b(L,r-R*G)),E=p(H,b(L,g+R*G))),N&&(v=p(J,b(Q,o-U*N)),K=p(J,b(Q,q+U*N)))}E<u&&(G*=-1,i=r,r=g,g=i,i=u,u=E,E=i,C in x&&tt.attr("cursor",_[C=x[C]])),K<v&&(N*=-1,i=o,o=q,q=i,i=v,v=K,K=i,C in k&&tt.attr("cursor",_[C=k[C]])),X.selection&&(F=X.selection),j&&(u=F[0][0],E=F[1][0]),S&&(v=F[0][1],K=F[1][1]),F[0][0]===u&&F[0][1]===v&&F[1][0]===E&&F[1][1]===K||(X.selection=[[u,v],[E,K]],D.call(B),et.brush(t))}function st(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;y&&clearTimeout(y),y=setTimeout(function(){y=null},500)}else n.dragEnable(t.view,P),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);$.attr("pointer-events","all"),tt.attr("cursor",_.overlay),X.selection&&(F=X.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(F)&&(X.selection=null,D.call(B)),et.end(t)}}function N(t){I(this,arguments).moved(t)}function X(t){I(this,arguments).ended(t)}function Y(){var e=this.__brush||{selection:null};return e.extent=v(g.apply(this,arguments)),e.dim=t,e}return C.move=function(e,n){e.tween?e.on("start.brush",function(t){I(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){I(this,arguments).end(t)}).tween("brush",function(){var e=this,i=e.__brush,s=I(e,arguments),u=i.selection,o=t.input("function"==typeof n?n.apply(this,arguments):n,i.extent),a=r.interpolate(u,o);function l(t){i.selection=1===t&&null===o?null:a(t),D.call(e),s.brush()}return null!==u&&null!==o?l:l(1)}):e.each(function(){var e=this,r=arguments,i=e.__brush,u=t.input("function"==typeof n?n.apply(e,r):n,i.extent),o=I(e,r).beforestart();s.interrupt(e),i.selection=null===u?null:u,D.call(e),o.start().brush().end()})},C.clear=function(t){C.move(t,null)},O.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t){return this.starting?(this.starting=!1,this.emit("start",t)):this.emit("brush",t),this},brush:function(t){return this.emit("brush",t),this},end:function(t){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t)),this},emit:function(e,n){var r=i.select(this.that).datum();S.call(e,this.that,new o(e,{sourceEvent:n,target:C,selection:t.output(this.state.selection),dispatch:S}),r)}},C.extent=function(t){return arguments.length?(g="function"==typeof t?t:u(v(t)),C):g},C.filter=function(t){return arguments.length?(V="function"==typeof t?t:u(!!t),C):V},C.touchable=function(t){return arguments.length?(j="function"==typeof t?t:u(!!t),C):j},C.handleSize=function(t){return arguments.length?(B=+t,C):B},C.keyModifiers=function(t){return arguments.length?(M=!!t,C):M},C.on=function(){var t=S.on.apply(S,arguments);return t===S?C:t},C}t.brush=function(){return V(g)},t.brushSelection=function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},t.brushX=function(){return V(m)},t.brushY=function(){return V(w)},Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-brush",
"version": "2.0.0",
"version": "2.0.1",
"description": "Select a one- or two-dimensional region using the mouse or touch.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -410,3 +410,3 @@ import {dispatch} from "d3-dispatch";

redraw.call(that);
emit.start();
emit.start(event);

@@ -413,0 +413,0 @@ function moved(event) {

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