{"action":"created","comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/comments/59288667","id":59288667,"diff_hunk":"@@ -15,18 +15,21 @@ function StyleDeclaration(reference, value) {\n     this.json = JSON.stringify(this.value);\n \n     var parsedValue = this.type === 'color' ? parseColor(this.value) : value;\n-    if (reference.function === 'interpolated') {\n-        this.calculate = MapboxGLFunction.interpolated(parsedValue);\n-    } else {\n-        this.calculate = MapboxGLFunction['piecewise-constant'](parsedValue);\n-        if (reference.transition) {\n-            this.calculate = transitioned(this.calculate);\n-        }\n+    this.calculate = MapboxGLFunction[reference.function || 'piecewise-constant'](parsedValue);\n+    this.isFeatureConstant = this.calculate.isFeatureConstant;\n+    this.isGlobalConstant = this.calculate.isGlobalConstant;\n+\n+    if (reference.function === 'piecewise-constant' && reference.transition) {\n+        this.calculate = transitioned(this.calculate);\n     }\n }\n \n function transitioned(calculate) {\n-    return function(z, zh, duration) {\n+    return function(globalProperties, featureProperties) {\n+        var z = globalProperties.$zoom;\n+        var zh = globalProperties.$zoomHistory;\n+        var duration = globalProperties.$duration;","path":"js/style/style_declaration.js","position":33,"original_position":33,"commit_id":"0d7922131baa22bb79922a7e44988aab9e06297e","original_commit_id":"0d7922131baa22bb79922a7e44988aab9e06297e","user":{"login":"ansis","id":1421652,"avatar_url":"https://avatars.githubusercontent.com/u/1421652?v=3","gravatar_id":"","url":"https://api.github.com/users/ansis","html_url":"https://github.com/ansis","followers_url":"https://api.github.com/users/ansis/followers","following_url":"https://api.github.com/users/ansis/following{/other_user}","gists_url":"https://api.github.com/users/ansis/gists{/gist_id}","starred_url":"https://api.github.com/users/ansis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansis/subscriptions","organizations_url":"https://api.github.com/users/ansis/orgs","repos_url":"https://api.github.com/users/ansis/repos","events_url":"https://api.github.com/users/ansis/events{/privacy}","received_events_url":"https://api.github.com/users/ansis/received_events","type":"User","site_admin":false},"body":"Do all these need $$$?","created_at":"2016-04-11T21:55:06Z","updated_at":"2016-04-11T21:55:06Z","html_url":"https://github.com/mapbox/mapbox-gl-js/pull/1932#discussion_r59288667","pull_request_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932","_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/comments/59288667"},"html":{"href":"https://github.com/mapbox/mapbox-gl-js/pull/1932#discussion_r59288667"},"pull_request":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932"}}},"pull_request":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932","id":56078222,"html_url":"https://github.com/mapbox/mapbox-gl-js/pull/1932","diff_url":"https://github.com/mapbox/mapbox-gl-js/pull/1932.diff","patch_url":"https://github.com/mapbox/mapbox-gl-js/pull/1932.patch","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1932","number":1932,"state":"open","locked":false,"title":"Add data driven styling for circle-color","user":{"login":"lucaswoj","id":281306,"avatar_url":"https://avatars.githubusercontent.com/u/281306?v=3","gravatar_id":"","url":"https://api.github.com/users/lucaswoj","html_url":"https://github.com/lucaswoj","followers_url":"https://api.github.com/users/lucaswoj/followers","following_url":"https://api.github.com/users/lucaswoj/following{/other_user}","gists_url":"https://api.github.com/users/lucaswoj/gists{/gist_id}","starred_url":"https://api.github.com/users/lucaswoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucaswoj/subscriptions","organizations_url":"https://api.github.com/users/lucaswoj/orgs","repos_url":"https://api.github.com/users/lucaswoj/repos","events_url":"https://api.github.com/users/lucaswoj/events{/privacy}","received_events_url":"https://api.github.com/users/lucaswoj/received_events","type":"User","site_admin":false},"body":"This branch adds data-driven styling for `circle-color`.\r\n\r\n![screen shot 2016-04-06 at 11 55 07 am](https://cloud.githubusercontent.com/assets/281306/14329033/6f39e2c0-fbee-11e5-8bdd-a2bb03bc0dc4.png)\r\n\r\n```js\r\nmap.addLayer({\r\n    \"id\": \"random-points\",\r\n    \"type\": \"circle\",\r\n    \"source\": \"geojson-random-points\",\r\n    \"paint\": {\r\n        \"circle-radius\": 5,\r\n        \"circle-opacity\": 0.5,\r\n        \"circle-color\": {\r\n            stops: [[0, 'red'], [100, 'violet']],\r\n            property: 'mapbox'\r\n        }\r\n    }\r\n});\r\n\r\nmap.addLayer({\r\n    \"id\": \"random-points-outline\",\r\n    \"ref\": \"random-points\",\r\n    \"paint\": {\r\n        \"circle-radius\": 10,\r\n        \"circle-color\": {\r\n            stops: [[0, 'white'], [100, 'black']],\r\n            property: 'mapbox'\r\n        }\r\n    }\r\n}, 'random-points');\r\n```\r\n\r\n# Follow Up Tasks\r\n\r\n - merge mapbox-gl-style-spec branch\r\n - merge mapbox-gl-function branch\r\n - add data-driven styling for all paint properties (except for fill layers, blocked on #1606)\r\n - refactor `Bucket` class into smaller units\r\n - try to eke out a better score for the buffer benchmark ","created_at":"2016-01-14T19:01:15Z","updated_at":"2016-04-11T21:55:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fdf4de7ecc3fe4392ac407bfc4fec98e8f92729","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932/commits","review_comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932/comments","review_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1932/comments","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/statuses/0d7922131baa22bb79922a7e44988aab9e06297e","head":{"label":"mapbox:data-driven-styling","ref":"data-driven-styling","sha":"0d7922131baa22bb79922a7e44988aab9e06297e","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":8629417,"name":"mapbox-gl-js","full_name":"mapbox/mapbox-gl-js","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox-gl-js","description":"Render Mapbox styles in the browser using JavaScript and WebGL","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox-gl-js","forks_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/deployments","created_at":"2013-03-07T14:45:24Z","updated_at":"2016-04-11T06:26:12Z","pushed_at":"2016-04-11T21:49:23Z","git_url":"git://github.com/mapbox/mapbox-gl-js.git","ssh_url":"git@github.com:mapbox/mapbox-gl-js.git","clone_url":"https://github.com/mapbox/mapbox-gl-js.git","svn_url":"https://github.com/mapbox/mapbox-gl-js","homepage":"https://www.mapbox.com/mapbox-gl-js/","size":17210,"stargazers_count":932,"watchers_count":932,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":258,"forks":155,"open_issues":258,"watchers":932,"default_branch":"master"}},"base":{"label":"mapbox:master","ref":"master","sha":"c496a32f15b1d721ec65ca77afeea8fa3ddaeb97","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":8629417,"name":"mapbox-gl-js","full_name":"mapbox/mapbox-gl-js","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox-gl-js","description":"Render Mapbox styles in the browser using JavaScript and WebGL","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox-gl-js","forks_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/deployments","created_at":"2013-03-07T14:45:24Z","updated_at":"2016-04-11T06:26:12Z","pushed_at":"2016-04-11T21:49:23Z","git_url":"git://github.com/mapbox/mapbox-gl-js.git","ssh_url":"git@github.com:mapbox/mapbox-gl-js.git","clone_url":"https://github.com/mapbox/mapbox-gl-js.git","svn_url":"https://github.com/mapbox/mapbox-gl-js","homepage":"https://www.mapbox.com/mapbox-gl-js/","size":17210,"stargazers_count":932,"watchers_count":932,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":258,"forks":155,"open_issues":258,"watchers":932,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932"},"html":{"href":"https://github.com/mapbox/mapbox-gl-js/pull/1932"},"issue":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1932"},"comments":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1932/comments"},"review_comments":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932/comments"},"review_comment":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/pulls/1932/commits"},"statuses":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-js/statuses/0d7922131baa22bb79922a7e44988aab9e06297e"}}}}