basiljs / basil.js

An attempt to port the spirit of the Processing visualization language to Adobe Indesign.
http://basiljs.ch/
Other
245 stars 30 forks source link

Anchor Point / Reference Point #223

Closed trych closed 6 years ago

trych commented 6 years ago

As @ffd8 mentioned in #222, it would be great to be able to move the anchor point.

Two possibly options (quoting ffd8):

Personally, I am not sure, which option is preferable? What do the others think? @b-g @fabianmoronzirfas ?

b.transform syntax will be b.transform(myItem, "rotation", 45), so if anchor point would be part of it, it would be b.transform(myItem, "rotation", 45, b.BOTTOM_RIGHT) instead, the last argument being optional of course.

ffd8 commented 6 years ago

I vote for b.referencePoint() - since that's what inDesign refers to it as (when holding mouse over that GUI element).

Haha, sorry I even mentioned it being part of b.transform()... We should avoid adding 4th params to the b.transform() – since that keeps it from being a very straight forward adaptation of items as found in the jongware API docs of properties safely be passed into it (like how b.typo works) – one should actively set the referencePoint, then do their transformations. I think most will set the referencePoint once and leave it alone.

trych commented 6 years ago

Yes, that's a good point, else you'll have to add the 4th parameter repeatedly if you want to rotate all your rectangles around the lower right corner.

Edit: ~Also agree, that it should be named b.referencePoint() as that's the InDesign term and we have no matching functions in Processing and p5.js that we need to imitate~.

Edit 2: Ha, I stand corrected, the actual Enumerator is called AnchorPoint, while the property of the layout window is called transformReferencePoint (see the reference). In this case, I would prefer b.anchorPoint() as it is shorter and I guess the more familiar term for most students (even though the label is different). Opinions?

trych commented 6 years ago

The next question is, do we introduce 9 new constants (b.TOP_LEFT, b.TOP_CENTER, etc.) or do we use the InDesign enumerators (AnchorPoint.TOP_LEFT_ANCHOR, AnchorPoint.TOP_CENTER_ANCHOR etc.) which are super-long?

And what is the "Array of 2 units" option that is mentioned in reference? If we could describe the point with 2 units, that might be even better.

ffd8 commented 6 years ago

I vote for enumerators, and include them all in documentation of the function. This is the case with functions like textAlign(). Ugly, but unique for inDesign and maybe helps bridge that gap as one incorporates additional non-basiljs code from the API.

Re: 2 units, seems to be a special return value, so we can ignore it. Perhaps it's a row/col array for the 3x3 options..?

ffd8 commented 6 years ago

enums using AnchorPoint.____ makes a good argument for b.anchorPoints()... but a search for 'indesign anchor point', turns up the anchor point tool and whole other world (was curious if forums etc used that word for what we're talking about). Searching for 'indesign reference point' = many articles on exactly this.

trych commented 6 years ago

Ok, so we decide on b.referencePoint(AnchorPoint.TOP_LEFT_ANCHOR)?

I must say the "referencePoint … AnchorPoint" does read a bit weird though…

ff6347 commented 6 years ago

True. Sounds strange

trych commented 6 years ago

I would vote to just go for b.anchorPoint(). If we just explain in the reference what it is, then people should not get it confused with something else.

I mean we have the same thing with ellipse vs. oval and textSize vs. pointSize, yet it works. So for make a less confusing method syntax, I would go for anchorPoint.

ffd8 commented 6 years ago

Adobe did a slightly weird one here.. in Illustrator and InDesign it's called 'reference point'.. in AfterEffects it's maybe 'anchor point'? My vote is for using it the InDesign way, so people can easily find it when searching the official names (we can also throw 'anchor' into the description for finding it), then if need be, creating the 9 constants to avoid the clash of words. ie.b.referencePoint(b.TOP_LEFT_ANCHOR);

But slowly I get used to their logic.. the referencePoint is what it's going to revolve around.. the anchorPoint is an actual point to be referenced...

trych commented 6 years ago

If we create 9 constants, then we should do just b.referencePoint(b.TOP_LEFT), then we avoid the anchor confusion altogether. What are the opinions on that? I would be fine with it.

b-g commented 6 years ago

Fine with b.referencePoint(b.TOP_LEFT) :)

trych commented 6 years ago

Guys! Amazing news! We just need to create 8 new constants, as b.CENTER exists already. So efficient! ;)

trych commented 6 years ago

This has been implemented in #263. Closing.