|
|
|
|
@@ -11,7 +11,7 @@ import {WEBKIT, MAC} from '../has.js';
|
|
|
|
|
* Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
|
|
|
|
|
* additionally the shift-key is pressed).
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if only the alt key is pressed.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -28,7 +28,7 @@ export const altKeyOnly = function(mapBrowserEvent) {
|
|
|
|
|
* Return `true` if only the alt-key and shift-key is pressed, `false` otherwise
|
|
|
|
|
* (e.g. when additionally the platform-modifier-key is pressed).
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if only the alt and shift keys are pressed.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -45,7 +45,7 @@ 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.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Map browser event.
|
|
|
|
|
* @return {boolean} The map has the focus.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -57,7 +57,7 @@ export const focus = function(event) {
|
|
|
|
|
/**
|
|
|
|
|
* Return always true.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True.
|
|
|
|
|
* @function
|
|
|
|
|
* @api
|
|
|
|
|
@@ -68,7 +68,7 @@ export const always = TRUE;
|
|
|
|
|
/**
|
|
|
|
|
* Return `true` if the event is a `click` event, `false` otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the event is a map `click` event.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -83,7 +83,7 @@ export const click = function(mapBrowserEvent) {
|
|
|
|
|
* By definition, this includes left-click on windows/linux, and left-click
|
|
|
|
|
* without the ctrl key on Macs.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} The result.
|
|
|
|
|
*/
|
|
|
|
|
export const mouseActionButton = function(mapBrowserEvent) {
|
|
|
|
|
@@ -96,7 +96,7 @@ export const mouseActionButton = function(mapBrowserEvent) {
|
|
|
|
|
/**
|
|
|
|
|
* Return always false.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} False.
|
|
|
|
|
* @function
|
|
|
|
|
* @api
|
|
|
|
|
@@ -108,7 +108,7 @@ export const never = FALSE;
|
|
|
|
|
* Return `true` if the browser event is a `pointermove` event, `false`
|
|
|
|
|
* otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the browser event is a `pointermove` event.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -120,7 +120,7 @@ export const pointerMove = function(mapBrowserEvent) {
|
|
|
|
|
/**
|
|
|
|
|
* Return `true` if the event is a map `singleclick` event, `false` otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the event is a map `singleclick` event.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -132,7 +132,7 @@ export const singleClick = function(mapBrowserEvent) {
|
|
|
|
|
/**
|
|
|
|
|
* Return `true` if the event is a map `dblclick` event, `false` otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the event is a map `dblclick` event.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -145,7 +145,7 @@ export const doubleClick = function(mapBrowserEvent) {
|
|
|
|
|
* Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is
|
|
|
|
|
* pressed.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True only if there no modifier keys are pressed.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -163,7 +163,7 @@ export const noModifierKeys = function(mapBrowserEvent) {
|
|
|
|
|
* ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally
|
|
|
|
|
* the shift-key is pressed).
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if only the platform modifier key is pressed.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -179,7 +179,7 @@ export const platformModifierKeyOnly = function(mapBrowserEvent) {
|
|
|
|
|
* Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when
|
|
|
|
|
* additionally the alt-key is pressed).
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if only the shift key is pressed.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -196,7 +196,7 @@ export const shiftKeyOnly = function(mapBrowserEvent) {
|
|
|
|
|
* Return `true` if the target element is not editable, i.e. not a `<input>`-,
|
|
|
|
|
* `<select>`- or `<textarea>`-element, `false` otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True only if the target element is not editable.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
@@ -213,14 +213,14 @@ export const targetNotEditable = function(mapBrowserEvent) {
|
|
|
|
|
/**
|
|
|
|
|
* Return `true` if the event originates from a mouse device.
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the event originates from a mouse device.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
export const mouseOnly = function(mapBrowserEvent) {
|
|
|
|
|
assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
|
|
|
|
|
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
|
|
|
|
return /** @type {ol.MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
|
|
|
|
|
return /** @type {module:ol/MapBrowserEvent~MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -229,7 +229,7 @@ export const mouseOnly = function(mapBrowserEvent) {
|
|
|
|
|
* contact with the surface or if the left mouse button is pressed.
|
|
|
|
|
* @see http://www.w3.org/TR/pointerevents/#button-states
|
|
|
|
|
*
|
|
|
|
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
|
|
|
|
|
* @return {boolean} True if the event originates from a primary pointer.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
|