johnwun / js4ai

Collection of Javascripts for Adobe Illustrator
http://www.wundes.com/js4ai
512 stars 164 forks source link

swapObjects.js swaps dimensions #9

Open tjt263 opened 5 years ago

tjt263 commented 5 years ago

Hey John, this is great. Well, actually.. I don't know what most of them do yet. But I'm excited about it. I found your repository while scouring Google for a way to swap objects directly, just like your swapObjects.js script. I use it all the time. Adobe ought to hire you, or pay you, or.. something.

Anyway I just noticed a problem with it. Okay, not a problem. It's great. More like.. I'd like to make a variant. See, when you swap two objects, and they have different dimensions, they don't just swap locations, they take on each others sizes/dimensions as well. Which is useful, but I'd like to have a variant where the sizes don't change. I was hoping you could help me. I have some ideas, but no experience with JavaScript.

So I thought instead of taking on new dimensions, like this:

They could just swap their centre coordinates, like this:

To do that, if it's a challenge, maybe we could use something like the Horizontal Align Center & Vertical Align Center functions:

What do you think?

One other note: It currently forces Scale Strokes & Effects, even when it's disabled in the Properties menu: