mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fixes #414
This commit is contained in:
@@ -33,9 +33,9 @@
|
|||||||
child.index = children.length;
|
child.index = children.length;
|
||||||
child.parent = this;
|
child.parent = this;
|
||||||
children.push(child);
|
children.push(child);
|
||||||
this.fire('add', {
|
this._fire('add', {
|
||||||
child: child
|
child: child
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
// chainable
|
// chainable
|
||||||
return this;
|
return this;
|
||||||
|
@@ -6,12 +6,11 @@
|
|||||||
_initLayer: function(config) {
|
_initLayer: function(config) {
|
||||||
this.nodeType = 'Layer';
|
this.nodeType = 'Layer';
|
||||||
this.createAttrs();
|
this.createAttrs();
|
||||||
// call super constructor
|
|
||||||
Kinetic.Container.call(this, config);
|
|
||||||
|
|
||||||
this.canvas = new Kinetic.SceneCanvas();
|
this.canvas = new Kinetic.SceneCanvas();
|
||||||
this.canvas.getElement().style.position = 'absolute';
|
this.canvas.getElement().style.position = 'absolute';
|
||||||
this.hitCanvas = new Kinetic.HitCanvas();
|
this.hitCanvas = new Kinetic.HitCanvas();
|
||||||
|
// call super constructor
|
||||||
|
Kinetic.Container.call(this, config);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* get visible intersection object that contains shape and pixel data. This is the preferred
|
* get visible intersection object that contains shape and pixel data. This is the preferred
|
||||||
|
@@ -29,7 +29,7 @@ Test.Modules.LAYER = {
|
|||||||
test(style.backgroundColor === 'transparent', 'canvas backgroundColor style should be transparent');
|
test(style.backgroundColor === 'transparent', 'canvas backgroundColor style should be transparent');
|
||||||
},
|
},
|
||||||
|
|
||||||
'layer getIntersections()': function(containerId) {
|
'layer getIntersection()': function(containerId) {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
container: containerId,
|
container: containerId,
|
||||||
width: 578,
|
width: 578,
|
||||||
@@ -67,6 +67,32 @@ Test.Modules.LAYER = {
|
|||||||
test(layer.getIntersection(100, 100) === null, 'shape should be null');
|
test(layer.getIntersection(100, 100) === null, 'shape should be null');
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
'set layer visibility': function(containerId) {
|
||||||
|
var stage = new Kinetic.Stage({
|
||||||
|
container: containerId,
|
||||||
|
width: 578,
|
||||||
|
height: 200
|
||||||
|
});
|
||||||
|
var layer = new Kinetic.Layer({
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
var rect = new Kinetic.Rect({
|
||||||
|
x: 200,
|
||||||
|
width: 100,
|
||||||
|
height: 50,
|
||||||
|
fill: 'green',
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 4,
|
||||||
|
scale: [3, 1],
|
||||||
|
draggable: true,
|
||||||
|
strokeScaleEnabled: false
|
||||||
|
});
|
||||||
|
|
||||||
|
rect.colorKey = '000000';
|
||||||
|
|
||||||
|
layer.add(rect);
|
||||||
|
stage.add(layer);
|
||||||
},
|
},
|
||||||
'redraw hit graph': function(containerId) {
|
'redraw hit graph': function(containerId) {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
|
Reference in New Issue
Block a user