mercredi 16 septembre 2015

Cytoscape.js: style doesn't apply

I am using Cytoscape.js in Ember app. I have created a component for graph. I try to set graph stylesheet in the didInsertElement function of the component like this:

        this.get("cy").style()
            .selector('node')
              .css({
                'width': '100px',
                'height': '100px',
                'border-color': 'gray',
                'border-width': 3,
                'border-opacity': 0.5
              })
            // unimportant code here
            .selector('.faded')
              .css({
                'opacity': 0.0,
                'text-opacity': 0
            }).update();

When I access route with this component in Ember, the style isn't applied (however layout and other things are working properly). When I transit to another route and than back, style magically appears.

What am I doing wrong? How to apply the style on "first load"?




Aucun commentaire:

Enregistrer un commentaire