Skip to content

Commit

Permalink
change to boolean, fixes slab#1654
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 28, 2017
1 parent 8924db2 commit 57d26fc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ class Selection {
}

handleDragging() {
let mouseCount = 0;
this.isMouseDown = false;
this.emitter.listenDOM('mousedown', document.body, () => {
mouseCount += 1;
this.isMouseDown = true;
});
this.emitter.listenDOM('mouseup', document.body, () => {
mouseCount -= 1;
if (mouseCount === 0) {
this.update(Emitter.sources.USER);
}
this.isMouseDown = false;
this.update(Emitter.sources.USER);
});
this.emitter.listenDOM('selectionchange', document, () => {
if (mouseCount === 0) {
if (!this.isMouseDown) {
setTimeout(this.update.bind(this, Emitter.sources.USER), 1);
}
});
Expand Down

0 comments on commit 57d26fc

Please sign in to comment.