mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
fixed multiple bugs related to toDataURL() when using hidden layers
This commit is contained in:
12
src/Layer.js
12
src/Layer.js
@@ -240,8 +240,18 @@ Kinetic.Layer.prototype = {
|
||||
var mimeType = config && config.mimeType ? config.mimeType : null;
|
||||
var quality = config && config.quality ? config.quality : null;
|
||||
|
||||
if(config && config.width && config.height) {
|
||||
/*
|
||||
* if layer is hidden, return blank canvas
|
||||
* else if width and height are defined, create blank canvas and draw onto it
|
||||
* else return canvas as is
|
||||
*/
|
||||
if(!this.isVisible()) {
|
||||
var stage = this.getStage();
|
||||
canvas = new Kinetic.Canvas(stage.getWidth(), stage.getHeight());
|
||||
}
|
||||
else if(config && config.width && config.height) {
|
||||
canvas = new Kinetic.Canvas(config.width, config.height);
|
||||
this.draw(canvas);
|
||||
}
|
||||
else {
|
||||
canvas = this.getCanvas();
|
||||
|
||||
Reference in New Issue
Block a user