Hi,
I'm trying to understand the code behind the figure here to rotate
labels:
So, I made a minimal example to start with, here (code is at
http://ws.stfx.eu/N6ZG4BAIBO00 )
Now I would like to rotate the text to made it look like the first
image. I presume that the code that made this possible for the first
case is this one:
====================
RTBundleBuilder>>createLabelFor: e view: aView
| lbl |
lbl := label elementOn: e model.
self interaction setUpElement: lbl.
aView add: lbl.
e addCallback: (TRTranslationCallback new block: [
| angle |
angle := (e position - center ) theta.
lbl translateTo: e position+((lbl trachelShape
notRotatedWidth/2) * (angle cos @ angle sin)).
angle := angle radiansToDegrees.
angle := angle + ((angle between: 90 and: 270) ifTrue: [
180 ] ifFalse: [ 0 ]).
lbl trachelShape angleInDegree: angle ] ).
e translateTo: e position.
====================
but I can not quite understand the lines
lbl translateTo: e position+((lbl trachelShape notRotatedWidth/2) *
(angle cos @ angle sin)).
and
angle := angle + ((angle between: 90 and: 270) ifTrue: [ 180 ]
ifFalse: [ 0 ]).
Could some body explain me how to incorporate rotation to the first
basic example at http://ws.stfx.eu/N6ZG4BAIBO00 (second image of
this mail).
Thanks,
Offray