{"action":"created","issue":{"url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/32","repository_url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive","labels_url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/32/comments","events_url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/32/events","html_url":"https://github.com/Naimikan/angular-mapboxgl-directive/issues/32","id":257011799,"number":32,"title":"mapbox-gl-draw instance","user":{"login":"sprattek","id":11209863,"avatar_url":"https://avatars3.githubusercontent.com/u/11209863?v=4","gravatar_id":"","url":"https://api.github.com/users/sprattek","html_url":"https://github.com/sprattek","followers_url":"https://api.github.com/users/sprattek/followers","following_url":"https://api.github.com/users/sprattek/following{/other_user}","gists_url":"https://api.github.com/users/sprattek/gists{/gist_id}","starred_url":"https://api.github.com/users/sprattek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprattek/subscriptions","organizations_url":"https://api.github.com/users/sprattek/orgs","repos_url":"https://api.github.com/users/sprattek/repos","events_url":"https://api.github.com/users/sprattek/events{/privacy}","received_events_url":"https://api.github.com/users/sprattek/received_events","type":"User","site_admin":false},"labels":[{"id":432091101,"url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":515145457,"url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/labels/feedback%20needed","name":"feedback needed","color":"5319e7","default":false},{"id":432091104,"url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":{"login":"Naimikan","id":6245958,"avatar_url":"https://avatars0.githubusercontent.com/u/6245958?v=4","gravatar_id":"","url":"https://api.github.com/users/Naimikan","html_url":"https://github.com/Naimikan","followers_url":"https://api.github.com/users/Naimikan/followers","following_url":"https://api.github.com/users/Naimikan/following{/other_user}","gists_url":"https://api.github.com/users/Naimikan/gists{/gist_id}","starred_url":"https://api.github.com/users/Naimikan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naimikan/subscriptions","organizations_url":"https://api.github.com/users/Naimikan/orgs","repos_url":"https://api.github.com/users/Naimikan/repos","events_url":"https://api.github.com/users/Naimikan/events{/privacy}","received_events_url":"https://api.github.com/users/Naimikan/received_events","type":"User","site_admin":false},"assignees":[{"login":"Naimikan","id":6245958,"avatar_url":"https://avatars0.githubusercontent.com/u/6245958?v=4","gravatar_id":"","url":"https://api.github.com/users/Naimikan","html_url":"https://github.com/Naimikan","followers_url":"https://api.github.com/users/Naimikan/followers","following_url":"https://api.github.com/users/Naimikan/following{/other_user}","gists_url":"https://api.github.com/users/Naimikan/gists{/gist_id}","starred_url":"https://api.github.com/users/Naimikan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naimikan/subscriptions","organizations_url":"https://api.github.com/users/Naimikan/orgs","repos_url":"https://api.github.com/users/Naimikan/repos","events_url":"https://api.github.com/users/Naimikan/events{/privacy}","received_events_url":"https://api.github.com/users/Naimikan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2017-09-12T11:36:45Z","updated_at":"2018-02-07T03:00:20Z","closed_at":"2017-12-19T08:48:21Z","author_association":"NONE","body":"Hey, thanks for a great directive, I'm trying to extend it a bit with some custom functions which I need. I've already added [circle drawing tool](https://github.com/mblomdahl/mapbox-gl-circle) which works perfect.\r\n\r\nNow I would need some kind of floorplan positioning tool, currently I'm adding image layer with floorplan and I would like to add drawing tool polygon with same coordinates onto that and then redraw image in draw.update event. However I can't figure out how to get drawing tool instance in the directive so I can add polygon programatically. So I would need to do something like that straight in directive:\r\n\r\n```javascript\r\nvar feature = {\r\n  id: 'draw-'+elementId,\r\n  type: 'Feature',\r\n  properties: {},\r\n  geometry: { type: 'Polygon', coordinates: cornerPoints }\r\n};\r\nvar featureIds = draw.add(feature);\r\n```\r\n\r\nI've already tried to init whole drawing plugin in directive instead of enabling drawing via glControls like that:\r\n\r\n```javascript\r\n//Create a Draw control\r\nvar draw = new MapboxDraw();\r\n\r\n// Add the Draw control to your map\r\nmap.addControl(draw);\r\n\r\nvar feature = {\r\n        id: 'draw-'+elementId,\r\n        type: 'Feature',\r\n        properties: {},\r\n        geometry: { type: 'Polygon', coordinates: cornerPoints }\r\n};\r\nvar featureIds = draw.add(feature);\r\n```\r\n\r\nbut it's working a bit weird as polygon is not visible initially but after clicking somewhere on map it appears. So question, is it possible to get draw instance somehow and add polygon programatically? \r\n\r\nAny advices are welcome, thanks."},"comment":{"url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/comments/363640758","html_url":"https://github.com/Naimikan/angular-mapboxgl-directive/issues/32#issuecomment-363640758","issue_url":"https://api.github.com/repos/Naimikan/angular-mapboxgl-directive/issues/32","id":363640758,"user":{"login":"jfan0888","id":23710692,"avatar_url":"https://avatars2.githubusercontent.com/u/23710692?v=4","gravatar_id":"","url":"https://api.github.com/users/jfan0888","html_url":"https://github.com/jfan0888","followers_url":"https://api.github.com/users/jfan0888/followers","following_url":"https://api.github.com/users/jfan0888/following{/other_user}","gists_url":"https://api.github.com/users/jfan0888/gists{/gist_id}","starred_url":"https://api.github.com/users/jfan0888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfan0888/subscriptions","organizations_url":"https://api.github.com/users/jfan0888/orgs","repos_url":"https://api.github.com/users/jfan0888/repos","events_url":"https://api.github.com/users/jfan0888/events{/privacy}","received_events_url":"https://api.github.com/users/jfan0888/received_events","type":"User","site_admin":false},"created_at":"2018-02-07T03:00:20Z","updated_at":"2018-02-07T03:00:20Z","author_association":"NONE","body":"Hi @Naimikan!\r\n\r\nThanks for creating this directive. Currently I am trying to save and load something which I drawn by tool. Could you kindly assist me? I attached a screenshot to help your understanding."}}
{"actor":{"display_login":"jfan0888"}}