-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow preventDefault for dblclick and fix touch zoom/rotate
- Loading branch information
1 parent
5a3f663
commit 3e240a9
Showing
4 changed files
with
62 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const test = require('mapbox-gl-js-test').test; | ||
const window = require('../../../../src/util/window'); | ||
const Map = require('../../../../src/ui/map'); | ||
const DOM = require('../../../../src/util/dom'); | ||
const simulate = require('mapbox-gl-js-test/simulate_interaction'); | ||
|
||
function createMap() { | ||
return new Map({ container: DOM.create('div', '', window.document.body) }); | ||
} | ||
|
||
test('DoubleClickZoomHandler does not zoom if preventDefault is called on the dblclick event', (t) => { | ||
const map = createMap(); | ||
|
||
map.on('dblclick', e => e.preventDefault()); | ||
|
||
const zoom = t.spy(); | ||
map.on('zoom', zoom); | ||
|
||
simulate.dblclick(map.getCanvas()); | ||
|
||
t.equal(zoom.callCount, 0); | ||
|
||
map.remove(); | ||
t.end(); | ||
}); |