#ele.renderedPosition()
// Get the position
ele.renderedPosition(): Position | undefinedRead the first element's position in rendered CSS pixels, after applying the graph's zoom and pan.
Position | undefinedthe first element's position, or undefined when empty
Example
cy.zoom(1); cy.pan({ x: 0, y: 0 });console.log(cy.getElementById('a').renderedPosition()); // { x: 0, y: 0 }#ele.renderedPosition(dim)
// Get one coordinate
ele.renderedPosition(dim: string): number | undefinedRead one coordinate of the first element.
| Name | Description |
|---|---|
dim: string | the coordinate, 'x' or 'y' |
number | undefinedthe first element's coordinate, or undefined when empty
Example
cy.zoom(1); cy.pan({ x: 0, y: 0 });console.log(cy.getElementById('a').renderedPosition('x')); // 0#eles.renderedPosition(position)
// Set the position
eles.renderedPosition(position: Position): thisSet the position on every unlocked node.
| Name | Description |
|---|---|
position: Position | the coordinates to write |
Fields of position
| Name | Description |
|---|---|
x: number | |
y: number |
thisthis collection, for chaining
Example
const result = eles.renderedPosition({ x: 20, y: 10 });console.log(result === eles); // true#eles.renderedPosition(dim, value)
// Set one coordinate
eles.renderedPosition(dim: string, value: number): thisSet one coordinate on every unlocked node.
| Name | Description |
|---|---|
dim: string | the coordinate, 'x' or 'y' |
value: number | the coordinate to write |
thisthis collection, for chaining
Example
const result = eles.renderedPosition('x', 20);console.log(result === eles); // trueAlso spelled eles.renderedPoint.