-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create newScene function first version
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* global AFRAME, THREE */ | ||
/* 3DStreet utils functions */ | ||
|
||
/* | ||
clear old scene elements and data. Create blank scene | ||
*/ | ||
function newScene() { | ||
|
||
const streetContainerEl = document.querySelector("#street-container"); | ||
const environmentEl = document.querySelector("#environment"); | ||
const referenceLayersEl = document.querySelector("#reference-layers"); | ||
|
||
// clear street-container element | ||
while (streetContainerEl.firstChild) { | ||
streetContainerEl.removeChild(streetContainerEl.lastChild); | ||
} | ||
// streetContainerEl.innerHTML = ''; | ||
// create default-street element | ||
const defaultStreet = document.createElement("a-entity"); | ||
defaultStreet.id = "default-street"; | ||
streetContainerEl.appendChild(defaultStreet); | ||
|
||
// clear environment element | ||
while (environmentEl.firstChild) { | ||
environmentEl.removeChild(environmentEl.lastChild); | ||
} | ||
// set default preset:day | ||
environmentEl.setAttribute('street-environment', 'preset', 'day'); | ||
|
||
// clear reference layers | ||
while (referenceLayersEl.firstChild) { | ||
referenceLayersEl.removeChild(referenceLayersEl.lastChild); | ||
} | ||
|
||
// clear metadata | ||
AFRAME.scenes[0].setAttribute('metadata', 'sceneId', ''); | ||
AFRAME.scenes[0].setAttribute('metadata', 'sceneTitle', ''); | ||
|
||
// clear url hash | ||
setTimeout(function () { | ||
window.location.hash = ''; | ||
}); | ||
} | ||
|
||
STREET.utils.newScene = newScene; |