Setting a Limit

I want to set a limit where this part can move until this surface touches this edge. How can make it possible?

 

SolidworksAssemblies