made some caching fixes

This commit is contained in:
Anton Lavrenov
2018-04-18 14:25:39 +07:00
parent e415e266ab
commit f1e7bf0e8e
7 changed files with 165 additions and 43 deletions

View File

@@ -401,7 +401,7 @@
cachedCanvas = this._cache.canvas,
cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;
if (this.isVisible()) {
if (this.isVisible() || caching) {
if (!caching && cachedSceneCanvas) {
context.save();
layer._applyTransform(this, context, top);
@@ -420,7 +420,7 @@
cachedCanvas = this._cache.canvas,
cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
if (this.shouldDrawHit(canvas)) {
if (this.shouldDrawHit(canvas) || caching) {
if (layer) {
layer.clearHitCache();
}

View File

@@ -763,24 +763,24 @@
}
},
/**
* determine if node is visible by taking into account ancestors.
*
* Parent | Self | isVisible
* visible | visible |
* ----------+-----------+------------
* T | T | T
* T | F | F
* F | T | T
* F | F | F
* ----------+-----------+------------
* T | I | T
* F | I | F
* I | I | T
* determine if node is visible by taking into account ancestors.
*
* Parent | Self | isVisible
* visible | visible |
* ----------+-----------+------------
* T | T | T
* T | F | F
* F | T | T
* F | F | F
* ----------+-----------+------------
* T | I | T
* F | I | F
* I | I | T
* @method
* @memberof Konva.Node.prototype
* @returns {Boolean}
*/
* @method
* @memberof Konva.Node.prototype
* @returns {Boolean}
*/
isVisible: function() {
return this._getCache(VISIBLE, this._isVisible);
},

View File

@@ -308,7 +308,7 @@
bufferCanvas,
bufferContext;
if (!this.isVisible()) {
if (!this.isVisible() && !caching) {
return this;
}
if (cachedCanvas) {
@@ -427,7 +427,7 @@
cachedCanvas = this._cache.canvas,
cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
if (!this.shouldDrawHit(canvas)) {
if (!this.shouldDrawHit(canvas) && !caching) {
return this;
}
if (layer) {