Skip to content

ctx.boundingBox()

ctx.boundingBox — Extensions > Layout context > Bounds. Cytoscape.js signatures, parameters and return contract.

ctx.boundingBox — Extensions › Layout context › Bounds

Preview · Extensions › Layout context › Bounds

Read in the complete API reference · All API members

// The scope's current bounding box, labels included
ctx.boundingBox(): ReturnType<Collection['boundingBox']>

The scope's current bounding box, labels included.

Returns ReturnType<Collection['boundingBox']>

{ x1, y1, x2, y2, w, h } in model coordinates

Example

cy.layout({ impl: { run(ctx) {
console.log(ctx.boundingBox().w); // 130
} } }).run();

Example graph and handle setup