{"action":"created","issue":{"url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/95","repository_url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu","labels_url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/95/comments","events_url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/95/events","html_url":"https://github.com/jonataswalker/ol3-contextmenu/issues/95","id":195079236,"number":95,"title":"Getting callback function to fire","user":{"login":"mckrti","id":22082936,"avatar_url":"https://avatars.githubusercontent.com/u/22082936?v=3","gravatar_id":"","url":"https://api.github.com/users/mckrti","html_url":"https://github.com/mckrti","followers_url":"https://api.github.com/users/mckrti/followers","following_url":"https://api.github.com/users/mckrti/following{/other_user}","gists_url":"https://api.github.com/users/mckrti/gists{/gist_id}","starred_url":"https://api.github.com/users/mckrti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mckrti/subscriptions","organizations_url":"https://api.github.com/users/mckrti/orgs","repos_url":"https://api.github.com/users/mckrti/repos","events_url":"https://api.github.com/users/mckrti/events{/privacy}","received_events_url":"https://api.github.com/users/mckrti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-12T20:38:22Z","updated_at":"2016-12-13T12:47:11Z","closed_at":null,"body":"I must be doing something wrong, as I am just testing a console.log fire for the callback function and nothing happens.  The menu is properly appearing though.\r\n\r\n    var contextmenu = new ContextMenu({\r\n\t\t\twidth: 170,\r\n\t\t\tdefaultItems: true\r\n\t\t\t});\r\n\t\tmap.addControl(_this.contextmenu);\r\n    var feature;\r\n    var restore = false;\r\n\t\tcontextmenu.on('open', function(evt){\r\n\t\t\t\r\n\t\t\tfeature = map.forEachFeatureAtPixel(evt.pixel, function(ft, l){\r\n\t\t\t\treturn ft;\r\n\t\t\t});\r\n\t\t\tif (feature) {\r\n\t\t\t\tcontextmenu.clear();\r\n\t\t\t\taddFeatureItem.data = {\r\n\t\t\t\t\tfeature: feature\r\n\t\t\t\t};\r\n\t\t\t\tcontextmenu.push(addFeatureItem);\r\n\t\t\t\trestore = true;\r\n\t\t\t} else if (restore) {\r\n\t\t\t\tcontextmenu.clear();\r\n\t\t\t\tcontextmenu.extend(contextmenu_items);\r\n\t\t\t\tcontextmenu.extend(contextmenu.getDefaultItems());\r\n\t\t\t\trestore = false;\r\n\t\t\t}\r\n\t\t});\r\n    var addFeatureItem = {\r\n\t\t\ttext: 'Add Feature Instance',\r\n\t\t\tcallback: addFeatureCallback\r\n\t\t};\r\n\t\tvar addFeatureCallback = function(obj) {\r\n\t\t\t\tconsole.log('hi');\r\n\t\t\t\tconsole.log(obj.data.feature);\r\n\t\t}\r\n\r\nThanks for any help."},"comment":{"url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/comments/266729835","html_url":"https://github.com/jonataswalker/ol3-contextmenu/issues/95#issuecomment-266729835","issue_url":"https://api.github.com/repos/jonataswalker/ol3-contextmenu/issues/95","id":266729835,"user":{"login":"jonataswalker","id":10571881,"avatar_url":"https://avatars.githubusercontent.com/u/10571881?v=3","gravatar_id":"","url":"https://api.github.com/users/jonataswalker","html_url":"https://github.com/jonataswalker","followers_url":"https://api.github.com/users/jonataswalker/followers","following_url":"https://api.github.com/users/jonataswalker/following{/other_user}","gists_url":"https://api.github.com/users/jonataswalker/gists{/gist_id}","starred_url":"https://api.github.com/users/jonataswalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonataswalker/subscriptions","organizations_url":"https://api.github.com/users/jonataswalker/orgs","repos_url":"https://api.github.com/users/jonataswalker/repos","events_url":"https://api.github.com/users/jonataswalker/events{/privacy}","received_events_url":"https://api.github.com/users/jonataswalker/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T12:47:11Z","updated_at":"2016-12-13T12:47:11Z","body":"Then consider this one - http://jsfiddle.net/jonataswalker/2vfe7r7L/\r\n\r\nNote:\r\n```javascript\r\nvar addFeatureItem = {\r\n  text: 'Add Feature Instance',\r\n  callback: addFeatureCallback // addFeatureCallback is undefined\r\n};\r\n```"}}
{"actor":{"display_login":"jonataswalker"}}