Search
Search
zoomIntoView
zoomIntoView
zoomIntoView
Pans and zooms the viewport to center a single or group of nodes
await framer.zoomIntoView(nodeIds, options)
Parameters
nodeIds: string | string[]– Unique identifiers of the items to navigate to. This needs to be a node ID or array of node IDs.options?: ZoomIntoViewOptions | undefined– Options likemaxZoomandskipIfVisible.
Returns
Promise<void>– that resolves after the zoom into view request is handled.
Examples
You can automatically adjust the viewport's pan and zoom so that a node appears in the center. This is the equivalent to using Zoom to Selection in the UI, except you can use any list of Nodes.
// Scroll and zoom the viewport to show a specific node. await framer.zoomIntoView("node-id") // Scroll and zoom to fit multiple nodes into the viewport. await framer.zoomIntoView(["node-id-1", "node-id-2"])
See Also
node.zoomIntoView(options)– zoom a specific canvas node into view