MCPcopy Index your code
hub / github.com/idank/explainshell / brush

Function brush

explainshell/web/static/js/d3.v3.js:7574–7603  ·  view source on GitHub ↗
(g)

Source from the content-addressed store, hash-verified

7572 d3.svg.brush = function() {
7573 var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
7574 function brush(g) {
7575 g.each(function() {
7576 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;
7577 g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
7578 bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
7579 fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
7580 tz.enter().append("g").attr("class", function(d) {
7581 return "resize " + d;
7582 }).style("cursor", function(d) {
7583 return d3_svg_brushCursor[d];
7584 }).append("rect").attr("x", function(d) {
7585 return /[ew]$/.test(d) ? -3 : null;
7586 }).attr("y", function(d) {
7587 return /^[ns]/.test(d) ? -3 : null;
7588 }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
7589 tz.style("display", brush.empty() ? "none" : null);
7590 tz.exit().remove();
7591 if (x) {
7592 e = d3_scaleRange(x);
7593 bg.attr("x", e[0]).attr("width", e[1] - e[0]);
7594 redrawX(g);
7595 }
7596 if (y) {
7597 e = d3_scaleRange(y);
7598 bg.attr("y", e[0]).attr("height", e[1] - e[0]);
7599 redrawY(g);
7600 }
7601 redraw(g);
7602 });
7603 }
7604 function redraw(g) {
7605 g.selectAll(".resize").attr("transform", function(d) {
7606 return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";

Callers

nothing calls this directly

Calls 5

d3_scaleRangeFunction · 0.85
redrawXFunction · 0.85
redrawYFunction · 0.85
redrawFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected