KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Text align to right have strange issue

Open ChoodyNorris opened this issue 13 years ago • 2 comments

Hi!

I'm glad to use Kinetic ;) it's work perfectly. And i don't have any issue since now. I just wondering why text with align right always have little bug. The last line of multi lane text always is little moved to right. It's look something like that:

"text text text blah blah bl text blah text"

When we expected:

"text text text blach blah bl text blah text"

Here is sample code:

           var circle = new Kinetic.Circle({
        x: 0,
        y: 0,
        radius: radius,
        fill: col
    });
            var text = new Kinetic.Text({
        x: 0,
        y: 0,
        text: tex,
        fontSize: fontSize,
        fontFamily: 'Oxygen',
        fill: 'white',
        width: radius*2-3,
        padding: 5,
                    wrap: 'word',
        align: 'right'
    });

            var group = new Kinetic.Group({
              x: xx,
              y: yy,
             scale: 0,
             id: idd
        });

           group.add(circle);
           group.add(text);

ChoodyNorris avatar Oct 04 '13 06:10 ChoodyNorris

finally i know why this bug is happen. It's cause that wraping didn't erase white space. And if i ann simply space to end my string text will display normally. I think this is easy to rapair ;)

ChoodyNorris avatar Oct 08 '13 06:10 ChoodyNorris

Glad you could figure it out!

ippo615 avatar Oct 11 '13 03:10 ippo615