{"action":"created","issue":{"url":"https://api.github.com/repos/gjbekker/molmil/issues/3","repository_url":"https://api.github.com/repos/gjbekker/molmil","labels_url":"https://api.github.com/repos/gjbekker/molmil/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/gjbekker/molmil/issues/3/comments","events_url":"https://api.github.com/repos/gjbekker/molmil/issues/3/events","html_url":"https://github.com/gjbekker/molmil/issues/3","id":181874758,"number":3,"title":"Labeling functionality","user":{"login":"gjbekker","id":15721196,"avatar_url":"https://avatars.githubusercontent.com/u/15721196?v=3","gravatar_id":"","url":"https://api.github.com/users/gjbekker","html_url":"https://github.com/gjbekker","followers_url":"https://api.github.com/users/gjbekker/followers","following_url":"https://api.github.com/users/gjbekker/following{/other_user}","gists_url":"https://api.github.com/users/gjbekker/gists{/gist_id}","starred_url":"https://api.github.com/users/gjbekker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjbekker/subscriptions","organizations_url":"https://api.github.com/users/gjbekker/orgs","repos_url":"https://api.github.com/users/gjbekker/repos","events_url":"https://api.github.com/users/gjbekker/events{/privacy}","received_events_url":"https://api.github.com/users/gjbekker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gjbekker/molmil/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"gjbekker","id":15721196,"avatar_url":"https://avatars.githubusercontent.com/u/15721196?v=3","gravatar_id":"","url":"https://api.github.com/users/gjbekker","html_url":"https://github.com/gjbekker","followers_url":"https://api.github.com/users/gjbekker/followers","following_url":"https://api.github.com/users/gjbekker/following{/other_user}","gists_url":"https://api.github.com/users/gjbekker/gists{/gist_id}","starred_url":"https://api.github.com/users/gjbekker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjbekker/subscriptions","organizations_url":"https://api.github.com/users/gjbekker/orgs","repos_url":"https://api.github.com/users/gjbekker/repos","events_url":"https://api.github.com/users/gjbekker/events{/privacy}","received_events_url":"https://api.github.com/users/gjbekker/received_events","type":"User","site_admin":false},"assignees":[{"login":"gjbekker","id":15721196,"avatar_url":"https://avatars.githubusercontent.com/u/15721196?v=3","gravatar_id":"","url":"https://api.github.com/users/gjbekker","html_url":"https://github.com/gjbekker","followers_url":"https://api.github.com/users/gjbekker/followers","following_url":"https://api.github.com/users/gjbekker/following{/other_user}","gists_url":"https://api.github.com/users/gjbekker/gists{/gist_id}","starred_url":"https://api.github.com/users/gjbekker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjbekker/subscriptions","organizations_url":"https://api.github.com/users/gjbekker/orgs","repos_url":"https://api.github.com/users/gjbekker/repos","events_url":"https://api.github.com/users/gjbekker/events{/privacy}","received_events_url":"https://api.github.com/users/gjbekker/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-10-09T08:40:58Z","updated_at":"2016-10-17T08:13:49Z","closed_at":null,"body":"@SkBlaz requested labeling functionality for Molmil in issue #2.\r\n\r\nThe new function `molmil.addLabel` adds an arbitrary label somewhere in the canvas.\r\nThe size of the text is zoom-level independent, but can be modified by the user.\r\n\r\n<b>`molmil.addLabel(text, settings, soup)`</b>\r\n - `text`: content for the label (required)\r\n - `settings`:\r\n   - `xyz`: array determining the position of the label in 3D space (required)\r\n   - `dx`: offset along x axis in screen space (default value `0.0`)\r\n   - `dy`: offset along y axis in screen space (default value `0.0`)\r\n   - `dz`: offset along z axis in screen space (default value `0.0`)\r\n   - `fontSize`: size of the text (default value `20.0`)\r\n   - `color`: rgb color of the text (default value `[0, 255, 0]`)\r\n - `soup`: molmil.viewer object to load the data into (optional in command-line mode)\r\n\r\nUsage example:\r\n\r\n```javascript\r\n  molmil.loadPDB(\"1crn\", null, null, canvas.molmilViewer);\r\n        \r\n  var chain = canvas.molmilViewer.structures[0].chains[0];\r\n  var CA = chain.molecules[0].CA;\r\n  var xyz = [chain.modelsXYZ[0][CA.xyz], chain.modelsXYZ[0][CA.xyz+1], chain.modelsXYZ[0][CA.xyz+2]];\r\n  \r\n  molmil.addLabel(\"Thr1\", {xyz: xyz, dz: 2}, canvas.molmilViewer);\r\n        \r\n  var CA = chain.molecules[chain.molecules.length-1].CA;\r\n  var xyz = [chain.modelsXYZ[0][CA.xyz], chain.modelsXYZ[0][CA.xyz+1], chain.modelsXYZ[0][CA.xyz+2]];        \r\n  molmil.addLabel(\"Asn46\", {xyz: xyz, dz: 2, color: [255, 0, 0], fontSize: 40}, canvas.molmilViewer);\r\n```\r\n\r\nThis shows two labels; one for Thr1 and one for Asn46, where the latter has a font size of 40 (2x larger than the former) and is colored red.\r\nIn both cases `dz` is set to 2.0, meaning that the label is positioned 2A closer to the camera compared to the base position, which equals the CA atom in both cases.\r\nThis means that the label is positioned in front of the CA atom in any viewing direction.\r\n\r\nThe above commands produces the following labels:\r\n![labels](https://cloud.githubusercontent.com/assets/15721196/19219150/ba24b3b0-8e46-11e6-9d20-2d954501a170.png)\r\n"},"comment":{"url":"https://api.github.com/repos/gjbekker/molmil/issues/comments/254141419","html_url":"https://github.com/gjbekker/molmil/issues/3#issuecomment-254141419","issue_url":"https://api.github.com/repos/gjbekker/molmil/issues/3","id":254141419,"user":{"login":"SkBlaz","id":10035780,"avatar_url":"https://avatars.githubusercontent.com/u/10035780?v=3","gravatar_id":"","url":"https://api.github.com/users/SkBlaz","html_url":"https://github.com/SkBlaz","followers_url":"https://api.github.com/users/SkBlaz/followers","following_url":"https://api.github.com/users/SkBlaz/following{/other_user}","gists_url":"https://api.github.com/users/SkBlaz/gists{/gist_id}","starred_url":"https://api.github.com/users/SkBlaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SkBlaz/subscriptions","organizations_url":"https://api.github.com/users/SkBlaz/orgs","repos_url":"https://api.github.com/users/SkBlaz/repos","events_url":"https://api.github.com/users/SkBlaz/events{/privacy}","received_events_url":"https://api.github.com/users/SkBlaz/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T08:13:49Z","updated_at":"2016-10-17T08:13:49Z","body":"Hello! Thanks for the improvements! We implemented the labeling functionality into our system, yet some problems remain, namely: while rotating the molecule, labels sometimes disappear and reappear at random, sometimes molmil instead of labels draws long lines all across canvas - I've seen such behavior once, the underlying matrices weren't rotating correctly. Is there anything you can do regarding this problem?\r\n\r\nThanks again"}}
{"actor":{"display_login":"SkBlaz"}}