Skip to content

ele.midpoint()

eles.midpoint — Collection > Edge points. Cytoscape.js signatures, parameters and return contract.

eles.midpoint — Collection › Edge points

Preview · Collection › Edge points

Read in the complete API reference · All API members

// Midpoint of the edge: the curve/route midpoint for curved edges , the endpoint-center average for straight ones
ele.midpoint(): Position | undefined

Midpoint of the edge: the curve/route midpoint for curved edges , the endpoint-center average for straight ones.

Returns Position | undefined

the point a mid-label and a mid-arrow anchor at, in model space; undefined for non-edges. Mid-tween it inherits the position lease's staleness, like the endpoints it derives from

Example

const point = cy.getElementById('ab').midpoint();
console.log(Number.isFinite(point.x)); // true

Example graph and handle setup