programmatic API to drag and resize