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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "mywebui",
4
- "version": "1.42.3",
4
+ "version": "1.42.8",
5
5
  "titleLang": {
6
6
  "en": "mywebui",
7
7
  "de": "mywebui",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.mywebui",
3
- "version": "1.42.8",
3
+ "version": "1.42.10",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413 with 3D Editor",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -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
- const obj = intersection.object;
328
- if (obj.userData.assetData) {
329
- this.selectObject(obj);
330
- return;
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
- // Try parent objects
333
- let parent = obj.parent;
334
- while (parent && parent !== this.scene) {
335
- if (parent.userData.assetData) {
336
- this.selectObject(parent);
337
- return;
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
- parent = parent.parent;
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 material
362
+ // Restore original materials
351
363
  this.selectedObject.traverse((child) => {
352
- if (child.material && child.userData.originalMaterial) {
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 yellow highlight)
371
+ // Select new (add subtle highlight)
359
372
  this.selectedObject = obj;
360
373
  obj.userData.selected = true;
361
374
 
362
- // Apply subtle highlight (outline glow, not full color change)
375
+ // Apply very subtle highlight - only emissive, preserve all other properties
363
376
  obj.traverse((child) => {
364
- if (child.isMesh && child.material) {
365
- child.userData.originalMaterial = child.material;
366
- // Clone original material and add slight emission
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.setHex(0xffff00);
369
- hlMat.emissiveIntensity = 0.15; // Subtle glow
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;">No assets loaded</div>';
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="padding:8px;background:#242424;margin-bottom:5px;border-radius:3px;cursor:pointer;border:1px solid #333;">
849
- <div style="color:#0f0;font-weight:bold;">${asset.name}</div>
850
- <div style="color:#888;font-size:11px;margin-top:3px;">
851
- Type: ${asset.type}<br>
852
- Pos: (${asset.position.x.toFixed(1)}, ${asset.position.y.toFixed(1)}, ${asset.position.z.toFixed(1)})
853
- </div>
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