More precise Event typing

This commit is contained in:
Frederic Junod
2018-06-29 10:09:10 +02:00
parent 8c4c70e9f0
commit 6da2e4cef4
9 changed files with 33 additions and 33 deletions

View File

@@ -256,7 +256,7 @@ Attribution.prototype.updateElement_ = function(frameState) {
/**
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
Attribution.prototype.handleClick_ = function(event) {

View File

@@ -136,7 +136,7 @@ inherits(FullScreen, Control);
/**
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
FullScreen.prototype.handleClick_ = function(event) {

View File

@@ -498,7 +498,7 @@ OverviewMap.prototype.calculateCoordinateRotate_ = function(
/**
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
OverviewMap.prototype.handleClick_ = function(event) {

View File

@@ -113,7 +113,7 @@ inherits(Rotate, Control);
/**
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
Rotate.prototype.handleClick_ = function(event) {

View File

@@ -98,7 +98,7 @@ inherits(Zoom, Control);
/**
* @param {number} delta Zoom delta.
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
Zoom.prototype.handleClick_ = function(delta, event) {

View File

@@ -227,7 +227,7 @@ export function render(mapEvent) {
/**
* @param {Event} event The browser event to handle.
* @param {MouseEvent} event The browser event to handle.
* @private
*/
ZoomSlider.prototype.handleContainerClick_ = function(event) {

View File

@@ -68,7 +68,7 @@ inherits(ZoomToExtent, Control);
/**
* @param {Event} event The event to handle
* @param {MouseEvent} event The event to handle
* @private
*/
ZoomToExtent.prototype.handleClick_ = function(event) {

View File

@@ -106,7 +106,7 @@ const DEDUP_DIST = 25;
* or detect that the positions are invalid.
*
* @private
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
* @return {boolean} True, if the event was generated by a touch.
*/
MouseSource.prototype.isEventSimulatedFromTouch_ = function(inEvent) {
@@ -154,7 +154,7 @@ function prepareEvent(inEvent, dispatcher) {
/**
* Handler for `mousedown`.
*
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
*/
MouseSource.prototype.mousedown = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -173,7 +173,7 @@ MouseSource.prototype.mousedown = function(inEvent) {
/**
* Handler for `mousemove`.
*
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
*/
MouseSource.prototype.mousemove = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -186,7 +186,7 @@ MouseSource.prototype.mousemove = function(inEvent) {
/**
* Handler for `mouseup`.
*
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
*/
MouseSource.prototype.mouseup = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -204,7 +204,7 @@ MouseSource.prototype.mouseup = function(inEvent) {
/**
* Handler for `mouseover`.
*
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
*/
MouseSource.prototype.mouseover = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -217,7 +217,7 @@ MouseSource.prototype.mouseover = function(inEvent) {
/**
* Handler for `mouseout`.
*
* @param {Event} inEvent The in event.
* @param {MouseEvent} inEvent The in event.
*/
MouseSource.prototype.mouseout = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {

View File

@@ -131,7 +131,7 @@ TouchSource.prototype.setPrimaryTouch_ = function(inTouch) {
/**
* @private
* @param {Object} inPointer The in pointer object.
* @param {PointerEvent} inPointer The in pointer object.
*/
TouchSource.prototype.removePrimaryPointer_ = function(inPointer) {
if (inPointer.isPrimary) {
@@ -172,9 +172,9 @@ TouchSource.prototype.cancelResetClickCount_ = function() {
/**
* @private
* @param {Event} browserEvent Browser event
* @param {TouchEvent} browserEvent Browser event
* @param {Touch} inTouch Touch event
* @return {Object} A pointer object.
* @return {PointerEvent} A pointer object.
*/
TouchSource.prototype.touchToPointer_ = function(browserEvent, inTouch) {
const e = this.dispatcher.cloneEvent(browserEvent, inTouch);
@@ -208,8 +208,8 @@ TouchSource.prototype.touchToPointer_ = function(browserEvent, inTouch) {
/**
* @private
* @param {Event} inEvent Touch event
* @param {function(Event, Object)} inFunction In function.
* @param {TouchEvent} inEvent Touch event
* @param {function(TouchEvent, PointerEvent)} inFunction In function.
*/
TouchSource.prototype.processTouches_ = function(inEvent, inFunction) {
const touches = Array.prototype.slice.call(inEvent.changedTouches);
@@ -253,7 +253,7 @@ TouchSource.prototype.findTouch_ = function(touchList, searchId) {
* this "abandoned" touch
*
* @private
* @param {Event} inEvent The in event.
* @param {TouchEvent} inEvent The in event.
*/
TouchSource.prototype.vacuumTouches_ = function(inEvent) {
const touchList = inEvent.touches;
@@ -284,7 +284,7 @@ TouchSource.prototype.vacuumTouches_ = function(inEvent) {
* Handler for `touchstart`, triggers `pointerover`,
* `pointerenter` and `pointerdown` events.
*
* @param {Event} inEvent The in event.
* @param {TouchEvent} inEvent The in event.
*/
TouchSource.prototype.touchstart = function(inEvent) {
this.vacuumTouches_(inEvent);
@@ -297,8 +297,8 @@ TouchSource.prototype.touchstart = function(inEvent) {
/**
* @private
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer object.
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer object.
*/
TouchSource.prototype.overDown_ = function(browserEvent, inPointer) {
this.pointerMap[inPointer.pointerId] = {
@@ -315,7 +315,7 @@ TouchSource.prototype.overDown_ = function(browserEvent, inPointer) {
/**
* Handler for `touchmove`.
*
* @param {Event} inEvent The in event.
* @param {TouchEvent} inEvent The in event.
*/
TouchSource.prototype.touchmove = function(inEvent) {
inEvent.preventDefault();
@@ -325,8 +325,8 @@ TouchSource.prototype.touchmove = function(inEvent) {
/**
* @private
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer.
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer.
*/
TouchSource.prototype.moveOverOut_ = function(browserEvent, inPointer) {
const event = inPointer;
@@ -362,7 +362,7 @@ TouchSource.prototype.moveOverOut_ = function(browserEvent, inPointer) {
* Handler for `touchend`, triggers `pointerup`,
* `pointerout` and `pointerleave` events.
*
* @param {Event} inEvent The event.
* @param {TouchEvent} inEvent The event.
*/
TouchSource.prototype.touchend = function(inEvent) {
this.dedupSynthMouse_(inEvent);
@@ -372,8 +372,8 @@ TouchSource.prototype.touchend = function(inEvent) {
/**
* @private
* @param {Event} browserEvent An event.
* @param {Object} inPointer The inPointer object.
* @param {TouchEvent} browserEvent An event.
* @param {PointerEvent} inPointer The inPointer object.
*/
TouchSource.prototype.upOut_ = function(browserEvent, inPointer) {
this.dispatcher.up(inPointer, browserEvent);
@@ -387,7 +387,7 @@ TouchSource.prototype.upOut_ = function(browserEvent, inPointer) {
* Handler for `touchcancel`, triggers `pointercancel`,
* `pointerout` and `pointerleave` events.
*
* @param {Event} inEvent The in event.
* @param {TouchEvent} inEvent The in event.
*/
TouchSource.prototype.touchcancel = function(inEvent) {
this.processTouches_(inEvent, this.cancelOut_);
@@ -396,8 +396,8 @@ TouchSource.prototype.touchcancel = function(inEvent) {
/**
* @private
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer.
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer.
*/
TouchSource.prototype.cancelOut_ = function(browserEvent, inPointer) {
this.dispatcher.cancel(inPointer, browserEvent);
@@ -409,7 +409,7 @@ TouchSource.prototype.cancelOut_ = function(browserEvent, inPointer) {
/**
* @private
* @param {Object} inPointer The inPointer object.
* @param {PointerEvent} inPointer The inPointer object.
*/
TouchSource.prototype.cleanUpPointer_ = function(inPointer) {
delete this.pointerMap[inPointer.pointerId];
@@ -421,7 +421,7 @@ TouchSource.prototype.cleanUpPointer_ = function(inPointer) {
* Prevent synth mouse events from creating pointer events.
*
* @private
* @param {Event} inEvent The in event.
* @param {TouchEvent} inEvent The in event.
*/
TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
const lts = this.mouseSource.lastTouches;