Added possibily to constrain dragging by a callback function