Skip to content

Hide edges on viewport animation #2477

Description

Issue type

Feature request

Description of new feature

Setting hideEdgesOnViewport to true in the initialization options can give a performance improvement in very large graphs when the user pans and zooms. However, when the viewport is animated with cy.animate(), the edges remain visible.

Animating the viewport of very large graphs may be more performant if edges are hidden during the animation.

Motivation for new feature

I have a large graph (~1k nodes and ~6k edges). Visualizing it is quite performant, but animating it isn't at all.

It's possible to do a workaround: you can, before animating, update the style to set edges to visibility: hidden and then back to visibility: visible in cy.animate()'s callback. However, performance here is unpredictable -- some animations just jump, others are quite smooth.

I'm not familiar with this project's codebase, but if someone can confirm that this should give a perf boost in theory, then the change should be as simple as changing this line to check if the graph is animated:

var vpManip = (r.pinching || r.hoverData.dragging || r.swipePanning || r.data.wheelZooming || r.hoverData.draggingEles);
var hideEdges = r.hideEdgesOnViewport && vpManip;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions