Merge pull request #5616 from ahocevar/fix-mouseonly-type

Fix event type and documentation of ol.events.condition.mouseOnly
This commit is contained in:
Andreas Hocevar
2016-08-23 09:46:16 +02:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -220,3 +220,7 @@ Hex color should have 3 or 6 digits.
### 55
The `{-y}` placeholder requires a tile grid with extent.
### 56
`mapBrowserEvent` must originate from a pointer event.

View File

@@ -2,7 +2,6 @@ goog.provide('ol.events.condition');
goog.require('ol.functions');
goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent');
/**
@@ -204,10 +203,9 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
* @api stable
*/
ol.events.condition.mouseOnly = function(mapBrowserEvent) {
ol.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
// 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 /** @type {ol.MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
};