mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
simplify layer.clear
This commit is contained in:
@@ -51,7 +51,6 @@
|
|||||||
*/
|
*/
|
||||||
clear: function(bounds) {
|
clear: function(bounds) {
|
||||||
this.getContext().clear(bounds);
|
this.getContext().clear(bounds);
|
||||||
this.getHitCanvas().getContext().clear(bounds);
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
clearHitCache: function() {
|
clearHitCache: function() {
|
||||||
|
@@ -47,28 +47,6 @@
|
|||||||
this.drawScene();
|
this.drawScene();
|
||||||
return this;
|
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
|
// extend Node.prototype.setVisible
|
||||||
setVisible: function(visible) {
|
setVisible: function(visible) {
|
||||||
Konva.Node.prototype.setVisible.call(this, 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
|
this.imageData = null; // Clear imageData cache
|
||||||
return this;
|
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) {
|
clear: function(bounds) {
|
||||||
this.getContext().clear(bounds);
|
Konva.BaseLayer.prototype.clear.call(this, bounds);
|
||||||
this.getHitCanvas().getContext().clear(bounds);
|
this.getHitCanvas().getContext().clear(bounds);
|
||||||
this.imageData = null; // Clear getImageData cache
|
this.imageData = null; // Clear getImageData cache
|
||||||
return this;
|
return this;
|
||||||
|
Reference in New Issue
Block a user