Camera following cursor within borders

Hello,
I’m struggling to create such camera movement so the camera accelerates to the cursor if it is crossing set borders on the screen (about 1/5 for horizontal and 1/3 and 1/4 for vertical).
However the trick is that if player character crosses the opposite border, the camera should stop moving and stay within the distance of border screen location blocking one of the movement axis. I tried to achieve that by interpolating object that is a camera towards player character and managed to properly move it this way, but in the situation where player character is during movement and some axis of camera movement are blocked, the camera will try to reach cursor then interpolate towards the player character so it won’t cross the border creating unwanted camera stutter as the camera moves in example left<->right repeteadly. I tried to set some safety so that if the axis “block” is on the camera should not accelerate towards the cursor but that didn’t work as the issue occurs sequentially, there is always a point in time where camera reached permitted area of the screen, next thing that happens is acceleration towards cursor and sequence starts again creating camera stutter.

What I want to achieve is similar to moba-type camera with semi-locked mode, allowing you to look around the character having maximum look-out distance like in Heroes of the Storm.