| 5540 | }; |
| 5541 | |
| 5542 | function redraw() { |
| 5543 | var group = select(this), |
| 5544 | selection = local(this).selection; |
| 5545 | |
| 5546 | if (selection) { |
| 5547 | group.selectAll(".selection") |
| 5548 | .style("display", null) |
| 5549 | .attr("x", selection[0][0]) |
| 5550 | .attr("y", selection[0][1]) |
| 5551 | .attr("width", selection[1][0] - selection[0][0]) |
| 5552 | .attr("height", selection[1][1] - selection[0][1]); |
| 5553 | |
| 5554 | group.selectAll(".handle") |
| 5555 | .style("display", null) |
| 5556 | .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; }) |
| 5557 | .attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; }) |
| 5558 | .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; }) |
| 5559 | .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; }); |
| 5560 | } |
| 5561 | |
| 5562 | else { |
| 5563 | group.selectAll(".selection,.handle") |
| 5564 | .style("display", "none") |
| 5565 | .attr("x", null) |
| 5566 | .attr("y", null) |
| 5567 | .attr("width", null) |
| 5568 | .attr("height", null); |
| 5569 | } |
| 5570 | } |
| 5571 | |
| 5572 | function emitter(that, args, clean) { |
| 5573 | var emit = that.__brush.emitter; |