Skip to content

Commit

Permalink
return the code needed to change the parameters of the street component
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Apr 29, 2024
1 parent 6f78e84 commit 8da4d82
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ AFRAME.registerComponent('street', {
return;
}

// remove .street-parent and .buildings-parent elements, if they exists, with old scene elements.
// Because they will be created next in the processSegments and processBuildings functions.
// this is also necessary when changing the parameters of the street component to reload the scene const streetParent = this.el.querySelector('.street-parent');
const streetParent = this.el.querySelector('.street-parent');
if (streetParent) {
streetParent.remove();
}
const buildingParent = this.el.querySelector('.buildings-parent');
if (buildingParent) {
buildingParent.remove();
}

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

const streetEl = streetmixParsers.processSegments(streetmixSegments.streetmixSegmentsMetric, data.showStriping, data.length, data.globalAnimated, data.showVehicles);
Expand Down

0 comments on commit 8da4d82

Please sign in to comment.