From 68fc376383573caa2216b3fdb25f60433ded84fe Mon Sep 17 00:00:00 2001 From: Colleen Date: Fri, 17 Apr 2020 17:44:39 -0700 Subject: [PATCH 1/3] add example to MapMouseEvent --- src/ui/events.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ui/events.js b/src/ui/events.js index cf261c396fb..dca02f57286 100644 --- a/src/ui/events.js +++ b/src/ui/events.js @@ -12,11 +12,28 @@ import type LngLat from '../geo/lng_lat'; /** * `MapMouseEvent` is the event type for mouse-related map events. * @extends {Object} + * @example + * // The `click` event is an example of a `MapMouseEvent`. + * // Set up an event listener on the map. + * map.on('click', function(e) { + * // The event object (`e`) contains information like the + * // coordinates of the point on the map that was clicked. + * console.log('A click event has occurred at ' + e.lngLat); + * }); */ export class MapMouseEvent extends Event { - /** - * The event type. - */ + /** + * The event type (one of [`mousedown`](#map.event:mousedown), + * [`mouseup`](#map.event:mouseup), + * [`click`](#map.event:click), + * [`dblclick`](#map.event:dblclick), + * [`mousemove`](#map.event:mousemove), + * [`mouseover`](#map.event:mouseover), + * [`mouseover`](#map.event:mouseover), + * [`mouseover`](#map.event:mouseover), + * [`mouseout`](#map.event:mouseout), + * [`contextmenu`](#map.event:contextmenu)). + */ type: 'mousedown' | 'mouseup' | 'click' From c957c0a10097d5ff00c1b4434602b0c75eb5736f Mon Sep 17 00:00:00 2001 From: Colleen Date: Fri, 17 Apr 2020 17:55:01 -0700 Subject: [PATCH 2/3] fix linting error --- src/ui/events.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ui/events.js b/src/ui/events.js index dca02f57286..5d0f22e1d26 100644 --- a/src/ui/events.js +++ b/src/ui/events.js @@ -22,18 +22,18 @@ import type LngLat from '../geo/lng_lat'; * }); */ export class MapMouseEvent extends Event { - /** - * The event type (one of [`mousedown`](#map.event:mousedown), - * [`mouseup`](#map.event:mouseup), - * [`click`](#map.event:click), - * [`dblclick`](#map.event:dblclick), - * [`mousemove`](#map.event:mousemove), - * [`mouseover`](#map.event:mouseover), - * [`mouseover`](#map.event:mouseover), - * [`mouseover`](#map.event:mouseover), - * [`mouseout`](#map.event:mouseout), - * [`contextmenu`](#map.event:contextmenu)). - */ + /** + * The event type (one of [`mousedown`](#map.event:mousedown), + * [`mouseup`](#map.event:mouseup), + * [`click`](#map.event:click), + * [`dblclick`](#map.event:dblclick), + * [`mousemove`](#map.event:mousemove), + * [`mouseover`](#map.event:mouseover), + * [`mouseover`](#map.event:mouseover), + * [`mouseover`](#map.event:mouseover), + * [`mouseout`](#map.event:mouseout), + * [`contextmenu`](#map.event:contextmenu)). + */ type: 'mousedown' | 'mouseup' | 'click' From 0cceac583218af5311307277876766ceec390f1d Mon Sep 17 00:00:00 2001 From: Colleen Date: Fri, 17 Apr 2020 17:56:09 -0700 Subject: [PATCH 3/3] fix copy paste error --- src/ui/events.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/events.js b/src/ui/events.js index 5d0f22e1d26..4a678b24aac 100644 --- a/src/ui/events.js +++ b/src/ui/events.js @@ -29,8 +29,8 @@ export class MapMouseEvent extends Event { * [`dblclick`](#map.event:dblclick), * [`mousemove`](#map.event:mousemove), * [`mouseover`](#map.event:mouseover), - * [`mouseover`](#map.event:mouseover), - * [`mouseover`](#map.event:mouseover), + * [`mouseenter`](#map.event:mouseenter), + * [`mouseleave`](#map.event:mouseleave), * [`mouseout`](#map.event:mouseout), * [`contextmenu`](#map.event:contextmenu)). */