#cy.pan()
// Get the pan position
cy.pan(): PositionRead the current pan offset in rendered CSS pixels.
Returns
Positionthe rendered-space offset
Example
cy.pan({ x: 40, y: 20 });console.log(cy.pan()); // { x: 40, y: 20 }#cy.pan(pan)
// Set the pan position
cy.pan(pan: Position): this
// Set the pan position
cy.pan(pan: Position | undefined): Position | thisSet the pan offset. A no-op while panningEnabled() is false.
| Name | Description |
|---|---|
pan: Position | the new rendered-space offset |
Fields of pan
| Name | Description |
|---|---|
x: number | |
y: number |
Returns
thisthis core, for chaining
Example
const result = cy.pan({ x: 40, y: 20 });console.log(result === cy); // trueGet the pan offset, or set it. Setting is a no-op while panningEnabled() is false.
| Name | Description |
|---|---|
pan: Position | undefined | the new rendered-space offset; omit to read |
Fields of pan
| Name | Description |
|---|---|
x: number | |
y: number |
Returns
Position | thisthe current pan when reading, this core when setting
Example
cy.pan({ x: 40, y: 20 });console.log(cy.pan()); // { x: 40, y: 20 }