mirror of
https://github.com/konvajs/konva.git
synced 2025-12-04 19:08:24 +08:00
added stage.reset() method so that you can reset the stage to its original state. hooked this in with stage.load() so that the stage starts when a clean slate when loading json
This commit is contained in:
@@ -42,6 +42,9 @@ Kinetic.Layer.prototype = {
|
||||
if(timeDiff >= throttle) {
|
||||
this._draw();
|
||||
this.lastDrawTime = time;
|
||||
if(this.drawTimeout !== undefined) {
|
||||
clearTimeout(this.drawTimeout);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* if we cannot draw the layer due to throttling,
|
||||
|
||||
@@ -241,6 +241,8 @@ Kinetic.Stage.prototype = {
|
||||
* @param {String} JSON string
|
||||
*/
|
||||
load: function(json) {
|
||||
this.reset();
|
||||
|
||||
function loadNode(node, obj) {
|
||||
var children = obj.children;
|
||||
if(children !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user