No olx and ol types for ol/interaction/KeyboardZoom

This commit is contained in:
ahocevar
2018-03-16 15:46:47 +01:00
parent a4a4a0cdca
commit 438ec66c4c
3 changed files with 20 additions and 52 deletions
-34
View File
@@ -46,40 +46,6 @@ olx.interaction.TranslateOptions.prototype.layers;
olx.interaction.TranslateOptions.prototype.hitTolerance; olx.interaction.TranslateOptions.prototype.hitTolerance;
/**
* @typedef {{duration: (number|undefined),
* condition: (ol.EventsConditionType|undefined),
* delta: (number|undefined)}}
*/
olx.interaction.KeyboardZoomOptions;
/**
* Animation duration in milliseconds. Default is `100`.
* @type {number|undefined}
* @api
*/
olx.interaction.KeyboardZoomOptions.prototype.duration;
/**
* A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link ol.events.condition.targetNotEditable}.
* @type {ol.EventsConditionType|undefined}
* @api
*/
olx.interaction.KeyboardZoomOptions.prototype.condition;
/**
* The amount to zoom on each key press. Default is `1`.
* @type {number|undefined}
* @api
*/
olx.interaction.KeyboardZoomOptions.prototype.delta;
/** /**
* @typedef {{ * @typedef {{
* condition: (ol.EventsConditionType|undefined), * condition: (ol.EventsConditionType|undefined),
-10
View File
@@ -14,16 +14,6 @@
*/ */
/**
* @typedef {Object} interaction_KeyboardZoomOptions
* @property {number|undefined} duration Animation duration in milliseconds. Default is `100`.
* @property {ol.EventsConditionType|undefined} condition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link ol.events.condition.targetNotEditable}.
* @property {number|undefined} delta The amount to zoom on each key press. Default is `1`.
*/
/** /**
* @typedef {Object} interaction_ModifyOptions * @typedef {Object} interaction_ModifyOptions
* @property {ol.EventsConditionType|undefined} condition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean * @property {ol.EventsConditionType|undefined} condition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
+20 -8
View File
@@ -6,6 +6,18 @@ import EventType from '../events/EventType.js';
import {targetNotEditable} from '../events/condition.js'; import {targetNotEditable} from '../events/condition.js';
import Interaction, {zoomByDelta} from '../interaction/Interaction.js'; import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
/**
* @typedef {Object} Options
* @property {number} [duration=100] Animation duration in milliseconds.
* @property {module:ol/events/condition~Condition} [condition] A function that
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether that event should be handled. Default is
* {@link module:ol/events/condition~targetNotEditable}.
* @property {number} [delta=1] The zoom level delta on each key press.
*/
/** /**
* @classdesc * @classdesc
* Allows the user to zoom the map using keyboard + and -. * Allows the user to zoom the map using keyboard + and -.
@@ -13,14 +25,14 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
* the keys can only be used when browser focus is on the element to which * the keys can only be used when browser focus is on the element to which
* the keyboard events are attached. By default, this is the map div, * the keyboard events are attached. By default, this is the map div,
* though you can change this with the `keyboardEventTarget` in * though you can change this with the `keyboardEventTarget` in
* {@link ol.Map}. `document` never loses focus but, for any other element, * {@link module:ol/Map~Map}. `document` never loses focus but, for any other
* focus will have to be on, and returned to, this element if the keys are to * element, focus will have to be on, and returned to, this element if the keys
* function. * are to function.
* See also {@link ol.interaction.KeyboardPan}. * See also {@link moudle:ol/interaction/KeyboardPan~KeyboardPan}.
* *
* @constructor * @constructor
* @param {olx.interaction.KeyboardZoomOptions=} opt_options Options. * @param {module:ol/interaction/KeyboardZoom~Options=} opt_options Options.
* @extends {ol.interaction.Interaction} * @extends {module:ol/interaction/Interaction~Interaction}
* @api * @api
*/ */
const KeyboardZoom = function(opt_options) { const KeyboardZoom = function(opt_options) {
@@ -33,7 +45,7 @@ const KeyboardZoom = function(opt_options) {
/** /**
* @private * @private
* @type {ol.EventsConditionType} * @type {module:ol/events/condition~Condition}
*/ */
this.condition_ = options.condition ? options.condition : targetNotEditable; this.condition_ = options.condition ? options.condition : targetNotEditable;
@@ -60,7 +72,7 @@ inherits(KeyboardZoom, Interaction);
* key pressed was '+' or '-'). * key pressed was '+' or '-').
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event. * @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation. * @return {boolean} `false` to stop event propagation.
* @this {ol.interaction.KeyboardZoom} * @this {module:ol/interaction/KeyboardZoom~KeyboardZoom}
*/ */
function handleEvent(mapBrowserEvent) { function handleEvent(mapBrowserEvent) {
let stopEvent = false; let stopEvent = false;