created an option to provide a callback to check if a resize/drag is valid or not