[squeak-dev] Proposal: Morphs in Text

patrick.rein at hpi.uni-potsdam.de patrick.rein at hpi.uni-potsdam.de
Thu Jun 27 16:31:15 UTC 2019


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"]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextAnchorPlacement.cs
Type: application/octet-stream
Size: 74685 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190627/4a546b16/attachment-0001.obj>


More information about the Squeak-dev mailing list