Zoom
These methods control the zoom level and visible region of the full-screen view programmatically. They are the server-side equivalent of the zoom buttons in the Toolbar — calling them from a script has the same effect as the user clicking those buttons.
zoom()
Triggers one of the built-in zoom commands.
zoom(type: TZoomType): void;
| Value | Description |
|---|---|
"in" | Zoom in one step |
"out" | Zoom out one step |
"frame" | Fit the image to the view (zoom-to-fit) |
"actual-size" | Set zoom to 1:1 (100%) |
var ctrl = Visu.page0.display1.getController();
ctrl.zoom("frame"); // fit image to screen
ctrl.zoom("actual-size"); // 1:1 pixels
zoomToValue()
Sets the zoom level to an explicit scale factor.
zoomToValue(scale: number): void;
scale is a multiplier relative to the fit-to-screen size. A value of 1.0 is equivalent to zoom("frame"). A value of 2.0 doubles that zoom level.
ctrl.zoomToValue(2.0); // 2× fit-to-screen
zoomToRect()
Pans and zooms to fit a specific rectangle within the view.
zoomToRect(rect: Ve.Rect2d): void;
The rect is specified in image pixel coordinates. The display will zoom and pan so that the given rectangle is fully visible and centered.
// Zoom to the bounding box of a detection
var bbox = new Ve.Rect2d(100, 200, 300, 150, 0);
ctrl.zoomToRect(bbox);
All three zoom methods are fire and forget — they send a one-shot request to the client and return immediately. They do not set any persistent state on the controller: if the display is not mounted at the time of the call (e.g. the full-screen view is closed), the request is silently discarded with no effect. There is no queuing or retry.