Merge pull request #7904 from ahocevar/focus-scroll
Add focus condition, e.g. for wheel zoom
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user