mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
made some caching fixes
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
34
src/Node.js
34
src/Node.js
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user