toDataURL fixes

This commit is contained in:
Anton Lavrenov
2018-07-18 14:56:46 +07:00
parent ef9cf8154d
commit 39e022e786
5 changed files with 28 additions and 4 deletions

View File

@@ -8,7 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## Fixed
* Some `Konva.Transformer` fixes
* Typescript fixes
* `stage.toDataURL()` fixes when it has hidden layers
## [2.1.7][2018-07-03]

View File

@@ -2,7 +2,7 @@
* Konva JavaScript Framework v2.1.7
* http://konvajs.github.io/
* Licensed under the MIT
* Date: Thu Jul 12 2018
* Date: Wed Jul 18 2018
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@@ -10369,6 +10369,9 @@
}
layers.each(function(layer) {
if (!layer.isVisible()) {
return;
}
var width = layer.getCanvas().getWidth();
var height = layer.getCanvas().getHeight();
var ratio = layer.getCanvas().getPixelRatio();

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -252,6 +252,9 @@
}
layers.each(function(layer) {
if (!layer.isVisible()) {
return;
}
var width = layer.getCanvas().getWidth();
var height = layer.getCanvas().getHeight();
var ratio = layer.getCanvas().getPixelRatio();

View File

@@ -1060,6 +1060,23 @@ suite('Stage', function() {
assert.equal(stage.toDataURL(), layer.toDataURL());
});
test('toDataURL with hidden layer', function() {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
fill: 'red',
radius: 50
});
layer.add(circle);
stage.add(layer);
var stageDataUrl = stage.toDataURL();
layer.visible(false);
assert.equal(stage.toDataURL() === stageDataUrl, false);
});
test('toCanvas with large size', function() {
var stage = addStage();
var layer = new Konva.Layer();