Skip to main content

Home > @jsplumbtoolkit/browser-ui > Surface > zoomToFit

Surface.zoomToFit() method#

Zooms the display so that all the tracked elements fit inside the viewport. This method will also, by default, increase the zoom if necessary - meaning the default behaviour is to adjust the zoom so that the content fills the viewport. You can suppress zoom increase by setting doNotZoomIfVisible:true on the parameters to this method.

Signature:

zoomToFit(params?: {        doNotAnimate?: boolean;        onComplete?: (p: PointXY) => any;        onStep?: () => any;        padding?: number;        fill?: number;        doNotZoomIfVisible?: boolean;    }): void;

Parameters#

ParameterTypeDescription
params{ doNotAnimate?: boolean; onComplete?: (p: PointXY) => any; onStep?: () => any; padding?: number; fill?: number; doNotZoomIfVisible?: boolean; }

Returns:

void