Skip to content

eles.shift(dim, value?)

eles.shift — Collection > Position and dimensions. Cytoscape.js signatures, parameters and return contract.

eles.shift — Collection › Position and dimensions

Preview · Collection › Position and dimensions

Read in the complete API reference · All API members

// Offset positions by a vector or along one axis
eles.shift(dim: string | Position, value?: number): this

Offset positions by a vector or along one axis.

Parameters
NameDescription
dim: string | Position

a { x, y } delta, or 'x' / 'y' with value

value: number?

the offset, when dim names an axis

Fields of dim
NameDescription
x: number
y: number
Returns this

this collection, for chaining

Example

cy.nodes().shift({ x: 10, y: 0 });
console.log(cy.getElementById('a').position('x')); // 10

Example graph and handle setup