#cy.zoom()
// Get the zoom level
cy.zoom(): numberRead the current zoom level.
numberthe current zoom level as a number
#cy.zoom(level)
// Set the zoom level
cy.zoom(level: number): thisSet the zoom level, clamped to zoomRange(). Does nothing when zoomingEnabled() is false. A changed viewport emits a zoom event and a viewport event.
| Name | Description |
|---|---|
level: number | the new zoom level |
thisthis core, for chaining
#cy.zoom(options)
// Zoom about a position
cy.zoom(options: ZoomOptions): thisZoom about a fixed model or rendered position. Does nothing when zoomingEnabled() is false. A changed viewport emits a zoom event and a viewport event.
| Name | Description |
|---|---|
options: ZoomOptions | the level and the position to keep fixed |
Fields of options
thisthis core, for chaining
Example
cy.zoom({ level: 2, renderedPosition: { x: 0, y: 0 } });console.log(cy.zoom()); // 2