Commit 7585c8cc authored by Cantuerk's avatar Cantuerk
Browse files

Update public/index.html

parent ef06bc91
Showing with 40 additions and 30 deletions
+40 -30
...@@ -160,38 +160,15 @@ ...@@ -160,38 +160,15 @@
} }
#dynamic-menu { #dynamic-menu {
display: flex; position: absolute;
flex-direction: column; bottom: 70px;
align-items: center;
justify-content: center;
gap: 20px;
padding: 20px;
background: #f5f5f5;
box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
width: 100%; width: 100%;
} height: 200px;
background: rgba(0, 0, 0, 0.8);
#dynamic-menu label {
font-size: 16px;
color: #333;
}
#dynamic-menu input[type="range"] {
width: 80%;
}
#dynamic-menu button {
padding: 10px 20px;
font-size: 16px;
color: white; color: white;
background-color: #007bff; padding: 20px;
border: none; z-index: 20;
border-radius: 5px; overflow-y: auto;
cursor: pointer;
}
#dynamic-menu button:hover {
background-color: #0056b3;
} }
</style> </style>
<script src="https://unpkg.com/three@0.126.0/build/three.js"></script> <script src="https://unpkg.com/three@0.126.0/build/three.js"></script>
...@@ -323,6 +300,18 @@ ...@@ -323,6 +300,18 @@
menus.forEach(id => { menus.forEach(id => {
document.getElementById(id).style.display = id === menuId ? 'flex' : 'none'; document.getElementById(id).style.display = id === menuId ? 'flex' : 'none';
}); });
if (menuId === 'menu-bar') clearSelectedModel();
}
function clearSelectedModel() {
if (selectedPlacedModel) {
selectedPlacedModel.traverse((child) => {
if (child.isMesh) {
child.material.emissive.setHex(0x000000); // Markierung entfernen
}
});
selectedPlacedModel = null; // Kein Modell mehr ausgewählt
}
} }
function selectModel(modelId) { function selectModel(modelId) {
...@@ -374,6 +363,17 @@ ...@@ -374,6 +363,17 @@
}); });
} }
function removeHighlightFromSelectedModel() {
if (selectedPlacedModel) {
selectedPlacedModel.traverse((child) => {
if (child.isMesh) {
child.material.emissive.setHex(0x000000); // Markierung entfernen
}
});
selectedPlacedModel = null; // Kein Modell mehr ausgewählt
}
}
function selectModelFromScene(event) { function selectModelFromScene(event) {
const mouse = new THREE.Vector2( const mouse = new THREE.Vector2(
(event.clientX / window.innerWidth) * 2 - 1, (event.clientX / window.innerWidth) * 2 - 1,
...@@ -387,6 +387,9 @@ ...@@ -387,6 +387,9 @@
if (intersects.length > 0) { if (intersects.length > 0) {
selectedPlacedModel = intersects[0].object; selectedPlacedModel = intersects[0].object;
highlightSelectedModel(); highlightSelectedModel();
showInfoDialog("Modell erfolgreich ausgewählt.");
} else {
showInfoDialog("Kein Modell unter dem Cursor gefunden.");
} }
} }
...@@ -409,6 +412,7 @@ ...@@ -409,6 +412,7 @@
if (selectedPlacedModel) { if (selectedPlacedModel) {
const radians = (value / 180) * Math.PI; const radians = (value / 180) * Math.PI;
selectedPlacedModel.rotation[axis] = radians; selectedPlacedModel.rotation[axis] = radians;
closeDynamicMenu();
} }
} }
...@@ -431,6 +435,7 @@ ...@@ -431,6 +435,7 @@
if (selectedPlacedModel) { if (selectedPlacedModel) {
const scale = parseFloat(value); const scale = parseFloat(value);
selectedPlacedModel.scale.set(scale, scale, scale); selectedPlacedModel.scale.set(scale, scale, scale);
closeDynamicMenu();
} }
} }
...@@ -441,6 +446,11 @@ ...@@ -441,6 +446,11 @@
} }
} }
function closeDynamicMenu() {
const dynamicMenu = document.getElementById("dynamic-menu");
dynamicMenu.style.display = "none";
}
function showInfoDialog(message) { function showInfoDialog(message) {
const infoDialog = document.getElementById("info-dialog"); const infoDialog = document.getElementById("info-dialog");
const infoText = document.getElementById("info-text"); const infoText = document.getElementById("info-text");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment