patrickmarabeas / ng-FitText.js

An AngularJS directive for inflating web type.
http://patrickmarabeas.github.io/ng-FitText.js
MIT License
222 stars 61 forks source link

Resizing of dynamic text - does not work when data changes constantly #52

Open nehaverma8 opened 8 years ago

nehaverma8 commented 8 years ago

I have a widget that can be resized to any size. I have several lines of text inside it that need to scale when the widget resizes. One of the text changes constantly ( like stock price)

The issue I see is that when the stock price value is updated (every 5 sec or so) , the text does not resize and appears out of the container.

eg.

`` kjhkj

{{name}}

        <div>
            <h1 data-fittext data-fittext-min="5" data-fittext-max="inherit" data-ng-model="price+' '+attr1">{{price}} {{attr1}}</h1>
        </div>

`

patrickmarabeas commented 8 years ago

I have tested an interval creating a random number and it works as expected. May be an issue with the font itself. If you highlight the fonts characters do some of the characters overflow the highlight? eg:

screen shot 2016-05-26 at 11 58 28 am

If so, you'll have to play around with the compressor value: data-fittext=".9" for instance, or use a font that has proper bounds.

danielcha commented 8 years ago

I have the same issue. Resizing the screen resizes te text perfectly, however when the text is changed dynamically it's not being updated

Edit: I hacked it using this trick https://github.com/patrickmarabeas/ng-FitText.js/issues/46#issuecomment-213311002

patrickmarabeas commented 8 years ago

Nice one. I'll follow up on this as soon as I can.

patrickmarabeas commented 8 years ago

@danielcha any chance you can make a codepen demonstrating the issue?