EffEPi / fabric.curvedText

Allows you to create curved text - extension to fabric.js
41 stars 41 forks source link

Spacing and Radius Issue : Needs as per the canvas size. #32

Open ashishbhattb opened 8 years ago

ashishbhattb commented 8 years ago

I needs your help urgently !!!

As i am working on fabric js text feature stuck at some level

Below is the text curve made by someone http://jsfiddle.net/EffEPi/qpJTz/

I needs to make same feature but some issue in terms of spacing.

Can i manage to space and radius accordingly the canvas area while adding text ? for example if i put text it should take a curve according to the canvas area and then i can change manually.

As now its like just fix the area if small or big canvas its take a fixed curve and fixed spacing so if user puts big text its creating circle with very bad shape and all

EffEPi commented 8 years ago

I am not sure I understand your needs, can you upload some images to what is happening now and what you would like to happen ?

akkivaghasiya5 commented 8 years ago

I'm not sure that what are you exactly want to say. But if you are saying that curved text should cover full canvas by automatic adjusting spacing and radius, then it's upto to you that you must have to calculate spacing in such way that it covers full canvas (everytime when text is getting updated). For example, if there are 4 characters in text, you must set approx (PI*Radius)/2.

EffEPi commented 8 years ago

Let's see if I understood correctly:

you want a fixed WIDTH and as you type the spacing will fill to make the text appear as a 360 circle.. correct ?

ashishbhattb commented 8 years ago

Hmmm,

Let's say i have text with 15 letters then its text display properly in arc or curved but if i have a text of 65 letters then its making a circle but with overlapping the text and the text is also not readable,

What i want is if user has 5 letters "Janki" then also make circle or arc proper if user has 23 letters "Mr's Janki ramprasad sharma" arc or curved should be fit into screen

if reduce/increase the font size according to text its OK

As its very difficult to mange with the space and radius it should take automatically as per the text length

I hope will get idea how i want, because i want to remove the settings spacing and radius, i want it should work with the code only while scaling or updating the text

akkivaghasiya5 commented 8 years ago

Ok. In that case, you should post your question in stackoverflow. Because what you are telling is not any bug or suggestion for this extension. You are asking for help. But still, I think this may help you. You should restrict the length of string. Limit of character will be depend on fontSize, fontFamily, radius, fontStyle. Just find new spacing value on updating text value. As your string length will be increased, your spacing value will be decreased. Finally stop updating when spacing reaches to 0 or some negative value. Still you want to add more character, then you need to decrease fontSize. Hope this may help you.

ashishbhattb commented 8 years ago

Yes, I am not saying its bug but this is how application should work. Currently we are giving dependency to client side. If client write more letters its not understand by application what happen, and user needs to manage space and radius as per requirement. So my suggestion is to make fully manage by the system and not depends on what user is providing the text or any limits. I am new bee to fabric js if some one can help appreciated.

ashishbhattb commented 8 years ago

May be at least for default text added by user then if user wants to manipulate then they should have control to it. But here my only concern is for adding fresh new text to canvas after that user can manipulate with the control