Skip to content

Commit

Permalink
fixes #2401 repeater calling trim twice
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymovin committed Jan 22, 2021
1 parent 6f6ae54 commit 1621a68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion player/js/elements/ShapeElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ IShapeElement.prototype = {
}

len = this.shapeModifiers.length;
var shouldBreakProcess;
for (i = len - 1; i >= 0; i -= 1) {
this.shapeModifiers[i].processShapes(this._isFirstFrame);
shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame);
// workaround to fix cases where a repeater resets the shape so the following processes get called twice
// TODO: find a better solution for this
if (shouldBreakProcess) {
break;
}
}
},
lcEnum: {
Expand Down
3 changes: 3 additions & 0 deletions player/js/utils/shapes/RepeaterModifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
var i;
var dir;
var cont;
var hasReloaded = false;
if (this._mdf || _isFirstFrame) {
var copies = Math.ceil(this.c.v);
if (this._groups.length < copies) {
Expand All @@ -109,6 +110,7 @@ RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
this._currentCopies += 1;
}
this.elem.reloadShapes();
hasReloaded = true;
}
cont = 0;
var renderFlag;
Expand Down Expand Up @@ -201,6 +203,7 @@ RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
i += dir;
}
}
return hasReloaded;
};

RepeaterModifier.prototype.addShape = function () {};
Expand Down

0 comments on commit 1621a68

Please sign in to comment.