simplify layer.clear

This commit is contained in:
lavrton 2015-02-09 08:38:13 +07:00
parent c15e977009
commit da59e1581c
3 changed files with 1 additions and 42 deletions

View File

@ -51,7 +51,6 @@
*/
clear: function(bounds) {
this.getContext().clear(bounds);
this.getHitCanvas().getContext().clear(bounds);
return this;
},
clearHitCache: function() {

View File

@ -47,28 +47,6 @@
this.drawScene();
return this;
},
/**
* clear scene and hit canvas contexts tied to the layer
* @method
* @memberof Konva.FastLayer.prototype
* @param {Object} [bounds]
* @param {Number} [bounds.x]
* @param {Number} [bounds.y]
* @param {Number} [bounds.width]
* @param {Number} [bounds.height]
* @example
* layer.clear();
* layer.clear({
* x : 0,
* y : 0,
* width : 100,
* height : 100
* });
*/
clear: function(bounds) {
this.getContext().clear(bounds);
return this;
},
// extend Node.prototype.setVisible
setVisible: function(visible) {
Konva.Node.prototype.setVisible.call(this, visible);

View File

@ -180,26 +180,8 @@
this.imageData = null; // Clear imageData cache
return this;
},
/**
* clear scene and hit canvas contexts tied to the layer
* @method
* @memberof Konva.Layer.prototype
* @param {Object} [bounds]
* @param {Number} [bounds.x]
* @param {Number} [bounds.y]
* @param {Number} [bounds.width]
* @param {Number} [bounds.height]
* @example
* layer.clear();
* layer.clear({
* x : 0,
* y : 0,
* width : 100,
* height : 100
* });
*/
clear: function(bounds) {
this.getContext().clear(bounds);
Konva.BaseLayer.prototype.clear.call(this, bounds);
this.getHitCanvas().getContext().clear(bounds);
this.imageData = null; // Clear getImageData cache
return this;