Skip to content

Commit

Permalink
remove street-parent element if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Jan 8, 2024
1 parent 938e55f commit 056a53d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ AFRAME.registerComponent('street', {
}

const streetmixSegments = JSON.parse(data.JSON);

// remove .street-parent element, if it exists, with old scene elements.
// Because it will be created next in the processSegments function
const streetParent = this.el.querySelector('.street-parent');
if (streetParent) {
streetParent.remove();
}

const streetEl = streetmixParsers.processSegments(streetmixSegments.streetmixSegmentsFeet, data.showStriping, data.length, data.globalAnimated, data.showVehicles);
this.el.append(streetEl);

Expand Down

0 comments on commit 056a53d

Please sign in to comment.