{"action":"created","comment":{"url":"https://api.github.com/repos/pixijs/pixi.js/pulls/comments/58971434","id":58971434,"diff_hunk":"@@ -175,42 +143,17 @@ Object.defineProperties(Text.prototype, {\n         set: function (style)\n         {\n             style = style || {};\n-\n-            if (typeof style.fill === 'number') {\n-                style.fill = utils.hex2string(style.fill);\n-            }\n-\n-            if (typeof style.stroke === 'number') {\n-                style.stroke = utils.hex2string(style.stroke);\n-            }\n-\n-            if (typeof style.dropShadowColor === 'number') {\n-                style.dropShadowColor = utils.hex2string(style.dropShadowColor);\n+            if (style instanceof TextStyle)\n+            {\n+                this._style = style;\n+            } else\n+            {\n+                this._style = new TextStyle(style);\n             }\n-\n-            style.font = style.font || 'bold 20pt Arial';\n-            style.fill = style.fill || 'black';\n-            style.align = style.align || 'left';\n-            style.stroke = style.stroke || 'black'; //provide a default, see: https://github.com/pixijs/pixi.js/issues/136\n-            style.strokeThickness = style.strokeThickness || 0;\n-            style.wordWrap = style.wordWrap || false;\n-            style.wordWrapWidth = style.wordWrapWidth || 100;\n-\n-            style.dropShadow = style.dropShadow || false;\n-            style.dropShadowColor = style.dropShadowColor || '#000000';\n-            style.dropShadowAngle = style.dropShadowAngle !== undefined ? style.dropShadowAngle : Math.PI / 6;\n-            style.dropShadowDistance = style.dropShadowDistance !== undefined ? style.dropShadowDistance : 5;\n-            style.dropShadowBlur = style.dropShadowBlur !== undefined ? style.dropShadowBlur : 0; //shadowBlur is '0' by default according to HTML\n-\n-            style.padding = style.padding || 0;\n-\n-            style.textBaseline = style.textBaseline || 'alphabetic';\n-\n-            style.lineJoin = style.lineJoin || 'miter';\n-            style.miterLimit = style.miterLimit || 10;\n-\n-            this._style = style;\n-            this.dirty = true;\n+            this._styleListener = this._style.on('styleChanged', function ()\n+            {\n+                this.dirty = true;\n+            }.bind(this));","path":"src/core/text/Text.js","position":136,"original_position":136,"commit_id":"115a01508f3ad5dd9cafb820ee3bfda62403f99d","original_commit_id":"115a01508f3ad5dd9cafb820ee3bfda62403f99d","user":{"login":"englercj","id":944497,"avatar_url":"https://avatars.githubusercontent.com/u/944497?v=3","gravatar_id":"","url":"https://api.github.com/users/englercj","html_url":"https://github.com/englercj","followers_url":"https://api.github.com/users/englercj/followers","following_url":"https://api.github.com/users/englercj/following{/other_user}","gists_url":"https://api.github.com/users/englercj/gists{/gist_id}","starred_url":"https://api.github.com/users/englercj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/englercj/subscriptions","organizations_url":"https://api.github.com/users/englercj/orgs","repos_url":"https://api.github.com/users/englercj/repos","events_url":"https://api.github.com/users/englercj/events{/privacy}","received_events_url":"https://api.github.com/users/englercj/received_events","type":"User","site_admin":false},"body":"Couple things here:\r\n\r\n1. `.on()` returns the object you are binding to, not the listener function\r\n2. `.on()` can take 3 params, where the third is the context which is much faster on calls than `.bind()`\r\n\r\nI would do this instead:\r\n\r\n```js\r\nText.prototype._onStyleChange = function ()\r\n{\r\n    this.dirty = true;\r\n};\r\n\r\n// ...\r\n\r\nthis._style.on('styleChanged', this._onStyleChange, this);\r\n\r\n// ...\r\n\r\nthis._style.off('styleChanged', this._onStyleChange, this);\r\n```","created_at":"2016-04-08T01:49:49Z","updated_at":"2016-04-08T01:49:49Z","html_url":"https://github.com/pixijs/pixi.js/pull/2468#discussion_r58971434","pull_request_url":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468","_links":{"self":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/comments/58971434"},"html":{"href":"https://github.com/pixijs/pixi.js/pull/2468#discussion_r58971434"},"pull_request":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468"}}},"pull_request":{"url":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468","id":65718618,"html_url":"https://github.com/pixijs/pixi.js/pull/2468","diff_url":"https://github.com/pixijs/pixi.js/pull/2468.diff","patch_url":"https://github.com/pixijs/pixi.js/pull/2468.patch","issue_url":"https://api.github.com/repos/pixijs/pixi.js/issues/2468","number":2468,"state":"open","locked":false,"title":"TextStyle, a more flexible and fluent interface for modifying text styling","user":{"login":"AMorporkian","id":5653369,"avatar_url":"https://avatars.githubusercontent.com/u/5653369?v=3","gravatar_id":"","url":"https://api.github.com/users/AMorporkian","html_url":"https://github.com/AMorporkian","followers_url":"https://api.github.com/users/AMorporkian/followers","following_url":"https://api.github.com/users/AMorporkian/following{/other_user}","gists_url":"https://api.github.com/users/AMorporkian/gists{/gist_id}","starred_url":"https://api.github.com/users/AMorporkian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMorporkian/subscriptions","organizations_url":"https://api.github.com/users/AMorporkian/orgs","repos_url":"https://api.github.com/users/AMorporkian/repos","events_url":"https://api.github.com/users/AMorporkian/events{/privacy}","received_events_url":"https://api.github.com/users/AMorporkian/received_events","type":"User","site_admin":false},"body":"This commit introduces `PIXI.TextStyle`. The API for `PIXI.Text` is left mostly unchanged. `TextStyle` extends EventEmitter, and emits a `styleChanged` event every time it is changed. `Text` hooks onto that event and marks `Text.dirty = true`. \r\n\r\nAdditionally, `TextStyle` exposes `TextStyle.clone()`, which allows an end user to clone a previously defined text style. ","created_at":"2016-04-07T23:56:48Z","updated_at":"2016-04-08T01:49:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77b397006f7838dbd1e8ea6ceaf307d98750f4c4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468/commits","review_comments_url":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468/comments","review_comment_url":"https://api.github.com/repos/pixijs/pixi.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pixijs/pixi.js/issues/2468/comments","statuses_url":"https://api.github.com/repos/pixijs/pixi.js/statuses/115a01508f3ad5dd9cafb820ee3bfda62403f99d","head":{"label":"AMorporkian:text-style","ref":"text-style","sha":"115a01508f3ad5dd9cafb820ee3bfda62403f99d","user":{"login":"AMorporkian","id":5653369,"avatar_url":"https://avatars.githubusercontent.com/u/5653369?v=3","gravatar_id":"","url":"https://api.github.com/users/AMorporkian","html_url":"https://github.com/AMorporkian","followers_url":"https://api.github.com/users/AMorporkian/followers","following_url":"https://api.github.com/users/AMorporkian/following{/other_user}","gists_url":"https://api.github.com/users/AMorporkian/gists{/gist_id}","starred_url":"https://api.github.com/users/AMorporkian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMorporkian/subscriptions","organizations_url":"https://api.github.com/users/AMorporkian/orgs","repos_url":"https://api.github.com/users/AMorporkian/repos","events_url":"https://api.github.com/users/AMorporkian/events{/privacy}","received_events_url":"https://api.github.com/users/AMorporkian/received_events","type":"User","site_admin":false},"repo":{"id":55695645,"name":"pixi.js","full_name":"AMorporkian/pixi.js","owner":{"login":"AMorporkian","id":5653369,"avatar_url":"https://avatars.githubusercontent.com/u/5653369?v=3","gravatar_id":"","url":"https://api.github.com/users/AMorporkian","html_url":"https://github.com/AMorporkian","followers_url":"https://api.github.com/users/AMorporkian/followers","following_url":"https://api.github.com/users/AMorporkian/following{/other_user}","gists_url":"https://api.github.com/users/AMorporkian/gists{/gist_id}","starred_url":"https://api.github.com/users/AMorporkian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMorporkian/subscriptions","organizations_url":"https://api.github.com/users/AMorporkian/orgs","repos_url":"https://api.github.com/users/AMorporkian/repos","events_url":"https://api.github.com/users/AMorporkian/events{/privacy}","received_events_url":"https://api.github.com/users/AMorporkian/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AMorporkian/pixi.js","description":"Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback","fork":true,"url":"https://api.github.com/repos/AMorporkian/pixi.js","forks_url":"https://api.github.com/repos/AMorporkian/pixi.js/forks","keys_url":"https://api.github.com/repos/AMorporkian/pixi.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AMorporkian/pixi.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AMorporkian/pixi.js/teams","hooks_url":"https://api.github.com/repos/AMorporkian/pixi.js/hooks","issue_events_url":"https://api.github.com/repos/AMorporkian/pixi.js/issues/events{/number}","events_url":"https://api.github.com/repos/AMorporkian/pixi.js/events","assignees_url":"https://api.github.com/repos/AMorporkian/pixi.js/assignees{/user}","branches_url":"https://api.github.com/repos/AMorporkian/pixi.js/branches{/branch}","tags_url":"https://api.github.com/repos/AMorporkian/pixi.js/tags","blobs_url":"https://api.github.com/repos/AMorporkian/pixi.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AMorporkian/pixi.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AMorporkian/pixi.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/AMorporkian/pixi.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AMorporkian/pixi.js/statuses/{sha}","languages_url":"https://api.github.com/repos/AMorporkian/pixi.js/languages","stargazers_url":"https://api.github.com/repos/AMorporkian/pixi.js/stargazers","contributors_url":"https://api.github.com/repos/AMorporkian/pixi.js/contributors","subscribers_url":"https://api.github.com/repos/AMorporkian/pixi.js/subscribers","subscription_url":"https://api.github.com/repos/AMorporkian/pixi.js/subscription","commits_url":"https://api.github.com/repos/AMorporkian/pixi.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/AMorporkian/pixi.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/AMorporkian/pixi.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/AMorporkian/pixi.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/AMorporkian/pixi.js/contents/{+path}","compare_url":"https://api.github.com/repos/AMorporkian/pixi.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AMorporkian/pixi.js/merges","archive_url":"https://api.github.com/repos/AMorporkian/pixi.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AMorporkian/pixi.js/downloads","issues_url":"https://api.github.com/repos/AMorporkian/pixi.js/issues{/number}","pulls_url":"https://api.github.com/repos/AMorporkian/pixi.js/pulls{/number}","milestones_url":"https://api.github.com/repos/AMorporkian/pixi.js/milestones{/number}","notifications_url":"https://api.github.com/repos/AMorporkian/pixi.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AMorporkian/pixi.js/labels{/name}","releases_url":"https://api.github.com/repos/AMorporkian/pixi.js/releases{/id}","deployments_url":"https://api.github.com/repos/AMorporkian/pixi.js/deployments","created_at":"2016-04-07T13:12:22Z","updated_at":"2016-04-07T13:12:23Z","pushed_at":"2016-04-07T23:56:41Z","git_url":"git://github.com/AMorporkian/pixi.js.git","ssh_url":"git@github.com:AMorporkian/pixi.js.git","clone_url":"https://github.com/AMorporkian/pixi.js.git","svn_url":"https://github.com/AMorporkian/pixi.js","homepage":null,"size":54315,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pixijs:dev-v4.0.0","ref":"dev-v4.0.0","sha":"af9fbb43e9275ae89f4c034efe2a8609b23adf51","user":{"login":"pixijs","id":5406849,"avatar_url":"https://avatars.githubusercontent.com/u/5406849?v=3","gravatar_id":"","url":"https://api.github.com/users/pixijs","html_url":"https://github.com/pixijs","followers_url":"https://api.github.com/users/pixijs/followers","following_url":"https://api.github.com/users/pixijs/following{/other_user}","gists_url":"https://api.github.com/users/pixijs/gists{/gist_id}","starred_url":"https://api.github.com/users/pixijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixijs/subscriptions","organizations_url":"https://api.github.com/users/pixijs/orgs","repos_url":"https://api.github.com/users/pixijs/repos","events_url":"https://api.github.com/users/pixijs/events{/privacy}","received_events_url":"https://api.github.com/users/pixijs/received_events","type":"Organization","site_admin":false},"repo":{"id":7741856,"name":"pixi.js","full_name":"pixijs/pixi.js","owner":{"login":"pixijs","id":5406849,"avatar_url":"https://avatars.githubusercontent.com/u/5406849?v=3","gravatar_id":"","url":"https://api.github.com/users/pixijs","html_url":"https://github.com/pixijs","followers_url":"https://api.github.com/users/pixijs/followers","following_url":"https://api.github.com/users/pixijs/following{/other_user}","gists_url":"https://api.github.com/users/pixijs/gists{/gist_id}","starred_url":"https://api.github.com/users/pixijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixijs/subscriptions","organizations_url":"https://api.github.com/users/pixijs/orgs","repos_url":"https://api.github.com/users/pixijs/repos","events_url":"https://api.github.com/users/pixijs/events{/privacy}","received_events_url":"https://api.github.com/users/pixijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pixijs/pixi.js","description":"Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback","fork":false,"url":"https://api.github.com/repos/pixijs/pixi.js","forks_url":"https://api.github.com/repos/pixijs/pixi.js/forks","keys_url":"https://api.github.com/repos/pixijs/pixi.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pixijs/pixi.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pixijs/pixi.js/teams","hooks_url":"https://api.github.com/repos/pixijs/pixi.js/hooks","issue_events_url":"https://api.github.com/repos/pixijs/pixi.js/issues/events{/number}","events_url":"https://api.github.com/repos/pixijs/pixi.js/events","assignees_url":"https://api.github.com/repos/pixijs/pixi.js/assignees{/user}","branches_url":"https://api.github.com/repos/pixijs/pixi.js/branches{/branch}","tags_url":"https://api.github.com/repos/pixijs/pixi.js/tags","blobs_url":"https://api.github.com/repos/pixijs/pixi.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pixijs/pixi.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pixijs/pixi.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/pixijs/pixi.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pixijs/pixi.js/statuses/{sha}","languages_url":"https://api.github.com/repos/pixijs/pixi.js/languages","stargazers_url":"https://api.github.com/repos/pixijs/pixi.js/stargazers","contributors_url":"https://api.github.com/repos/pixijs/pixi.js/contributors","subscribers_url":"https://api.github.com/repos/pixijs/pixi.js/subscribers","subscription_url":"https://api.github.com/repos/pixijs/pixi.js/subscription","commits_url":"https://api.github.com/repos/pixijs/pixi.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/pixijs/pixi.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/pixijs/pixi.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/pixijs/pixi.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/pixijs/pixi.js/contents/{+path}","compare_url":"https://api.github.com/repos/pixijs/pixi.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pixijs/pixi.js/merges","archive_url":"https://api.github.com/repos/pixijs/pixi.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pixijs/pixi.js/downloads","issues_url":"https://api.github.com/repos/pixijs/pixi.js/issues{/number}","pulls_url":"https://api.github.com/repos/pixijs/pixi.js/pulls{/number}","milestones_url":"https://api.github.com/repos/pixijs/pixi.js/milestones{/number}","notifications_url":"https://api.github.com/repos/pixijs/pixi.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pixijs/pixi.js/labels{/name}","releases_url":"https://api.github.com/repos/pixijs/pixi.js/releases{/id}","deployments_url":"https://api.github.com/repos/pixijs/pixi.js/deployments","created_at":"2013-01-21T22:40:50Z","updated_at":"2016-04-07T20:11:04Z","pushed_at":"2016-04-07T23:56:50Z","git_url":"git://github.com/pixijs/pixi.js.git","ssh_url":"git@github.com:pixijs/pixi.js.git","clone_url":"https://github.com/pixijs/pixi.js.git","svn_url":"https://github.com/pixijs/pixi.js","homepage":null,"size":76092,"stargazers_count":10128,"watchers_count":10128,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1957,"mirror_url":null,"open_issues_count":234,"forks":1957,"open_issues":234,"watchers":10128,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468"},"html":{"href":"https://github.com/pixijs/pixi.js/pull/2468"},"issue":{"href":"https://api.github.com/repos/pixijs/pixi.js/issues/2468"},"comments":{"href":"https://api.github.com/repos/pixijs/pixi.js/issues/2468/comments"},"review_comments":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468/comments"},"review_comment":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pixijs/pixi.js/pulls/2468/commits"},"statuses":{"href":"https://api.github.com/repos/pixijs/pixi.js/statuses/115a01508f3ad5dd9cafb820ee3bfda62403f99d"}}}}