Simple demo page to show viewport.fitBounds() with and without constraints. The viewer is set up with visibilityRatio = 1 and constrainDuringPan = true to clearly demonstrate the constraints.

Pick a method to use:

viewport.fitBounds(bounds); //Ignores constraints
viewport.fitBoundsWithConstraints(bounds);
viewport.fitBoundsWithConstraints(bounds, true); //immediate
//Initially ignore constraints
viewport.fitBounds(bounds);

//Apply constraints after 1 second delay
setTimeout(() => viewport.applyConstraints(), 1000);

Click to fit overlay bounds:

overlay.getBounds(viewer.viewport):

Pick an overlay above to show the bounds