mirror of
https://github.com/konvajs/konva.git
synced 2025-11-18 17:21:36 +08:00
now that the attrs engine has been rewritten, we can cleanly hide and show the layer canvas whenever the layer is hidden or shown via instantiation or with setters. Also improved layer hide and show unit test
This commit is contained in:
28
dist/kinetic-core.js
vendored
28
dist/kinetic-core.js
vendored
@@ -3656,23 +3656,14 @@ Kinetic.Layer.prototype = {
|
||||
clear: function() {
|
||||
this.getCanvas().clear();
|
||||
},
|
||||
/**
|
||||
* show layer
|
||||
* @name show
|
||||
* @methodOf Kinetic.Layer.prototype
|
||||
*/
|
||||
show: function() {
|
||||
Kinetic.Node.prototype.show.call(this);
|
||||
this.canvas.element.style.display = 'block';
|
||||
},
|
||||
/**
|
||||
* hide layer. Hidden layers are no longer detectable
|
||||
* @name hide
|
||||
* @methodOf Kinetic.Layer.prototype
|
||||
*/
|
||||
hide: function() {
|
||||
Kinetic.Node.prototype.hide.call(this);
|
||||
this.canvas.element.style.display = 'none';
|
||||
setVisible: function(visible) {
|
||||
Kinetic.Node.prototype.setVisible.call(this, visible);
|
||||
if(visible) {
|
||||
this.canvas.element.style.display = 'block';
|
||||
}
|
||||
else {
|
||||
this.canvas.element.style.display = 'none';
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Creates a composite data URL. If MIME type is not
|
||||
@@ -3715,8 +3706,7 @@ Kinetic.Layer.prototype = {
|
||||
*/
|
||||
try {
|
||||
this.getStage().content.removeChild(this.canvas.element);
|
||||
}
|
||||
catch(e) {
|
||||
} catch(e) {
|
||||
Kinetic.Global.warn('unable to remove layer scene canvas element from the document');
|
||||
}
|
||||
},
|
||||
|
||||
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user