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.2 to 1.1.3-rc.1

18

dist/d3-brush.js

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

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

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

function toucher(identifier) {
return function(target) {
return d3Selection.touch(target, d3Selection.event.touches, identifier);
};
}
var X = {

@@ -59,3 +65,3 @@ name: "x",

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

@@ -339,9 +345,4 @@ output: function(xy) { return xy; }

function pointer(target) {
return d3Selection.clientPoint(target, d3Selection.event.touches ? d3Selection.event.touches[0] : d3Selection.event);
}
function started() {
if (d3Selection.event.touches) { if (d3Selection.event.changedTouches.length < d3Selection.event.touches.length) return noevent(); }
else if (touchending) return;
if (touchending && !d3Selection.event.touches) return;
if (!filter.apply(this, arguments)) return;

@@ -367,2 +368,3 @@

lockY,
pointer = d3Selection.event.touches ? toucher(d3Selection.event.changedTouches[0].identifier) : d3Selection.mouse,
point0 = pointer(that),

@@ -369,0 +371,0 @@ point = point0,

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

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

@@ -32,4 +35,3 @@ "keywords": [

"test": "tape 'test/**/*-test.js' && eslint src",
"prepublishOnly": "rm -rf dist && yarn test",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
"prepublishOnly": "rm -rf dist && yarn test"
},

@@ -36,0 +38,0 @@ "dependencies": {

import {dispatch} from "d3-dispatch";
import {dragDisable, dragEnable} from "d3-drag";
import {interpolate} from "d3-interpolate";
import {customEvent, event, clientPoint, select} from "d3-selection";
import {customEvent, event, touch, mouse, select} from "d3-selection";
import {interrupt} from "d3-transition";

@@ -23,2 +23,8 @@ import constant from "./constant.js";

function toucher(identifier) {
return function(target) {
return touch(target, event.touches, identifier);
};
}
var X = {

@@ -40,3 +46,3 @@ name: "x",

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

@@ -320,9 +326,4 @@ output: function(xy) { return xy; }

function pointer(target) {
return clientPoint(target, event.touches ? event.touches[0] : event);
}
function started() {
if (event.touches) { if (event.changedTouches.length < event.touches.length) return noevent(); }
else if (touchending) return;
if (touchending && !event.touches) return;
if (!filter.apply(this, arguments)) return;

@@ -348,2 +349,3 @@

lockY,
pointer = event.touches ? toucher(event.changedTouches[0].identifier) : mouse,
point0 = pointer(that),

@@ -350,0 +352,0 @@ point = point0,

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