Ensure _localMatMdf
is reset to false
#3040
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With efeb109, support for transform effects has been added, which required introducing another matrix on
TransformElement
to represent the final transform matrix including the effects. This matrix is denoted aslocalMat
If there are no transform effects,
localMat
is the same (referentially) as the existing transform matrix (mat
). Otherwise, it's calculated by composing the transform effects and then composing that with the "old" transform matrix.Alongside
localMat
, a_localMatMdf
member is introduced, which tracks whether the local matrix was modified since its last commit to the DOM, analogously to_matMdf
.Unfortunately, a logic bug introduced by efeb109 meant that, in the absence of transform effects,
_localMatMdf
was latched totrue
, i.e. no code path would ever be able to reset it tofalse
after it was once set totrue
(e.g. as a result of the matrix being animated).This causes a serious performance regression, since all matrices that once had
_matMdf
set totrue
will keep being updated in the DOM every frame, causing costly full style recalculations.Fix by forcing
_matMdf
and_localMatMdf
to be equivalent in the case of no transform effects, just asmat
andlocalMat
are referentially equal. In the case of >0 transform effects, the custom logic inrenderLocalTransform()
will take over and compute_localMatMdf
separately from and based on_matMdf
.Affected versions:
lottie-web@5.12.0
to latest