Commit d512a78d authored by Mike Bostock's avatar Mike Bostock
Browse files

Remove redundant code in d3.svg.brush.

Now that d3.mouse does the “right thing” for touch events, we don’t need code
that handles touch events specially.
parent 8dc4ed81
......@@ -8114,7 +8114,7 @@ d3 = function() {
g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]);
}
function brushstart() {
var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(), center, origin = mouse(), offset;
var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(), center, origin = d3.mouse(target), offset;
var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup);
if (d3.event.changedTouches) {
w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
......@@ -8137,10 +8137,6 @@ d3 = function() {
type: "brushstart"
});
brushmove();
function mouse() {
var touches = d3.event.changedTouches;
return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
}
function keydown() {
if (d3.event.keyCode == 32) {
if (!dragging) {
......@@ -8161,7 +8157,7 @@ d3 = function() {
}
}
function brushmove() {
var point = mouse(), moved = false;
var point = d3.mouse(target), moved = false;
if (offset) {
point[0] += offset[0];
point[1] += offset[1];
......
This diff is collapsed.
......@@ -154,7 +154,7 @@ d3.svg.brush = function() {
dragging = eventTarget.classed("extent"),
dragRestore = d3_event_dragSuppress(),
center,
origin = mouse(),
origin = d3.mouse(target),
offset;
var w = d3.select(d3_window)
......@@ -198,11 +198,6 @@ d3.svg.brush = function() {
event_({type: "brushstart"});
brushmove();
function mouse() {
var touches = d3.event.changedTouches;
return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
}
function keydown() {
if (d3.event.keyCode == 32) {
if (!dragging) {
......@@ -225,7 +220,7 @@ d3.svg.brush = function() {
}
function brushmove() {
var point = mouse(),
var point = d3.mouse(target),
moved = false;
// Preserve the offset for thick resizers.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment