fixes problems with isTargetTransparent trageting. also nulls out cachedCanvas when not being used to make it easier to check if a proper cachedCanvas exists (#4356)

This commit is contained in:
Stefan Hayden 2017-09-28 22:28:08 -04:00 committed by Andrea Bogazzi
parent cc7c36fa7d
commit 0bb8a131a6
2 changed files with 5 additions and 3 deletions

View file

@ -483,9 +483,10 @@
var ctx = this.contextCache,
originalColor = target.selectionBackgroundColor;
target.hasBorders = target.transparentCorners = false;
target.selectionBackgroundColor = '';
this.clearContext(ctx);
ctx.save();
ctx.transform.apply(ctx, this.viewportTransform);
target.render(ctx);
@ -494,6 +495,8 @@
target === this._activeObject && target._renderControls(ctx, {
hasBorders: false,
transparentCorners: false
}, {
hasBorders: false,
});
target.selectionBackgroundColor = originalColor;
@ -501,8 +504,6 @@
var isTransparent = fabric.util.isTransparent(
ctx, x, y, this.targetFindTolerance);
this.clearContext(ctx);
return isTransparent;
},

View file

@ -986,6 +986,7 @@
this.drawCacheOnCanvas(ctx);
}
else {
this._cacheCanvas = null;
this.dirty = false;
this.drawObject(ctx);
if (this.objectCaching && this.statefullCache) {