レイヤーの外側のオブジェクト (座標 xおよびyによる) は、親レイヤーまたはキャンバスには表示されませんが、表示されます - http://clip2net.com/s/5HbVnf。
私のリンク「777」によると、テキストは赤いレイヤーに属していますが、たとえばY
調整すると緑のレイヤーに表示されます。-25
この問題を解決するには?
var layer = new Kinetic.Layer({
width: 300,
height: 300
});
var text_layer = new Kinetic.Layer({
x:150,
y:50,
width: 100,
height: 100
});
var red_rect = new Kinetic.Rect({
width: 100,
height: 100,
fill: 'red',
stroke: 'black',
strokeWidth: 4
});
var text = new Kinetic.Text({
x: 5,
y: -25,
text: '777',
fontSize: 30,
fontFamily: 'Calibri',
fill: 'black'
});
text_layer.add(red_rect);
text_layer.add(text);
stage.add(layer);
stage.add(text_layer);