Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Aug 17, 2017
1 parent 211b753 commit 0dfa796
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/handler/drag_rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class DragRotateHandler {
}

_onUp(e: MouseEvent) {
window.document.removeEventListener('mousemove', this._onMove);
window.document.removeEventListener('mousemove', this._onMove, {capture: true});
window.document.removeEventListener('mouseup', this._onUp);
window.removeEventListener('blur', (this._onUp: any));

Expand Down
19 changes: 19 additions & 0 deletions test/unit/ui/handler/drag_rotate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ test('DragRotateHandler rotates in response to a right-click drag', (t) => {
t.end();
});

test('DragRotateHandler stops rotating after mouseup', (t) => {
const map = createMap();

simulate.mousedown(map.getCanvas(), {bubbles: true, buttons: 2, button: 2});
simulate.mousemove(map.getCanvas(), {bubbles: true, buttons: 2});
simulate.mouseup(map.getCanvas(), {bubbles: true, buttons: 0, button: 2});

const spy = t.spy();

map.on('rotatestart', spy);
map.on('rotate', spy);
map.on('rotateend', spy);

simulate.mousemove(map.getCanvas(), {bubbles: true, buttons: 0});

t.ok(spy.notCalled);
t.end();
});

test('DragRotateHandler rotates in response to a control-left-click drag', (t) => {
const map = createMap();

Expand Down

0 comments on commit 0dfa796

Please sign in to comment.