<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 13/01/2021 à 20:28, Juan Vuletich a
écrit :<br>
</div>
<blockquote type="cite" cite="mid:5FFF49E0.3050503@jvuletich.org">It
looks like that math could be extracted into a helper method,
right? Something like #addLabel:centeredAt:rotationDegrees:<br>
</blockquote>
<p>Here it is:</p>
<pre><font color="#a11818">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
</font></pre>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</body>
</html>