如何使用Roassal获得垂直标签?

时间:2013-08-24 09:25:57

标签: smalltalk pharo moose-technology roassal

我找不到在Roassal可视化中获取垂直标签的方法。有办法吗?还是旋转元素的一般方法?

Vertical Labels

2 个答案:

答案 0 :(得分:2)

目前,Roassal不支持此类功能。但是你可以得到一些接近的东西。

| view |
view := ROView new.
-15 to: 10 do: [ :i |
    view add: ((ROLabel verticalText interlineSpace: i) elementOn: 'hello world').
].
ROHorizontalLineLayout on: view elements.
view open

在Roassal 1.422

答案 1 :(得分:2)

新版本Roassal2支持旋转标签。 对于上面的示例,现在您可以执行以下操作:

| view |
view := RTView new.
-15 to: 10 do: [ :i |
    view add: ((RTRotatedLabel new angleInDegree: -90) elementOn: 'hello world').
].
RTHorizontalLineLayout on: view elements.
view open

你会得到:

enter image description here

另一个例子:

| v shape |
v := RTView new.
shape := RTRotatedLabel new.
shape angleInDegree: [ :cls | cls numberOfMethods negated / 1.5 ].
shape text: [ :cls | ' ', cls name ].
shape color: (Color black alpha: 0.2).
v addAll: (shape elementsOn: Collection withAllSubclasses).

v canvas color: Color white.
v open

你将拥有:

enter image description here

我希望它有所帮助: - )