Skip to content

Commit

Permalink
add layers-2d node support to save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Jul 30, 2023
1 parent 6c219c6 commit c286c6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script src="./dist/aframe-street-component.js"></script>

<!-- mapbox -->
<script src="https://unpkg.com/aframe-mapbox-component/dist/aframe-mapbox-component.min.js"></script>
<script src="./src/lib/aframe-mapbox-component.min.js"></script>

<!-- save / load -->
<script src="./src/json-utils.js"></script>
Expand Down
6 changes: 4 additions & 2 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ and returns a Javascript object
function convertDOMElToObject (entity) {
const data = [];
const environmentElement = document.querySelector('#environment');
const sceneEntities = [entity, environmentElement];
const layers2DElement = document.querySelector('#layers-2d');
const sceneEntities = [entity, environmentElement, layers2DElement];

for (const entry of sceneEntities) {
const entityData = getElementData(entry);
Expand Down Expand Up @@ -83,7 +84,8 @@ function getAttributes (entity) {
}

function toPropString (propData) {
if (typeof propData === 'string' || typeof propData === 'number' || typeof propData === 'boolean') {
if (typeof propData === 'string' || typeof propData === 'number' || typeof propData === 'boolean'
|| Array.isArray(propData)) {
return (propData).toString();
}
if (propData.isVector3 || propData.isVector2 || propData.isVector4 ||
Expand Down

0 comments on commit c286c6f

Please sign in to comment.