mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fixed stage.hide() bug, created new isVisible() method, and moved visible check to container
This commit is contained in:
@@ -109,10 +109,11 @@ Kinetic.Container.prototype = {
|
||||
* draw children
|
||||
*/
|
||||
_drawChildren: function() {
|
||||
var stage = this.getStage();
|
||||
var children = this.children;
|
||||
for(var n = 0; n < children.length; n++) {
|
||||
var child = children[n];
|
||||
if(child.nodeType === 'Shape') {
|
||||
if(child.nodeType === 'Shape' && child.isVisible() && stage.isVisible()) {
|
||||
child._draw(child.getLayer());
|
||||
}
|
||||
else {
|
||||
|
@@ -174,6 +174,12 @@ Kinetic.Node.prototype = {
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* determine if shape is visible or not
|
||||
*/
|
||||
isVisible: function() {
|
||||
return this.attrs.visible;
|
||||
},
|
||||
/**
|
||||
* show node
|
||||
*/
|
||||
|
@@ -175,7 +175,7 @@ Kinetic.Shape.prototype = {
|
||||
* @param {Layer} layer Layer that the shape will be drawn on
|
||||
*/
|
||||
_draw: function(layer) {
|
||||
if(this.attrs.visible && this.drawFunc !== undefined) {
|
||||
if(layer !== undefined && this.drawFunc !== undefined) {
|
||||
var stage = layer.getStage();
|
||||
var context = layer.getContext();
|
||||
var family = [];
|
||||
|
Reference in New Issue
Block a user