Famous / engine

MIT License
1.75k stars 250 forks source link

[bug?] Node (Render size mode) onSizeChange only triggered when the content is bigger. #476

Open elinfante opened 9 years ago

elinfante commented 9 years ago

Hello,

I have a visualisation that moves words across the screen so I need to know the width of each word. To achieve that I use the component onSizeChange. Each word is set with render size mode. The first time I set the content It triggers the event for every word. It does work really well, the problem comes when the words get to the left of the screen then I need to change the content of each word. Only when the new content is bigger the onSizeChange component gets triggered therefore some words stay on the left and they get not triggered.

Is that a known issue? could you advise on what could I do to get the width every time please?

Thanks!

You can see a live version of the issue here:

http://www.buzzradar.com/test/juan/onsizechange/

(this = node)
function _addSizeComponent() {

    this.BZNO_FA_COMPONENT_SIZECHANGE.onSizeChange = function() {
        this.width = this.dom.getRenderSize()[0];
        this.height = this.dom.getRenderSize()[1];
        _setInitialPosition.call(this);
    }.bind(this);

    this.addComponent(this. BZNO_FA_COMPONENT_SIZECHANGE);

}

and this is how I set the new content of the word:

P04_WordCtrl_NODE.prototype.startWord = function (word_feed) {

    this.dom.setContent(word_feed);

};
elinfante commented 8 years ago

Has the merged being succesful? I can see there was an error: https://travis-ci.org/Famous/engine/builds/79443728

Thanks for looking after this issue Alex.

alexanderGugel commented 8 years ago

We're running our tests via smokestack and Fx. Seems like WebGL isn't supported on the CI server.