Copy link to clipboard
Copied
Ensure the key object is always the first element in “sel”.
Other objects should always be positioned to the right.
I intend to set sel[j].geometricBounds so that the keyObject remains stationary while the others are arranged to its right.
The code below doesn't seem to be working.
var sel = app.documents[0].selection;
var key = app.selectionKeyObject;
var sb = key.visibleBounds;
sel.sort(function (a, b) {
var a = key.visibleBounds;
var b = b.visibleBounds;
if (a[1] > b[1]) {
return 1;
} else if (a[1] < b[1]) {
return -1;
}
});
Copy link to clipboard
Copied
It turns out you need to use move.
The ideal approach, of course, is to keep keyobj stationary while aligning the elements before and after it.
This seems difficult.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now