我已更新至4.4。我正在初始化一个像这样的Text对象:
var droppableText = new Kinetic.Text({
x : posX,
y : posY,
name : field,
stroke : '#555',
strokeWidth : 2,
fill : '#ddd',
text : text,
fontSize : fontSize,
fontFamily : 'Calibri',
textFill : '#555',
width : width,
height : height,
padding : padding,
align : 'center',
fontStyle : 'italic',
shadow : {
color : 'black',
blur : 10,
offset : [10, 10],
opacity : 0.2
},
cornerRadius : 10
});
似乎可以使X,Y和文本位置正确,但没有像以前那样的背景或边框。这在我使用4.0版之前有效,我刚刚更新到4.4,现在它不起作用。想法?
答案 0 :(得分:0)
是的,自版本4.3.0以来,边框矩形已经消失
https://github.com/ericdrowell/KineticJS/wiki/Change-Log
Big changes to Kinetic.Text shape.
Rectangle component has been removed to simplify the API. textFill is now fill, textStroke is now stroke, textStrokeWidth is now strokeWidth, and textShadow is now shadow.
If you want to have a rectangle behind the text, you need to group the text with a Kinetic.Rect shape. Text fontSize units are now in pixels (used to be in points). The lineHeight attr is now defaulted to 1 (used to be defaulted to 1.2).
cornerRadius attr moved to rect shape