Skip to content

Commit

Permalink
streetmix-loader set metadata sceneTitle if none
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Sep 10, 2023
1 parent 2f64e9f commit da6870b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ AFRAME.registerComponent('streetmix-loader', {
const streetmixSegments = streetmixResponseObject.data.street.segments;
const streetmixName = streetmixResponseObject.name;
el.setAttribute('streetmix-loader', 'name', streetmixName);

let currentSceneTitle = AFRAME.scenes[0].getAttribute('metadata', 'sceneTitle');
if (!currentSceneTitle) { // only set title from streetmix if none exists
AFRAME.scenes[0].setAttribute('metadata', 'sceneTitle', streetmixName);
}

if (data.showBuildings) {
el.setAttribute('street', 'right', streetmixResponseObject.data.street.rightBuildingVariant);
el.setAttribute('street', 'left', streetmixResponseObject.data.street.leftBuildingVariant);
Expand Down

0 comments on commit da6870b

Please sign in to comment.