Smooth Clamping?

The title says it all, but ill go on with my story.

Im making an app, where you have a map and you can navigate around it smoothly using the touch. (its on mobile, if some of you couldn’t tell). I have boundaries on the map so where if you try going over it, it won’t let you go pass it. Thats fine but in some cases it feels unnatural. Is there such thing a smooth clamping? Let me provide an example of it. Most of you probably own an iPhone, you know how sometimes when you look at a picture, you zoom in and stuff, but when you reach the edge of the image, it will let you keep going for a bit until when you let go it smoothly brings you back within the boundaries.

Well you can try this!