Skip to content

Instantly share code, notes, and snippets.

@bhousel
Last active March 17, 2016 04:25
Show Gist options
  • Save bhousel/bd85c95b1a87adfc6472 to your computer and use it in GitHub Desktop.
Save bhousel/bd85c95b1a87adfc6472 to your computer and use it in GitHub Desktop.
Debug Events
['touchstart', 'touchend', 'touchcancel',
'mousedown', 'mouseup',
'click', 'dblclick', 'contextmenu',
'dragstart', 'dragend',
'movestart', 'moveend',
'zoomstart', 'zoomend',
'rotatestart', 'rotateend',
'pitchstart', 'pitchend',
'boxzoomstart', 'boxzoomend', 'boxzoomcancel'
].forEach(function (type) {
map.off(type).on(type, function(data) {
var e = (data && data.originalEvent) || {};
var dbg =
(data.point ? ' point = ' + JSON.stringify(data.point) : '') +
(e.buttons ? ' buttons = ' + e.buttons : '') +
(e.button ? ' button = ' + e.button : '');
console.log(type + dbg);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment