Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node.data('width') and node.data('height') are not changing upon node resize #4

Closed
metincansiper opened this issue Aug 17, 2016 · 2 comments
Assignees

Comments

@metincansiper
Copy link
Collaborator

I think that when a node is resized with this extension node.css('width') and node.css('height') are changing but node.data('width') and node.data('height') are not changing. I think that users may expect that upon node resize both css and data are changing.
As an example in the following node resize extension 'https://github.com/jhonatandarosa/cytoscape.js-noderesize' data changes upon node resize and then css changes as parallel to data with the following code segments:

                    // This code segement defines the style that resized nodes will have
                    cy.style().selector('.noderesize-resized').css({
                        'width': 'data(width)',
                        'height': 'data(height)',
                    });

                    // This is called when node is resized
                    node.addClass('noderesize-resized');

How about having such a structure?

@metincansiper metincansiper changed the title Not changing node.data('width') and node.data('height') upon node resize node.data('width') and node.data('height') are not changing upon node resize Aug 17, 2016
@selimfirat
Copy link

Are we able to access width through node.data("width) on native cytoscape.js? If not I don't agree because whenever data changes, it will update style and trigger node-resize events. This may cause performance loss which is currently not perfect.
I think following code to be added to chise.js would be better to fix incompatibility:
cy.on("resizeend", function(e, type, nodes){ nodes.each(function(i, ele){ ele.data("width", ele.width()); ele.data("height", ele.height()); }); })

@metincansiper
Copy link
Collaborator Author

I supposed that "width" is a special data in Cytoscape.js but after this disscussion I checked it and see that it is not. I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants