mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
toDataURL() is now synchronous, and works with all nodes, including the stage, layers, groups, and shapes. This also sets things up nicely for node caching. You can now cache anything, including the whole stage, layers, groups, or shapes, manifested as Kinetic Images that were instantiated with data urls
This commit is contained in:
@@ -1468,14 +1468,7 @@ Test.prototype.tests = {
|
||||
});
|
||||
|
||||
Ellipse.on('click', function() {
|
||||
stage.toDataURL(function(dataUrl) {
|
||||
/*
|
||||
* here you can do anything you like with the data url.
|
||||
* In this tutorial we'll just open the url with the browser
|
||||
* so that you can see the result as an image
|
||||
*/
|
||||
window.open(dataUrl);
|
||||
});
|
||||
window.open(stage.toDataURL());
|
||||
});
|
||||
|
||||
layer.add(Ellipse);
|
||||
@@ -1499,14 +1492,7 @@ Test.prototype.tests = {
|
||||
});
|
||||
|
||||
Ellipse.on('click', function() {
|
||||
stage.toDataURL(function(dataUrl) {
|
||||
/*
|
||||
* here you can do anything you like with the data url.
|
||||
* In this tutorial we'll just open the url with the browser
|
||||
* so that you can see the result as an image
|
||||
*/
|
||||
window.open(dataUrl);
|
||||
}, 'image/jpeg', 0);
|
||||
window.open(stage.toDataURL('image/jpeg', 0));
|
||||
});
|
||||
|
||||
layer.add(Ellipse);
|
||||
@@ -1530,14 +1516,7 @@ Test.prototype.tests = {
|
||||
});
|
||||
|
||||
Ellipse.on('click', function() {
|
||||
stage.toDataURL(function(dataUrl) {
|
||||
/*
|
||||
* here you can do anything you like with the data url.
|
||||
* In this tutorial we'll just open the url with the browser
|
||||
* so that you can see the result as an image
|
||||
*/
|
||||
window.open(dataUrl);
|
||||
}, 'image/jpeg', 1);
|
||||
window.open(stage.toDataURL('image/jpeg', 1));
|
||||
});
|
||||
|
||||
layer.add(Ellipse);
|
||||
|
Reference in New Issue
Block a user