Skip to main content

Zoom Limit and Step

tip

You can retrieve the zoom factor and set onZoom actions using the following:

Please note that this is different from other context retrieval methods to allow multiple viewports.

e.g., you can get SnackbarContext with scene.snackbarCtx

// suppose you have a setZoomFactor function to
// set your local variable
const round = (input) => input.toFixed(2)
setZoomFactor(scene.getViewportCtx().scale)
scene.getViewportCtx().setOnZoom((n, prev) => {
setZoomStep(round(Math.abs(n - prev)))
setZoomFactor(round(n))
})

Zoom-in/out limit

new GlobalConfigGenerator()
.zoomUpperBound(0.9)
.zoomLowerBound(0.6)

Zoom Step

new GlobalConfigGenerator()
.zoomUpperBound(3)
.zoomLowerBound(0.2)
.zoomStep(1.3)