Skip to content

Commit

Permalink
add needsItsOwnCache property (#3703)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Feb 16, 2017
1 parent eb6815a commit c9e50fe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/shapes/object.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,16 @@
*/
dirty: false,

/**
* When set to `true`, force the object to have its own cache, even if it is inside a group
* it may be needed when your object behave in a particular way on the cache and always needs
* its own isolated canvas to render correctly.
* since 1.7.5
* @type Boolean
* @default false
*/
needsItsOwnCache: false,

/**
* List of properties to consider when checking if state
* of an object is changed (fabric.Object#hasStateChanged)
Expand Down Expand Up @@ -1137,7 +1147,7 @@
ctx.transform.apply(ctx, this.transformMatrix);
}
this.clipTo && fabric.util.clipContext(this, ctx);
if (this.objectCaching && !this.group) {
if (this.objectCaching && (!this.group || this.needsItsOwnCache)) {
if (this.isCacheDirty(noTransform)) {
this.statefullCache && this.saveState({ propertySet: 'cacheProperties' });
this.drawObject(this._cacheContext, noTransform);
Expand Down

0 comments on commit c9e50fe

Please sign in to comment.