Hi everyone,
please find attached a new version of the change including an improved protocol for setting the alignment added by Chris (basically as discussed below). :)
Bests Patrick
Hi Chris,
thanks for the recommendations!
The only thing that gave me pause was that API for #verticalAlignment:. Initially, I just saw the selector and thought about it the same as the API for regular horizontal text alignment (e.g., #left, #center, #right, justified), and so tried: self verticalAlignment: #bottom but this informed me that this single-argument selector is actually looking for two arguments. That's some great flexibility that I didn't even consider, but I wonder whether this detracts from the usability of the common cases: #bottom, expected to do what #(#bottom #bottom) does, #center, to do what, uh, #(#middle #middle) does, and #top, would do what, #top #top does. #verticalAlignment: handle the above, while #verticalAlignmentMorph: and #verticalAlignmentLine: could be used for advanced customizations. Even once I figured out it wanted a two-element Array for input, I had to go back look at the method to remind myself which is first and which is second. Separate attributes would be more readable.
That is a good point. I myself had some difficulties remembering which way they have to go... I have added a convenience case which now allows for just sending a symbol and the method takes care of converting it to the array internally (so #top results in #(top top)).
Lastly, #middle vs. #center. #center is what we have _everywhere_ to refer to geometric centers, all over the image, including even for horizontal text-alignment. The only #middle in the whole image relates to a Collection element access. Could we use #center?
Yes, that makes sense :) I renamed #middle to #center.
The new changeset includes these changes.
Bests Patrick
["TextAnchorPlacement.cs"]
[TextAnchorPlacement.cs]
["TextAnchorPlacement.cs"]