Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/handler/shim/drag_rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ export default class DragRotateHandler {
* @returns {boolean} `true` if the "drag to rotate" interaction is active.
*/
isActive() {
return this._mouseRotate.isEnabled() || this._mousePitch.isEnabled();
return this._mouseRotate.isActive() || this._mousePitch.isActive();
}
}
24 changes: 24 additions & 0 deletions test/unit/ui/handler/drag_rotate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@ function createMap(t, options) {
return new Map(extend({container: DOM.create('div', '', window.document.body)}, options));
}

test('DragRotateHandler#isActive', (t) => {
const map = createMap(t);

// Prevent inertial rotation.
t.stub(browser, 'now').returns(0);

t.equal(map.dragRotate.isActive(), false);

simulate.mousedown(map.getCanvas(), {buttons: 2, button: 2});
map._renderTaskQueue.run();
t.equal(map.dragRotate.isActive(), false);

simulate.mousemove(map.getCanvas(), {buttons: 2, clientX: 10, clientY: 10});
map._renderTaskQueue.run();
t.equal(map.dragRotate.isActive(), true);

simulate.mouseup(map.getCanvas(), {buttons: 0, button: 2});
map._renderTaskQueue.run();
t.equal(map.dragRotate.isActive(), false);

map.remove();
t.end();
});

test('DragRotateHandler fires rotatestart, rotate, and rotateend events at appropriate times in response to a right-click drag', (t) => {
const map = createMap(t);

Expand Down