Skip to content

Commit

Permalink
simplify condition
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed Aug 30, 2024
1 parent 1f07920 commit 3e512c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,16 @@ export function create3DTiles() {
ellipsoidalHeight = parseFloat(streetGeo['ellipsoidalHeight']) || 0;
}

if (streetGeo) {
AFRAME.INSPECTOR.execute('entityupdate', {
entity: geoLayer,
component: 'street-geo',
value: {
latitude: latitude,
longitude: longitude,
ellipsoidalHeight: ellipsoidalHeight,
maps: 'google3d'
}
});
} else {
AFRAME.INSPECTOR.execute('componentadd', {
entity: geoLayer,
component: 'street-geo',
value: {
latitude: latitude,
longitude: longitude,
ellipsoidalHeight: ellipsoidalHeight,
maps: 'google3d'
}
});
}
AFRAME.INSPECTOR.execute(streetGeo ? 'entityupdate' : 'componentadd', {
entity: geoLayer,
component: 'street-geo',
value: {
latitude: latitude,
longitude: longitude,
ellipsoidalHeight: ellipsoidalHeight,
maps: 'google3d'
}
});
};

if (AFRAME.components['loader-3dtiles']) {
Expand Down
31 changes: 12 additions & 19 deletions src/editor/components/modals/GeoModal/GeoModal.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,20 @@ const GeoModal = ({ isOpen, onClose }) => {
console.log(`elevation: ${data.ellipsoidalHeight}`);

const geoLayer = document.getElementById('reference-layers');
const value = {
latitude: latitude,
longitude: longitude,
ellipsoidalHeight: data.ellipsoidalHeight,
orthometricHeight: data.orthometricHeight,
geoidHeight: data.geoidHeight
};

if (geoLayer.hasAttribute('street-geo')) {
AFRAME.INSPECTOR.execute('entityupdate', {
entity: geoLayer,
component: 'street-geo',
value
});
} else {
AFRAME.INSPECTOR.execute('componentadd', {
AFRAME.INSPECTOR.execute(
geoLayer.hasAttribute('street-geo') ? 'entityupdate' : 'componentadd',
{
entity: geoLayer,
component: 'street-geo',
value
});
}
value: {
latitude: latitude,
longitude: longitude,
ellipsoidalHeight: data.ellipsoidalHeight,
orthometricHeight: data.orthometricHeight,
geoidHeight: data.geoidHeight
}
}
);
}

setIsWorking(false);
Expand Down

0 comments on commit 3e512c4

Please sign in to comment.