<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 1/13/2021 3:59 PM, Hilaire Fernandes via Cuis-dev wrote:
<blockquote cite="mid:30378378-4d76-132f-3f00-371eb8926c3a@drgeo.eu"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<p><font size="+1">Work pretty well adding submorphs. Only
requires little vector calculus to coop with the rotation
center:</font></p>
<pre><font size="+1"><font color="#a11818">ProtractorMorph>>initialize
| label p1 font |
super initialize .
font _ FontFamily familyName: FontFamily defaultFamilyName pointSize: 4.
10 to: 170 by: 10 do: [:angle |
p1 _ Point r: 88 degrees: angle negated.
p1 _ p1 - (p1 normal * (font widthOfString: angle asString) / 2).
label _ LabelMorph contents: angle asString font: font.
label rotation: (90 - angle) degreesToRadians.
self addMorph: label.
label morphPosition: p1]</font>
</font></pre>
<p><font size="+1">All the the necessary knowledge do construct
such morph is in The Cuis Book.</font></p>
<p><font size="+1">What is interesting is how the width of the
lines can be float number, here 1.0 ; 0.5 ; 0.6<br>
</font></p>
<p><img moz-do-not-send="false"
src="cid:part1.06000607.00060506@jvuletich.org" alt=""
height="297" width="429"></p>
<br>
<div class="moz-cite-prefix">Le 13/01/2021 à 16:17, Juan Vuletich
via Cuis-dev a écrit :<br>
</div>
<blockquote type="cite" cite="mid:5FFF0F07.5000203@jvuletich.org">One
way to do it is to add a submorph for each label, rotating it as
needed.<br>
</blockquote>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</blockquote>
<br>
Very nice!<br>
<br>
It looks like that math could be extracted into a helper method,
right? Something like #addLabel:centeredAt:rotationDegrees:<br>
<br>
Thanks,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>