2013-04-01 29 views
0

我已更新至4.4。我初始化一個文本對象是這樣的:填充,邊界對kineticjs不起作用鉻上的文本對象

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

沒錯,邊界矩形已經從版本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 
不見了