I expect that objects outside of layer (by coords x and y) will not show on parent layer, or canvas, but it appears - http://clip2net.com/s/5HbVnf .
According to my link "777" text belongs to red layer,
but appears on green layer, if i set it Y
coord to -25
for example.
How to resolve this issue ?
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);