Clamp cesium map In columbus view

Hey ,
My app was using 2D map in the past , but due to a bug in trackedEntity , I switch to 2.5D
locking the camera’s tilt and rotation.
In order to prevent the camera of showing the canvas background when panning , I used this function that I found on the forum , and it works great in 2D , but no longer works in 2.5D.

scene.preRender.addEventListener(()=>{
var projection = viewer.scene.mapProjection;
var maxCoord = projection.project(new Cesium.Cartographic(Math.PI,Cesium.Math.PI_OVER_TWO);
var camera = viewer.scene.camera;
var frusum = camera.frustum._offCenterFrustum;   //only camera.frustum in 2D 

var minX = -maxCoord.x - frustum.left;
var maxX = maxCoord.x - frustum.right;
camera.position.x = Cesium.Math.clamp(camera.position.x,minX,maxX);

var minY = -maxCoord.y - frustum.bottom;
var maxY = maxCoord.y - frustum.top;
camera.position.y = Cesium.Math.clamp(camera.position.y,minY,maxY);

})

The reason is that 2.5D is using PerspectiveFrustum while 2D mode is using OrthographicFrustum.
I have tried to switch my frustum to OrthographicFrustum but it caused different kind of bugs
(pick and drill pick will not work in 2.5D mode with OrthographicFrustum).

does anyone know how can I alter my function so it will work for PerspectiveFrustum ?