Skip to content

Commit

Permalink
interrupt must be called before the new Emitter is created, otherwise…
Browse files Browse the repository at this point in the history
… the new gesture gets overridden

this showed in the brush transition notebook https://observablehq.com/d/a5be418e6d408119 where interrupting the "brush.move" after a first gesture would not emit the proper sourceEvent in the subsequent brushend
  • Loading branch information
Fil committed Jul 2, 2020
1 parent 9e87531 commit 578cb85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/brush.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ function brush(dim) {
t.point0 = t.slice();
t.identifier = i;
return t;
}),
emit = emitter(that, arguments, true).beforestart();
});

if (type === "overlay") {
if (selection) moving = true;
Expand Down Expand Up @@ -392,6 +391,9 @@ function brush(dim) {
var overlay = group.selectAll(".overlay")
.attr("cursor", cursors[type]);

interrupt(that);
var emit = emitter(that, arguments, true).beforestart();

if (event.touches) {
emit.moved = moved;
emit.ended = ended;
Expand All @@ -406,8 +408,6 @@ function brush(dim) {
dragDisable(event.view);
}

nopropagation(event);
interrupt(that);
redraw.call(that);
emit.start();

Expand Down

0 comments on commit 578cb85

Please sign in to comment.