tristaanogre
7 years agoEsteemed Contributor
I actually have our drag method added to a script extension. The code looks like this:
function dragCalculatedDistance(startObject, destinationObject) {
var startPoint, targetPoint, dragX, dragY;
// Drag from the center of object A to the center of object B
startPoint = startObject.WindowToScreen(startObject.Width/2, startObject.Height/2);
targetPoint = destinationObject.WindowToScreen(destinationObject.Width/2, destinationObject.Height/2);
dragX = targetPoint.X - startPoint.X;
dragY = targetPoint.Y - startPoint.Y;
startObject.Drag(-1, -1, dragX, dragY);
}
I wrap that in a script extension and then the method is available for any project. Give this a try.