Working with camera.setDeadzone

I have a case where I’d like the camera to follow the player on the Y axis, but only if they go above a certain point. The setDeadzone function works well for this, but the problem is that the camera does not return to its original view once the player falls into the deadzone again.

I have this example: Phaser Camera Follow Test - JSFiddle - Code Playground

If the player stays in the yellow rectangle, the camera will only follow them on the X axis. That’s what I want. The ground stays at the bottom of the screen, everything is nice.

If you go up the stairs and beyond the top of the yellow box, the camera will start to follow. Also good. However, if you drop off the stairs and back to the ground, the camera is no longer lined up correctly. You can’t see the ground and can only see the upper half of the player. How can I get the camera to reset when the player returns to the yellow box?

I’ll just answer my own question. My solution was to gradually update the cameras.scrollY setting in the update function. I had it smoothly return the camera to its original state once the player returned to dead zone.