diff --git a/src/create-object.js b/src/create-object.js index 58782e5..5f77517 100644 --- a/src/create-object.js +++ b/src/create-object.js @@ -23,8 +23,13 @@ module.exports = function createObject(options) { originY: "top", opacity: 1, bustCache: function bustCache() { + this.emit("bustedCache"); this.isCached = false; }, + bustSize: function bustSize() { + this.emit("bustedSize"); + this.recalculateSize(); + }, set: function setProperties(properties) { let transformedProperties; @@ -37,13 +42,13 @@ module.exports = function createObject(options) { Object.assign(this, transformedProperties); if (Object.keys(transformedProperties).some(property => this.sizeBustingProperties.includes(property))) { - this.emit("bustedSize"); - this.recalculateSize(); + /* If the size changes, the cache should also be implicitly busted. */ + this.bustSize(); + this.bustCache(); } if (Object.keys(transformedProperties).some(property => this.cacheBustingProperties.includes(property))) { - this.emit("bustedCache"); - this.isCached = false; + this.bustCache(); } }, render: function renderObject(context, options = {}) {