Skip to content

ctx.positions()

ctx.positions — Extensions > Layout context > Columnar reads. Cytoscape.js signatures, parameters and return contract.

ctx.positions — Extensions › Layout context › Columnar reads

Preview · Extensions › Layout context › Columnar reads

Read in the complete API reference · All API members

// The live position column (x,y interleaved by slot) — read it, write through setPositions
ctx.positions(): Float32Array

The live position column (x,y interleaved by slot) — read it, write through setPositions.

Returns Float32Array

the store's own column, not a copy: it changes underneath a held reference as positions are written, and writing into it directly bypasses the dirty tracking the renderer depends on

Example

cy.layout({ impl: { run(ctx) {
const b = ctx.nodeSlots()[1];
console.log(ctx.positions()[b * 2]); // 50
} } }).run();

Example graph and handle setup