iobroker.mywebui 1.42.8 → 1.42.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/io-package.json
CHANGED
package/package.json
CHANGED
|
@@ -323,22 +323,34 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
323
323
|
this.raycaster.setFromCamera(this.mouse, this.camera);
|
|
324
324
|
const intersects = this.raycaster.intersectObjects(this.scene.children, true);
|
|
325
325
|
|
|
326
|
+
// Find the closest asset root (not just first match)
|
|
327
|
+
let closestAsset = null;
|
|
328
|
+
let closestDistance = Infinity;
|
|
329
|
+
|
|
326
330
|
for (const intersection of intersects) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
let obj = intersection.object;
|
|
332
|
+
|
|
333
|
+
// Skip grid, axes, lights
|
|
334
|
+
if (obj.userData.isGrid || obj.userData.isAxes || obj.userData.lightId) {
|
|
335
|
+
continue;
|
|
331
336
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
while (
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
|
|
338
|
+
// Find root asset containing this mesh
|
|
339
|
+
while (obj && obj !== this.scene) {
|
|
340
|
+
if (obj.userData.assetData) {
|
|
341
|
+
if (intersection.distance < closestDistance) {
|
|
342
|
+
closestAsset = obj;
|
|
343
|
+
closestDistance = intersection.distance;
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
338
346
|
}
|
|
339
|
-
|
|
347
|
+
obj = obj.parent;
|
|
340
348
|
}
|
|
341
349
|
}
|
|
350
|
+
|
|
351
|
+
if (closestAsset) {
|
|
352
|
+
this.selectObject(closestAsset);
|
|
353
|
+
}
|
|
342
354
|
}
|
|
343
355
|
|
|
344
356
|
selectObject(obj) {
|
|
@@ -347,26 +359,33 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
347
359
|
// Deselect previous (remove highlight)
|
|
348
360
|
if (this.selectedObject) {
|
|
349
361
|
this.selectedObject.userData.selected = false;
|
|
350
|
-
// Restore original
|
|
362
|
+
// Restore original materials
|
|
351
363
|
this.selectedObject.traverse((child) => {
|
|
352
|
-
if (child.
|
|
364
|
+
if (child.isMesh && child.userData.originalMaterial) {
|
|
353
365
|
child.material = child.userData.originalMaterial;
|
|
366
|
+
delete child.userData.originalMaterial;
|
|
354
367
|
}
|
|
355
368
|
});
|
|
356
369
|
}
|
|
357
370
|
|
|
358
|
-
// Select new (add
|
|
371
|
+
// Select new (add subtle highlight)
|
|
359
372
|
this.selectedObject = obj;
|
|
360
373
|
obj.userData.selected = true;
|
|
361
374
|
|
|
362
|
-
// Apply subtle highlight
|
|
375
|
+
// Apply very subtle highlight - only emissive, preserve all other properties
|
|
363
376
|
obj.traverse((child) => {
|
|
364
|
-
if (child.isMesh && child.material) {
|
|
365
|
-
|
|
366
|
-
|
|
377
|
+
if (child.isMesh && child.material && !Array.isArray(child.material)) {
|
|
378
|
+
// Store original if not already stored
|
|
379
|
+
if (!child.userData.originalMaterial) {
|
|
380
|
+
child.userData.originalMaterial = child.material;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Clone and apply subtle glow
|
|
367
384
|
const hlMat = child.material.clone();
|
|
368
|
-
hlMat.emissive
|
|
369
|
-
|
|
385
|
+
if (hlMat.emissive) {
|
|
386
|
+
hlMat.emissive.setHex(0xffff00);
|
|
387
|
+
hlMat.emissiveIntensity = 0.1; // Even more subtle
|
|
388
|
+
}
|
|
370
389
|
child.material = hlMat;
|
|
371
390
|
}
|
|
372
391
|
});
|
|
@@ -838,22 +857,34 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
838
857
|
const assetsListContent = this._getDomElement('assetsListContent');
|
|
839
858
|
|
|
840
859
|
if (!this.sceneData.assets || this.sceneData.assets.length === 0) {
|
|
841
|
-
assetsListContent.innerHTML = '<div style="color:#888;"
|
|
860
|
+
assetsListContent.innerHTML = '<div style="color:#888;padding:20px;text-align:center;font-size:12px;">📦 No assets<br><br>Click "+ Model" to add</div>';
|
|
842
861
|
return;
|
|
843
862
|
}
|
|
844
863
|
|
|
845
|
-
let html = '';
|
|
864
|
+
let html = '<div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;">';
|
|
846
865
|
for (const asset of this.sceneData.assets) {
|
|
847
866
|
html += `
|
|
848
|
-
<div style="
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
867
|
+
<div style="
|
|
868
|
+
padding:12px;
|
|
869
|
+
background:linear-gradient(135deg, #2a2a2a 0%, #242424 100%);
|
|
870
|
+
border:1px solid #333;
|
|
871
|
+
border-radius:6px;
|
|
872
|
+
cursor:pointer;
|
|
873
|
+
display:flex;
|
|
874
|
+
flex-direction:column;
|
|
875
|
+
align-items:center;
|
|
876
|
+
text-align:center;
|
|
877
|
+
font-size:11px;
|
|
878
|
+
"
|
|
879
|
+
onmouseover="this.style.borderColor='#0f0'"
|
|
880
|
+
onmouseout="this.style.borderColor='#333'">
|
|
881
|
+
<div style="font-size:28px;margin-bottom:6px;">📦</div>
|
|
882
|
+
<div style="color:#0f0;font-weight:bold;margin-bottom:3px;word-break:break-word;max-width:100%;">${asset.name.substring(0, 25)}</div>
|
|
883
|
+
<div style="color:#888;font-size:10px;">${asset.type}</div>
|
|
854
884
|
</div>
|
|
855
885
|
`;
|
|
856
886
|
}
|
|
887
|
+
html += '</div>';
|
|
857
888
|
assetsListContent.innerHTML = html;
|
|
858
889
|
}
|
|
859
890
|
|