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
- Global Config Generator
- Config
new GlobalConfigGenerator()
.zoomUpperBound(0.9)
.zoomLowerBound(0.6)
config.zoomUpperBound = 0.9
config.zoomLowerBound = 0.6
Zoom Step
- Global Config Generator
- Config
new GlobalConfigGenerator()
.zoomUpperBound(3)
.zoomLowerBound(0.2)
.zoomStep(1.3)
config.zoomUpperBound = 3
config.zoomLowerBound = 0.2
config.zoomStep = 1.3