Need to clamp camera to edges of parallaxed layers

I’ve been a coder for 20 years and have about 2 years of Java under my belt, but I am new to libgdx, and I am making a new side-scrolling game which will feature parallaxed backgrounds and the ability to zoom in and out, so I stole some code from the parallax demo and added to the OrthoCamController class the ability to zoom in and out.

I have clamped the movement to the ends of the game world by not allowing the camera to move beyond 0+half viewport width and game world width-half viewport width. Which works great for the front layer, but then as I parallax the background layers get moved over by more and then if you zoom out you can see past the ends of the background layers.

What’s a good way to get the OrthoCamController to check where each layer is, and clamp movement so that you can’t zoom or move any more in that direction if it would cause you to see past the end of a layer?

Thanks!

I don’t understand what you mean by parallax the layers. Maybe if an example is shown it could shed some light on the issue.