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
+24
View File
@@ -157,6 +157,30 @@ oli.MapBrowserEvent.prototype.pixel;
oli.MapBrowserEvent.prototype.dragging; 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 * @interface
*/ */
+4 -5
View File
@@ -199,15 +199,14 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
/** /**
* Return `true` if the event originates from a mouse device. * 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. * @return {boolean} True if the event originates from a mouse device.
* @api stable * @api stable
*/ */
ol.events.condition.mouseOnly = function(mapBrowserEvent) { ol.events.condition.mouseOnly = function(mapBrowserPointerEvent) {
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
goog.asserts.assertInstanceof(mapBrowserEvent, ol.MapBrowserPointerEvent, return mapBrowserPointerEvent.pointerEvent.pointerType == 'mouse';
'Requires an ol.MapBrowserPointerEvent to work.');
return mapBrowserEvent.pointerEvent.pointerType == 'mouse';
}; };
+3
View File
@@ -91,6 +91,7 @@ ol.MapBrowserEvent.prototype.stopPropagation = function() {
/** /**
* @constructor * @constructor
* @implements {oli.MapBrowserPointerEvent}
* @extends {ol.MapBrowserEvent} * @extends {ol.MapBrowserEvent}
* @param {string} type Event type. * @param {string} type Event type.
* @param {ol.Map} map Map. * @param {ol.Map} map Map.
@@ -105,8 +106,10 @@ ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
opt_frameState); opt_frameState);
/** /**
* The underlying pointer event.
* @const * @const
* @type {ol.pointer.PointerEvent} * @type {ol.pointer.PointerEvent}
* @api
*/ */
this.pointerEvent = pointerEvent; this.pointerEvent = pointerEvent;
+3
View File
@@ -41,6 +41,7 @@ goog.require('ol.events.Event');
* touch events and even native pointer events. * touch events and even native pointer events.
* *
* @constructor * @constructor
* @implements {oli.pointer.PointerEvent}
* @extends {ol.events.Event} * @extends {ol.events.Event}
* @param {string} type The type of the event to create. * @param {string} type The type of the event to create.
* @param {Event} originalEvent The event. * @param {Event} originalEvent The event.
@@ -51,8 +52,10 @@ ol.pointer.PointerEvent = function(type, originalEvent, opt_eventDict) {
ol.events.Event.call(this, type); ol.events.Event.call(this, type);
/** /**
* The original browser event.
* @const * @const
* @type {Event} * @type {Event}
* @api
*/ */
this.originalEvent = originalEvent; this.originalEvent = originalEvent;