Giter VIP home page Giter VIP logo

Comments (6)

d2fong avatar d2fong commented on May 20, 2024 1

@kinimesi

It doesn't matter that much to me now because I am using layoutBy, but it seems strange to fire this event before updating the positions, because to me the meaning of afterexpand means the event is fired after the whole expand operation is finished. i.e the node is restored and it's children are restored and properly positioned.

I'd say maybe you could document your meaning of afterexpand and the context in which it is called. e.g this event is fired after the node children are restored, but before their positions are updated. Or if you don't want people to use afterexpand, maybe just remove it from the documentation.

from cytoscape.js-expand-collapse.

kinimesi avatar kinimesi commented on May 20, 2024

@d2fong Can you give more details on what you are trying to do and how will swapping those lines help you achieve it?

from cytoscape.js-expand-collapse.

ugurdogrusoz avatar ugurdogrusoz commented on May 20, 2024

@kinimesi what do you think?

from cytoscape.js-expand-collapse.

kinimesi avatar kinimesi commented on May 20, 2024

@ugurdogrusoz Because someone run into a problem with the order of fired events, it does not mean that the order is wrong. afterexpand event is fired just after the node is expanded. The positioning of nodes is a post process, which is done after node is expanded. So firing afterexpand event, after doing the positioning is wrong and meaningless.

from cytoscape.js-expand-collapse.

d2fong avatar d2fong commented on May 20, 2024

@kinimesi

First of all. I said in my response that you don't have to change it. All I am saying is that your documentation is misleading.

Take a look at your documentation for the layoutby option and the afterexpand event:

Here is the documentation for layoutby:

      layoutBy: null, // to rearrange after expand/collapse. It's just layout options or whole layout function. Choose your side!

Key phrase here is rearrange after expand/collapse.

Here is the documentation for afterexpand:

cy.nodes().on("expandcollapse.afterexpand", function(event) { var node = this; ... }) Triggered after a node is expanded

Key phrase here is Triggered after node is expanded.

This could imply to people that these two things do something similar when in reality they will not. Because one happens before the nodes are repositioned and the other happens after.

Now you will say that after expand is not the same as after a node is expanded. But that then implies that the user has to know that there exists a post processing step.

But again, if I search for any terms such as post process, reposition, or position. Nothing comes up in the documentation.

What I am trying to get at this is that you probably know the codebase for this extension really well. I bet most users do not. So I hope you can understand now why someone might get confused when you assume that users have to know specific implementation details that have not been documented at all to use this extension properly.

from cytoscape.js-expand-collapse.

ugurdogrusoz avatar ugurdogrusoz commented on May 20, 2024

@d2fong we moved the location of the trigger. we also made a note as follows in the documentation (unstable branch):

Notice that following events are performed for each node that is collapsed/expanded. Also, notice that any post-processing layout is performed after the event.

Please let us know if this is more reasonable now.

from cytoscape.js-expand-collapse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.