[Cuis-dev] Pretty Cool Juan!
Hilaire Fernandes
hilaire at drgeo.eu
Thu Jan 14 05:57:52 PST 2021
Le 13/01/2021 à 20:28, Juan Vuletich a écrit :
> It looks like that math could be extracted into a helper method,
> right? Something like #addLabel:centeredAt:rotationDegrees:
Here it is:
Morph>>addLabel: string font: font centeredAt: position rotationDegrees:
angle "Add a label top-centered at position and rotated of angle
degrees" | p label | p _ position - (position normal * (font
widthOfString: string asString) / 2). label _ LabelMorph contents:
string font: font. label rotation: (90 - angle) degreesToRadians.
self addMorph: label. label morphPosition: p. ^ label
--
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210114/6de0177a/attachment.htm>
More information about the Cuis-dev
mailing list