我正在使用 Ext-GWT 3.0 版(特别是 3.0.0-rc),并试图通过 TextSprite 旋转一些文本。它在 Google Chrome 中运行良好,但在 Internet Explorer 8 中运行良好。
Java源码:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.chart.client.draw.DrawComponent;
import com.sencha.gxt.chart.client.draw.sprite.TextSprite;
import com.sencha.gxt.widget.core.client.container.Viewport;
public class TextRotation implements EntryPoint {
public void onModuleLoad() {
TextSprite sprite = new TextSprite("Some text");
sprite.setRotation(270);
DrawComponent component = new DrawComponent();
component.setViewBox(true);
component.addSprite(sprite);
Viewport vp = new Viewport();
vp.add(component);
RootPanel.get().add(vp);
}
}
使用 IE 开发人员工具导出生成的源代码会产生以下结果。正在创建文本组件,但似乎放置在可见区域之外:
<DIV style="WIDTH: 1268px; HEIGHT: 785px" class=GAOO-TBDNN> <DIV style="WIDTH: 1268px; HEIGHT: 785px" __eventBits="100">
<DIV style="WIDTH: 1268px; HEIGHT: 785px" class=x-vml-base>
<?xml:namespace prefix = vml />
<vml:shape style="Z-INDEX: 0" class="vml x-vml-sprite" coordsize = "21600,21600" filled = "t" fillcolor = "white" stroked = "f" path = " m0,0 l27388800,0,27388800,16956000,0,16956000 xe">
<vml:skew class=vml on = "t" matrix = "935375f,0,0,935375f,0,0" offset = "34468954f,52315599f"></vml:skew>
<vml:fill></vml:fill>
</vml:shape>
<vml:shape style="Z-INDEX: 10" class="vml x-vml-sprite" coordsize = "21600,21600" filled = "t" fillcolor = "black" stroked = "f" path = " m0,0 l1,0 e">
<vml:skew class=vml on = "t" matrix = "0,935375f,-935376f,0,0,0" offset = "52315599f,-34468954f"></vml:skew>
<vml:textpath style="LINE-HEIGHT: normal; FONT-VARIANT: normal; FONT-FAMILY: ; FONT-SIZE: 12px; v-text-align: left" class=vml on = "t" string = "Some text"></vml:textpath>
<vml:path class=vml textpathok = "t"></vml:path>
<vml:fill></vml:fill>
</vml:shape>
</DIV>
</DIV>
</DIV>
<DIV style="POSITION: absolute; LINE-HEIGHT: normal; TEXT-TRANSFORM: none; FONT-STYLE: normal; FONT-FAMILY: null; LETTER-SPACING: normal; VISIBILITY: hidden; FONT-SIZE: 12px; TOP: -10000px; FONT-WEIGHT: 400; LEFT: -10000px"></DIV>
如果我然后注释掉“sprite.setRotation(270);”行 非旋转文本显示正常。生成的 HTML 与上面完全相同,除了“skew”条目的值。区别如下:
10c10
< <vml:skew class=vml on = "t" matrix = "935375f,0,0,935375f,0,0" offset = "34468954f,52315599f"></vml:skew>
---
> <vml:skew class=vml on = "t" matrix = "1510899f,0,0,1510899f,0,0" offset = "1445363f,14325573f"></vml:skew>
14c14
< <vml:skew class=vml on = "t" matrix = "0,935375f,-935376f,0,0,0" offset = "52315599f,-34468954f"></vml:skew>
---
> <vml:skew class=vml on = "t" matrix = "1510899f,0,0,1510899f,0,0" offset = "1445363f,14325573f"></vml:skew>
谷歌搜索,在 Sencha 论坛上检查过去的问题,这里没有给我任何线索。
谢谢。