Merge pull request #7904 from ahocevar/focus-scroll

Add focus condition, e.g. for wheel zoom
This commit is contained in:
Andreas Hocevar
2018-02-28 08:21:37 +01:00
committed by GitHub
3 changed files with 29 additions and 8 deletions

View File

@@ -41,6 +41,19 @@ export const altShiftKeysOnly = function(mapBrowserEvent) {
};
/**
* Return `true` if the map has the focus. This condition requires a map target
* element with a `tabindex` attribute, e.g. `<div id="map" tabindex="1">`.
*
* @param {ol.MapBrowserEvent} event Map browser event.
* @return {boolean} The map has the focus.
* @api
*/
export const focus = function(event) {
return event.target.getTargetElement() === document.activeElement;
};
/**
* Return always true.
*