Skip to main content
Inspiring
January 15, 2023
Question

Is it possible to move a selection using absolute coordinates in a script?

  • January 15, 2023
  • 2 replies
  • 306 views

Using the script listener, I have only found ways to make relative ▲x,▲y moves.
Is there a way to move a selected object to an absolute x,y on a canvas?

Thanks,

This topic has been closed for replies.

2 replies

Legend
January 15, 2023

Agree with @Stephen Marsh. In scripts, such restrictions are not a problem. It is enough to get X,Y of any one point of the selection or object (top, bottom, right, left, center) and find the difference in X, Y between where this point should be after moving. These are relative move values that can be passed to the move function.

Stephen Marsh
Community Expert
Community Expert
January 15, 2023

Good question! Even the DOM uses relative values for transform or selection.translate() etc.

 

If you know the target X,Y position, then you can obviously calculate the relative difference for the transform.