Skip to content

Commit

Permalink
Don't re-add existing styles to SVGShapeElement
Browse files Browse the repository at this point in the history
When calling `SVGShapeElement.reloadShapes()`, `searchShapes()` will
correctly reconciliate modified and added shapes and reuse their
elements. However, it will call `setElementStyles()`, which will add all
styles unconditionally to `this.stylesList`, even if the styles were
already in there.

Modify `setElementStyles()` to check for the existence of a particular
style before adding it.
  • Loading branch information
geomaster committed Jun 2, 2023
1 parent 5cd3e02 commit 7070122
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions player/js/elements/svgElements/SVGShapeElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ SVGShapeElement.prototype.setElementStyles = function (elementData) {
var j;
var jLen = this.stylesList.length;
for (j = 0; j < jLen; j += 1) {
if (arr.indexOf(this.stylesList[j]) !== -1) {
continue;
}

if (!this.stylesList[j].closed) {
arr.push(this.stylesList[j]);
}
Expand Down

0 comments on commit 7070122

Please sign in to comment.