From aada88cb5679af1a8904f5634a0edd0fe7113e48 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Wed, 13 Jun 2018 12:32:32 -0700 Subject: [PATCH] clean up event handling code --- src/components/interactive-map.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/interactive-map.js b/src/components/interactive-map.js index f620793b8..73c9f4f54 100644 --- a/src/components/interactive-map.js +++ b/src/components/interactive-map.js @@ -184,9 +184,6 @@ export default class InteractiveMap extends PureComponent { this._getFeatures = this._getFeatures.bind(this); this._onInteractiveStateChange = this._onInteractiveStateChange.bind(this); this._getPos = this._getPos.bind(this); - this._onMouseMove = this._onMouseMove.bind(this); - this._onMouseClick = this._onMouseClick.bind(this); - this._onContextMenu = this._onContextMenu.bind(this); this._eventCanvasLoaded = this._eventCanvasLoaded.bind(this); this._staticMapLoaded = this._staticMapLoaded.bind(this); } @@ -203,9 +200,11 @@ export default class InteractiveMap extends PureComponent { const eventManager = this._eventManager; // Register additional event handlers for click and hover - eventManager.on('mousemove', this._onMouseMove); - eventManager.on('click', this._onMouseClick); - eventManager.on('contextmenu', this._onContextMenu); + eventManager.on({ + mousemove: this._onMouseMove.bind(this), + click: this._onMouseClick.bind(this), + contextmenu: this._onContextMenu.bind(this) + }); this._mapControls.setOptions(Object.assign({}, this.props, { onStateChange: this._onInteractiveStateChange,