Skip to content

ctx.eles

ctx.eles — Extensions > Layout context > Scope. Cytoscape.js signatures, parameters and return contract.

ctx.eles — Extensions › Layout context › Scope

Preview · Extensions › Layout context › Scope

Read in the complete API reference · All API members

// The elements included in this layout
ctx.eles: Collection

The elements included in this layout. For eles.layout(), this is the supplied collection; for cy.layout(), it is the whole graph. The collection is created on first access and cached for this run.

Returns Collection

the collection of elements being laid out

Example

// Inside a custom layout, ctx is supplied by the library.
cy.layout({ impl: { run(ctx) {
console.log(ctx.eles.map(ele => ele.id())); // ["a","b","c","ab","bc"]
} } }).run();

Example graph and handle setup