mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Merge branch 'fix-cache-hit-before-added-to-layer' of git://github.com/kzhdev/KineticJS into kzhdev-fix-cache-hit-before-added-to-layer
This commit is contained in:
commit
224790f7c9
@ -306,7 +306,7 @@
|
||||
cachedCanvas = this._cache.canvas,
|
||||
cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
|
||||
|
||||
if (this.shouldDrawHit()) {
|
||||
if (this.shouldDrawHit(canvas)) {
|
||||
if (cachedHitCanvas) {
|
||||
this._drawCachedHitCanvas(context);
|
||||
}
|
||||
|
@ -175,6 +175,8 @@
|
||||
sceneContext = cachedSceneCanvas.getContext(),
|
||||
hitContext = cachedHitCanvas.getContext();
|
||||
|
||||
cachedHitCanvas.isCache = true;
|
||||
|
||||
this.clearCache();
|
||||
|
||||
sceneContext.save();
|
||||
@ -638,9 +640,10 @@
|
||||
* @memberof Kinetic.Node.prototype
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
shouldDrawHit: function() {
|
||||
shouldDrawHit: function(canvas) {
|
||||
var layer = this.getLayer();
|
||||
return layer && layer.hitGraphEnabled() && this.isListening() && this.isVisible() && !Kinetic.isDragging();
|
||||
return ((canvas && canvas.isCache) || (layer && layer.hitGraphEnabled()))
|
||||
&& this.isListening() && this.isVisible() && !Kinetic.isDragging();
|
||||
},
|
||||
/**
|
||||
* show node
|
||||
|
@ -202,7 +202,7 @@
|
||||
cachedCanvas = this._cache.canvas,
|
||||
cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
|
||||
|
||||
if(this.shouldDrawHit()) {
|
||||
if(this.shouldDrawHit(canvas)) {
|
||||
|
||||
if (cachedHitCanvas) {
|
||||
this._drawCachedHitCanvas(context);
|
||||
|
Loading…
Reference in New Issue
Block a user