New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Textbox with text wrapping and box resizing (subclasses IText) #1778
Conversation
@kangax please, could you take a look at this? This is something really wanted by a lot of users of this fantastic library. |
+1 cool i got this same feature in my app, it just doesn't support svg export. I ran into the same polymorphism issue but we didn't need it so i never attempted to fix it. You got a demo, i'd like to check it out? |
@jafferhaider Could you provide us a demo? I'm very curious :) |
Thanks for your interest guys. Link to demo added in the description above. |
Added a point in the Open Issues section about how Textbox should behave when resized as part of a group. Would like your opinion on this @kangax. |
This is a very important feature for many people! Merge! Merge! Merge! |
Wow this is amazing! Have you tried lucidpress? There is no scaling of the textboxes even in a group; the scaling remains 1 as you suggested. I highly recommend looking into their demo for reference. |
@mochidusk yup, that is a appropriate UX. I'll implement this. |
Will take a look as soon as I get a chance! Sent from my iPad
|
Congratulations, @jafferhaider. You work is just awesome! Did you guys noticed that the justified alignment is not really justified in both sides? Normally, WYSIWYG editors align the text to the edge of both sides: |
I just noticed a critical bug. If you try to resize the textbox for a very small size, that actually don't fit any word, the browser freezes (I'm running Chrome 38.0.2125.104 on a Macbook Pro 10.9.3). |
Thanks for catching that @marcospassos. I've pushed a fix. The Textbox needed to have a minimum width, since it doesn't flip like other Canvas objects. |
…a single letter. Also forced values of some scaling params and control visibility in the constructor.
I've committed my initial pass at support for resizing Textboxes in a Group selection. Feedback on the UX is welcome. I've updated the demo with the latest code. I had disabled flipping of Textboxes, but now that I had it working in Groups, I might remove the new 'minWidth' attribute in Textbox and enable flipping so it is more consistent with other Fabric objects. Basically I need to ensure Textbox works properly with the |
Fantastic work, @jafferhaider! |
👍 |
👍 merge it please) |
@asturur thanks. You know why the iText padding isn't working? See here: https://jsfiddle.net/51u08n39/143/ |
Is not working because there i uploaded a too much devel version of fabric. |
@asturur ah thanks got both the padding and canvas.toDataURL working now! I've found a new problem though, which was working fine in 1.5.0. |
Yes, of course, because the textbox cannot break words. with working code. Last version is better. |
Seems I cant give a fontFamily or fontSize to the whole textbox, only the first character. //Set Active Object Name object.set(name, value).setCoords(); //Add Controls
} |
Any chance someone knows why only the first character of my textbox is getting the font(size) if selected (See above)? |
there is a bug i noticed and i should verify it again. if you change style of textbox, an array of styles get populated. This will not allow you anymore to change general fontsize. Please try the latest version from githib, kangax builded it two days ago. then open a separate issue with a jsfiddle demonstrating the problem. |
Thanks, the newest fabricjs fixed the problem! But an old problem I had is back: var dataURL = canvas.toDataURL({ Seems the multiplier is not working... |
@asturur you have any idea why the toDateURL is not being multiplied by the multiplier in the latest version? |
not related on this post. |
Is there any news about this feature? I see the pull request is closed, but I think it's very useful. |
It has been merged and is now on main codebase. |
First of all this is great feature and awesome work. Few question regarding style and word break strategy: Any reason for these scenarios? Thanks. |
we implemented a non word breaking strategy. style should work. what
|
Is this feature available in the latest 1.6.2 version, cos it doesnt seem to work |
Changes Unknown when pulling 251d5df on PosterMyWall:TextboxPullRequest into * on kangax:master*. |
How to set fix height and width using fabric.Texbox. |
there is no fixheight. |
you need to override fabric.Textbox.prototype._initDimensions function and set the height of Textbox there
}).call(this);` and after that when you are creating the new Textbox object, you need to define the height there |
How to set Line wise text align using fabric.Textbox / Text / IText. |
you can set it up only for all textbox with the .textAlign property. |
Yes I known but I need text align line index wise. |
no. |
@asturur I tried your link below. When I try text into textbox, the textbox size changed if I type fast. I noticed your demo is using version 1.6.1. So I create one using version 1.6.5, the issue still exists. Is it a bug? version 1.5.1 http://jsfiddle.net/51u08n39/142/ |
Is it possible to set a minimum height? |
no. Not a functionality in fabric |
D: Any ideas for a workaround for dynamically adding textboxes to canvas (click and drag)? |
You need to extend the object changing some behaviour you do not like. is way better than trying to hack it with events. Please if you are starting a project, do it on the 2.0 branch, text works way better. |
you will have to oveeride init function of textbox n set the height there
On Thu, 15 Jun 2017 at 10:46 PM, William Lee ***@***.***> wrote:
D: Any ideas for a workaround for dynamically adding textboxes to canvas
(click and drag)?
Currently I'm setting the width/height of the textbox from mouse:move but
setting the height doesn't do much (since it auto-resizes height to the
default text).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1778 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABrGntIq00cfYiz0FpoVnF8y0XwcGnpjks5sEVfmgaJpZM4CyIVr>
.
--
Fahad Nawaz
|
Hi, I am hoping someone can help me here. I am clicking and then adding a new textbox that is at first empty. I have written code to automatically enter editing mode My issue is that when you press space, it wraps the text. I only want it to wrap when the user presses return or manually resizes the textbox. Is there anything I can do/start to get this behaviour? Thanks |
For Issue 187. This is a more fully featured implementation than Pull Request 725.
I need this feature for my product, so I fully intend to support this class if it is made official.
Demo
Check it out a demo.
Summary of features
this.text.split(this._reNewline)
calls into a function that gets overwritten by subclasses.Open issues / TODOs
Justify alignment needs to be fixed in IText.Inheritance bug in IText.toSVG(). ThecallSuper
in_setSVGTextLineText
goes into a recursive loop if called on a Textbox object. It works fine if I replace thecallSuper
call with a call to a copy ofText._setSVGTextLineText
. Have you encountered something like this before? Any opinions on how to fix this?Please 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.