Skip to content

cy.zoomRange(min, max?)

cy.zoomRange — Core > Viewport manipulation > Pan, zoom, fit and bounds. Cytoscape.js signatures, parameters and return contract.

cy.zoomRange — Core › Viewport manipulation › Pan, zoom, fit and bounds

Preview · Core › Viewport manipulation › Pan, zoom, fit and bounds

Read in the complete API reference · All API members

// Set both zoom bounds; accepts (min, max) or { min, max }
cy.zoomRange(min: number | { min?: number; max?: number }, max?: number): this

Set both zoom bounds; accepts (min, max) or { min, max }.

Parameters
NameDescription
min: number | { min?: number; max?: number }

the minimum zoom, or an object carrying both bounds

max: number?

the maximum zoom, when min is a number

Fields of min
NameDescription
min: number?
max: number?
Returns this

this core, for chaining

Example

cy.zoomRange(0.5, 4);
console.log([cy.minZoom(), cy.maxZoom()]); // [0.5, 4]

Example graph and handle setup