No olx and ol types for ol/interaction/DragPan

This commit is contained in:
ahocevar
2018-03-14 13:40:46 +01:00
parent 12581b6a77
commit a71ad16995
3 changed files with 19 additions and 43 deletions
-25
View File
@@ -5,31 +5,6 @@
let olx; let olx;
/**
* @typedef {{condition: (ol.EventsConditionType|undefined),
* kinetic: (ol.Kinetic|undefined)}}
*/
olx.interaction.DragPanOptions;
/**
* 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.noModifierKeys}.
* @type {ol.EventsConditionType|undefined}
* @api
*/
olx.interaction.DragPanOptions.prototype.condition;
/**
* Kinetic inertia to apply to the pan.
* @type {ol.Kinetic|undefined}
* @api
*/
olx.interaction.DragPanOptions.prototype.kinetic;
/** /**
* @typedef {{condition: (ol.EventsConditionType|undefined), * @typedef {{condition: (ol.EventsConditionType|undefined),
* duration: (number|undefined)}} * duration: (number|undefined)}}
-9
View File
@@ -1,13 +1,4 @@
/**
* @typedef {Object} interaction_DragPanOptions
* @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.noModifierKeys}.
* @property {ol.Kinetic|undefined} kinetic Kinetic inertia to apply to the pan.
*/
/** /**
* @typedef {Object} interaction_DragRotateAndZoomOptions * @typedef {Object} interaction_DragRotateAndZoomOptions
* @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
+19 -9
View File
@@ -9,13 +9,23 @@ import {noModifierKeys} from '../events/condition.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import PointerInteraction, {centroid as centroidFromPointers} from '../interaction/Pointer.js'; import PointerInteraction, {centroid as centroidFromPointers} from '../interaction/Pointer.js';
/**
* @typedef {Object} Options
* @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~noModifierKeys}.
* @property {module:ol/Kinetic~Kinetic} [kinetic] Kinetic inertia to apply to the pan.
*/
/** /**
* @classdesc * @classdesc
* Allows the user to pan the map by dragging the map. * Allows the user to pan the map by dragging the map.
* *
* @constructor * @constructor
* @extends {ol.interaction.Pointer} * @extends {module:ol/interaction/Pointer~Pointer}
* @param {olx.interaction.DragPanOptions=} opt_options Options. * @param {module:ol/interaction/DragPan~Options=} opt_options Options.
* @api * @api
*/ */
const DragPan = function(opt_options) { const DragPan = function(opt_options) {
@@ -30,7 +40,7 @@ const DragPan = function(opt_options) {
/** /**
* @private * @private
* @type {ol.Kinetic|undefined} * @type {module:ol/Kinetic~Kinetic|undefined}
*/ */
this.kinetic_ = options.kinetic; this.kinetic_ = options.kinetic;
@@ -62,8 +72,8 @@ inherits(DragPan, PointerInteraction);
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {ol.interaction.DragPan} * @this {module:ol/interaction/DragPan~DragPan}
*/ */
function handleDragEvent(mapBrowserEvent) { function handleDragEvent(mapBrowserEvent) {
const targetPointers = this.targetPointers; const targetPointers = this.targetPointers;
@@ -95,9 +105,9 @@ function handleDragEvent(mapBrowserEvent) {
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence? * @return {boolean} Stop drag sequence?
* @this {ol.interaction.DragPan} * @this {module:ol/interaction/DragPan~DragPan}
*/ */
function handleUpEvent(mapBrowserEvent) { function handleUpEvent(mapBrowserEvent) {
const map = mapBrowserEvent.map; const map = mapBrowserEvent.map;
@@ -133,9 +143,9 @@ function handleUpEvent(mapBrowserEvent) {
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence? * @return {boolean} Start drag sequence?
* @this {ol.interaction.DragPan} * @this {module:ol/interaction/DragPan~DragPan}
*/ */
function handleDownEvent(mapBrowserEvent) { function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) { if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {