(g)
| 7915 | d3.svg.brush = function() { |
| 7916 | var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], clamp = [ true, true ], extentDomain; |
| 7917 | function brush(g) { |
| 7918 | g.each(function() { |
| 7919 | var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e; |
| 7920 | g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); |
| 7921 | bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); |
| 7922 | fg.enter().append("rect").attr("class", "extent").style("cursor", "move"); |
| 7923 | tz.enter().append("g").attr("class", function(d) { |
| 7924 | return "resize " + d; |
| 7925 | }).style("cursor", function(d) { |
| 7926 | return d3_svg_brushCursor[d]; |
| 7927 | }).append("rect").attr("x", function(d) { |
| 7928 | return /[ew]$/.test(d) ? -3 : null; |
| 7929 | }).attr("y", function(d) { |
| 7930 | return /^[ns]/.test(d) ? -3 : null; |
| 7931 | }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); |
| 7932 | tz.style("display", brush.empty() ? "none" : null); |
| 7933 | tz.exit().remove(); |
| 7934 | if (x) { |
| 7935 | e = d3_scaleRange(x); |
| 7936 | bg.attr("x", e[0]).attr("width", e[1] - e[0]); |
| 7937 | redrawX(g); |
| 7938 | } |
| 7939 | if (y) { |
| 7940 | e = d3_scaleRange(y); |
| 7941 | bg.attr("y", e[0]).attr("height", e[1] - e[0]); |
| 7942 | redrawY(g); |
| 7943 | } |
| 7944 | redraw(g); |
| 7945 | }); |
| 7946 | } |
| 7947 | function redraw(g) { |
| 7948 | g.selectAll(".resize").attr("transform", function(d) { |
| 7949 | return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; |
no test coverage detected