Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

add newScene call to scene loading methods #420

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/lib/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ export function inputStreetmix() {
'https://streetmix.net/kfarr/3/example-street'
);

// clrear scene data, create new blank scene.
// clearMetadata = true, clearUrlHash = false
STREET.utils.newScene(true, false);

setTimeout(function () {
window.location.hash = streetmixURL;
});

const streetContainerEl = document.getElementById('street-container');

while (streetContainerEl.firstChild) {
streetContainerEl.removeChild(streetContainerEl.lastChild);
}

streetContainerEl.innerHTML =
'<a-entity street streetmix-loader="streetmixStreetURL: ' +
streetmixURL +
'""></a-entity>';
const streetContainerEl = document.getElementById('default-street');
streetContainerEl.setAttribute(
'streetmix-loader',
'streetmixStreetURL',
streetmixURL
);

// update sceneGraph
Events.emit('entitycreated', streetContainerEl.sceneEl);
}

export function createElementsForScenesFromJSON(streetData) {
const streetContainerEl = document.getElementById('street-container');
// clrear scene data, create new blank scene.
// clearMetadata = true, clearUrlHash = true, addDefaultStreet = false
STREET.utils.newScene(true, false, false);

while (streetContainerEl.firstChild) {
streetContainerEl.removeChild(streetContainerEl.lastChild);
}
const streetContainerEl = document.getElementById('street-container');

if (!Array.isArray(streetData)) {
console.error('Invalid data format. Expected an array.');
Expand Down