mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
simplify layer.clear
This commit is contained in:
parent
c15e977009
commit
da59e1581c
@ -51,7 +51,6 @@
|
||||
*/
|
||||
clear: function(bounds) {
|
||||
this.getContext().clear(bounds);
|
||||
this.getHitCanvas().getContext().clear(bounds);
|
||||
return this;
|
||||
},
|
||||
clearHitCache: function() {
|
||||
|
@ -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);
|
||||
|
20
src/Layer.js
20
src/Layer.js
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user