Dragging inside a shape or curve

Hi, does anyone know how to let the user drag an object inside a shape other than a square or on a curve?

Thankz :be: