Fix event type and documentation of ol.events.condition.mouseOnly

This commit is contained in:
Andreas Hocevar
2016-07-19 15:00:05 +02:00
parent c0efa21d7f
commit a9c54e0c02
4 changed files with 34 additions and 5 deletions

View File

@@ -157,6 +157,30 @@ oli.MapBrowserEvent.prototype.pixel;
oli.MapBrowserEvent.prototype.dragging;
/**
* @interface
*/
oli.MapBrowserPointerEvent;
/**
* @type {ol.pointer.PointerEvent}
*/
oli.MapBrowserPointerEvent.prototype.pointerEvent;
/**
* @interface
*/
oli.pointer.PointerEvent;
/**
* @type {Event}
*/
oli.pointer.PointerEvent.prototype.originalEvent;
/**
* @interface
*/

View File

@@ -199,15 +199,14 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
/**
* Return `true` if the event originates from a mouse device.
*
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Map browser pointer
* event.
* @return {boolean} True if the event originates from a mouse device.
* @api stable
*/
ol.events.condition.mouseOnly = function(mapBrowserEvent) {
ol.events.condition.mouseOnly = function(mapBrowserPointerEvent) {
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
goog.asserts.assertInstanceof(mapBrowserEvent, ol.MapBrowserPointerEvent,
'Requires an ol.MapBrowserPointerEvent to work.');
return mapBrowserEvent.pointerEvent.pointerType == 'mouse';
return mapBrowserPointerEvent.pointerEvent.pointerType == 'mouse';
};

View File

@@ -91,6 +91,7 @@ ol.MapBrowserEvent.prototype.stopPropagation = function() {
/**
* @constructor
* @implements {oli.MapBrowserPointerEvent}
* @extends {ol.MapBrowserEvent}
* @param {string} type Event type.
* @param {ol.Map} map Map.
@@ -105,8 +106,10 @@ ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
opt_frameState);
/**
* The underlying pointer event.
* @const
* @type {ol.pointer.PointerEvent}
* @api
*/
this.pointerEvent = pointerEvent;

View File

@@ -41,6 +41,7 @@ goog.require('ol.events.Event');
* touch events and even native pointer events.
*
* @constructor
* @implements {oli.pointer.PointerEvent}
* @extends {ol.events.Event}
* @param {string} type The type of the event to create.
* @param {Event} originalEvent The event.
@@ -51,8 +52,10 @@ ol.pointer.PointerEvent = function(type, originalEvent, opt_eventDict) {
ol.events.Event.call(this, type);
/**
* The original browser event.
* @const
* @type {Event}
* @api
*/
this.originalEvent = originalEvent;