{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/1778","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778/events","html_url":"https://github.com/kangax/fabric.js/pull/1778","id":46615971,"number":1778,"title":"A Textbox with text wrapping and box resizing (subclasses IText)","user":{"login":"jafferhaider","id":793773,"avatar_url":"https://avatars.githubusercontent.com/u/793773?v=3","gravatar_id":"","url":"https://api.github.com/users/jafferhaider","html_url":"https://github.com/jafferhaider","followers_url":"https://api.github.com/users/jafferhaider/followers","following_url":"https://api.github.com/users/jafferhaider/following{/other_user}","gists_url":"https://api.github.com/users/jafferhaider/gists{/gist_id}","starred_url":"https://api.github.com/users/jafferhaider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jafferhaider/subscriptions","organizations_url":"https://api.github.com/users/jafferhaider/orgs","repos_url":"https://api.github.com/users/jafferhaider/repos","events_url":"https://api.github.com/users/jafferhaider/events{/privacy}","received_events_url":"https://api.github.com/users/jafferhaider/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":79,"created_at":"2014-10-23T11:49:42Z","updated_at":"2015-03-23T09:53:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kangax/fabric.js/pulls/1778","html_url":"https://github.com/kangax/fabric.js/pull/1778","diff_url":"https://github.com/kangax/fabric.js/pull/1778.diff","patch_url":"https://github.com/kangax/fabric.js/pull/1778.patch"},"body":"For [Issue 187](https://github.com/kangax/fabric.js/issues/187). This is a more fully featured implementation than [Pull Request 725](https://github.com/kangax/fabric.js/pull/725). \r\n\r\nI need this feature for my product, so I fully intend to support this class if it is made official.\r\n\r\n### Demo\r\nCheck it out [a demo](http://jsfiddle.net/jafferhaider/51u08n39/18/).\r\n\r\n### Summary of features\r\n- Subclasses IText, so gets all of its goodness.\r\n- Text wraps as user types and/or resizes a Textbox. Works with all textAlign values.\r\n- User can change width of Textbox. Height is automatically set based on text wrapping. Font size and scale does not change.\r\n- Support for resizing in Groups. Only the width of a Textbox changes. The Textbox updates its scaleX/Y values to undo scale values of its parent Group so that font size remains the same.\r\n- Refactored the ton of `this.text.split(this._reNewline)` calls into a function that gets overwritten by subclasses.\r\n- Fixed bug in Justify text (was present in both Text and IText classes).\r\n- Caches text wrapping info for fast performance.\r\n- Tested on latest versions of Safari (OSX & iOS), Chrome (OSX & Win), Firefox and Internet Explorer.\r\n\r\n### Open issues / TODOs\r\n~~1. Inheritance bug in IText.toSVG(). The `callSuper` in `_setSVGTextLineText` goes into a recursive loop if called on a Textbox object. It works fine if I replace the `callSuper` call with a call to a copy of `Text._setSVGTextLineText`. Have you encountered something like this before? Any opinions on how to fix this?~~\r\n\r\nPlease list changes that you'd like me to make before this can be made official. I saw in the other pull request that @kangax wasn't too sure about the 'Textbox' name ... we can change it."},"comment":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/comments/84919533","html_url":"https://github.com/kangax/fabric.js/pull/1778#issuecomment-84919533","issue_url":"https://api.github.com/repos/kangax/fabric.js/issues/1778","id":84919533,"user":{"login":"yinxiangbo","id":8381637,"avatar_url":"https://avatars.githubusercontent.com/u/8381637?v=3","gravatar_id":"","url":"https://api.github.com/users/yinxiangbo","html_url":"https://github.com/yinxiangbo","followers_url":"https://api.github.com/users/yinxiangbo/followers","following_url":"https://api.github.com/users/yinxiangbo/following{/other_user}","gists_url":"https://api.github.com/users/yinxiangbo/gists{/gist_id}","starred_url":"https://api.github.com/users/yinxiangbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinxiangbo/subscriptions","organizations_url":"https://api.github.com/users/yinxiangbo/orgs","repos_url":"https://api.github.com/users/yinxiangbo/repos","events_url":"https://api.github.com/users/yinxiangbo/events{/privacy}","received_events_url":"https://api.github.com/users/yinxiangbo/received_events","type":"User","site_admin":false},"created_at":"2015-03-23T09:53:02Z","updated_at":"2015-03-23T09:53:02Z","body":"when resizing the textbox which has some styles, the text is wrapped,but the styles have some problem.\r\ndemo:http://jsfiddle.net/loveve/axvt0btu/11/ "}}