【发布时间】:2013-11-19 22:23:08
【问题描述】:
我使用 Ext.daw.* 来绘制 svg 文本。根元素的大小为 200x300。 如果某些元素的大小大于根元素的大小,则除文本之外的所有内容都可以正常缩放:文本似乎具有更大的大小。
查看this demo。如何使文本正确缩放?
Ext.create('Ext.draw.Component', {
renderTo: Ext.getBody(),
width: 200,
height: 300,
items: [{
type: 'path',
path: 'M0 0 V200',
'stroke-width': 3,
stroke: 'green'
},{
type: 'path',
// if I set path to 'M200 0 V700' then text goes crazy
path: 'M200 0 V200',
'stroke-width': 3,
stroke: 'green'
},{
type: 'text',
x: 0,
y: 50,
// text is located accurately between two lines
// but when one of the lines exceeds size of the canvas
// text's size changes
text: 'wwwwwwwwwwwwwwwwwww',
font: "18px monospace"
}]
});
【问题讨论】: