{"action":"closed","issue":{"url":"https://api.github.com/repos/uber/react-map-gl/issues/669","repository_url":"https://api.github.com/repos/uber/react-map-gl","labels_url":"https://api.github.com/repos/uber/react-map-gl/issues/669/labels{/name}","comments_url":"https://api.github.com/repos/uber/react-map-gl/issues/669/comments","events_url":"https://api.github.com/repos/uber/react-map-gl/issues/669/events","html_url":"https://github.com/uber/react-map-gl/issues/669","id":387421049,"node_id":"MDU6SXNzdWUzODc0MjEwNDk=","number":669,"title":"Handling Events in Custom MapController","user":{"login":"tomrussell","id":3959231,"node_id":"MDQ6VXNlcjM5NTkyMzE=","avatar_url":"https://avatars3.githubusercontent.com/u/3959231?v=4","gravatar_id":"","url":"https://api.github.com/users/tomrussell","html_url":"https://github.com/tomrussell","followers_url":"https://api.github.com/users/tomrussell/followers","following_url":"https://api.github.com/users/tomrussell/following{/other_user}","gists_url":"https://api.github.com/users/tomrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/tomrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomrussell/subscriptions","organizations_url":"https://api.github.com/users/tomrussell/orgs","repos_url":"https://api.github.com/users/tomrussell/repos","events_url":"https://api.github.com/users/tomrussell/events{/privacy}","received_events_url":"https://api.github.com/users/tomrussell/received_events","type":"User","site_admin":false},"labels":[{"id":270500275,"node_id":"MDU6TGFiZWwyNzA1MDAyNzU=","url":"https://api.github.com/repos/uber/react-map-gl/labels/bug","name":"bug","color":"b60205","default":true}],"state":"closed","locked":false,"assignee":{"login":"Pessimistress","id":2059298,"node_id":"MDQ6VXNlcjIwNTkyOTg=","avatar_url":"https://avatars2.githubusercontent.com/u/2059298?v=4","gravatar_id":"","url":"https://api.github.com/users/Pessimistress","html_url":"https://github.com/Pessimistress","followers_url":"https://api.github.com/users/Pessimistress/followers","following_url":"https://api.github.com/users/Pessimistress/following{/other_user}","gists_url":"https://api.github.com/users/Pessimistress/gists{/gist_id}","starred_url":"https://api.github.com/users/Pessimistress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pessimistress/subscriptions","organizations_url":"https://api.github.com/users/Pessimistress/orgs","repos_url":"https://api.github.com/users/Pessimistress/repos","events_url":"https://api.github.com/users/Pessimistress/events{/privacy}","received_events_url":"https://api.github.com/users/Pessimistress/received_events","type":"User","site_admin":false},"assignees":[{"login":"Pessimistress","id":2059298,"node_id":"MDQ6VXNlcjIwNTkyOTg=","avatar_url":"https://avatars2.githubusercontent.com/u/2059298?v=4","gravatar_id":"","url":"https://api.github.com/users/Pessimistress","html_url":"https://github.com/Pessimistress","followers_url":"https://api.github.com/users/Pessimistress/followers","following_url":"https://api.github.com/users/Pessimistress/following{/other_user}","gists_url":"https://api.github.com/users/Pessimistress/gists{/gist_id}","starred_url":"https://api.github.com/users/Pessimistress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pessimistress/subscriptions","organizations_url":"https://api.github.com/users/Pessimistress/orgs","repos_url":"https://api.github.com/users/Pessimistress/repos","events_url":"https://api.github.com/users/Pessimistress/events{/privacy}","received_events_url":"https://api.github.com/users/Pessimistress/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-12-04T18:27:31Z","updated_at":"2018-12-10T20:36:18Z","closed_at":"2018-12-10T20:36:18Z","author_association":"NONE","body":"I'm trying to work with the MapController component to construct a DrawControl as described in https://github.com/uber/react-map-gl/issues/450#issuecomment-378590697, but using the updated API in v4\r\n\r\nMy simple controller looks like this:\r\n\r\n```js\r\nclass DrawController extends MapController {\r\n  constructor({ enabled }) {\r\n    super();\r\n    this.enabled = enabled;\r\n    this.events = ['click'];\r\n  }\r\n  \r\n  handleEvent = (event) => {\r\n    if (this.enabled) {\r\n      if (event.type === 'click') {\r\n        console.log('Clicked');\r\n      }\r\n    }\r\n    return super.handleEvent(event);\r\n  }\r\n}\r\n```\r\n\r\nHandleEvent is called but the final line returns an error when returning to the parent handleEvent function\r\n\r\n```\r\nUncaught TypeError: Cannot read property 'call' of undefined\r\n    at DrawController._this.handleEvent (DrawController.js:16)\r\n    at EventRegistrar._emit (event-registrar.js:115)\r\n    at EventRegistrar.handleEvent (event-registrar.js:87)\r\n    at Manager.emit (hammer.js:2525)\r\n    at TapRecognizer.emit (hammer.js:2130)\r\n    at TapRecognizer.tryEmit (hammer.js:1572)\r\n    at TapRecognizer.<anonymous> (hammer.js:2109)\r\n    at boundFn (hammer.js:197)\r\n```\r\n"}}
{"actor":{"display_login":"Pessimistress"}}