iobroker.mywebui 1.42.3 → 1.42.5
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
|
@@ -219,16 +219,20 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
219
219
|
updateSceneView() {
|
|
220
220
|
if (!this.sceneData) return;
|
|
221
221
|
|
|
222
|
-
// Add assets to scene
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
// Add assets to scene (safe iteration)
|
|
223
|
+
if (Array.isArray(this.sceneData.assets)) {
|
|
224
|
+
for (const asset of this.sceneData.assets) {
|
|
225
|
+
if (asset.type === 'model' && asset.glbPath) {
|
|
226
|
+
this.loadAsset(asset);
|
|
227
|
+
}
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
|
|
229
|
-
// Update lights
|
|
230
|
-
|
|
231
|
-
this.
|
|
231
|
+
// Update lights (safe iteration)
|
|
232
|
+
if (Array.isArray(this.sceneData.lights)) {
|
|
233
|
+
for (const light of this.sceneData.lights) {
|
|
234
|
+
this.addLightToScene(light);
|
|
235
|
+
}
|
|
232
236
|
}
|
|
233
237
|
|
|
234
238
|
// Update camera
|
|
@@ -316,9 +320,18 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
316
320
|
|
|
317
321
|
for (const intersection of intersects) {
|
|
318
322
|
const obj = intersection.object;
|
|
319
|
-
if (obj.userData.
|
|
323
|
+
if (obj.userData.assetData) {
|
|
320
324
|
this.selectObject(obj);
|
|
321
|
-
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
// Try parent objects
|
|
328
|
+
let parent = obj.parent;
|
|
329
|
+
while (parent && parent !== this.scene) {
|
|
330
|
+
if (parent.userData.assetData) {
|
|
331
|
+
this.selectObject(parent);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
parent = parent.parent;
|
|
322
335
|
}
|
|
323
336
|
}
|
|
324
337
|
}
|
|
@@ -326,15 +339,37 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
326
339
|
selectObject(obj) {
|
|
327
340
|
if (this.selectedObject === obj) return;
|
|
328
341
|
|
|
329
|
-
// Deselect previous
|
|
342
|
+
// Deselect previous (remove highlight)
|
|
330
343
|
if (this.selectedObject) {
|
|
331
344
|
this.selectedObject.userData.selected = false;
|
|
345
|
+
// Restore original material
|
|
346
|
+
this.selectedObject.traverse((child) => {
|
|
347
|
+
if (child.material && child.userData.originalMaterial) {
|
|
348
|
+
child.material = child.userData.originalMaterial;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
332
351
|
}
|
|
333
352
|
|
|
334
|
-
// Select new
|
|
353
|
+
// Select new (add yellow highlight)
|
|
335
354
|
this.selectedObject = obj;
|
|
336
355
|
obj.userData.selected = true;
|
|
337
356
|
|
|
357
|
+
// Apply highlight material
|
|
358
|
+
obj.traverse((child) => {
|
|
359
|
+
if (child.material) {
|
|
360
|
+
child.userData.originalMaterial = child.material;
|
|
361
|
+
const hlMat = new this.THREE.MeshStandardMaterial({
|
|
362
|
+
color: 0xffff00,
|
|
363
|
+
emissive: 0xffff00,
|
|
364
|
+
emissiveIntensity: 0.3,
|
|
365
|
+
metalness: 0.3,
|
|
366
|
+
roughness: 0.4
|
|
367
|
+
});
|
|
368
|
+
child.material = hlMat;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
console.log('✅ Selected:', obj.userData.assetData.name);
|
|
338
373
|
this.updatePropertyPanel();
|
|
339
374
|
}
|
|
340
375
|
|
|
@@ -343,7 +378,7 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
343
378
|
treeEl.innerHTML = '';
|
|
344
379
|
|
|
345
380
|
// Assets
|
|
346
|
-
if (this.sceneData.assets && this.sceneData.assets.length > 0) {
|
|
381
|
+
if (Array.isArray(this.sceneData.assets) && this.sceneData.assets.length > 0) {
|
|
347
382
|
const assetsDiv = document.createElement('div');
|
|
348
383
|
assetsDiv.style.cssText = 'margin-bottom:10px;';
|
|
349
384
|
|
|
@@ -355,8 +390,10 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
355
390
|
for (const asset of this.sceneData.assets) {
|
|
356
391
|
const itemDiv = document.createElement('div');
|
|
357
392
|
itemDiv.textContent = asset.name;
|
|
358
|
-
itemDiv.style.cssText = 'padding:5px;cursor:pointer;color:#aaa;margin-left:10px;';
|
|
359
|
-
itemDiv.addEventListener('click', () =>
|
|
393
|
+
itemDiv.style.cssText = 'padding:5px;cursor:pointer;color:#aaa;margin-left:10px;background:#2a2a1a;border-radius:3px;margin-bottom:3px;';
|
|
394
|
+
itemDiv.addEventListener('click', () => {
|
|
395
|
+
this.selectAssetByName(asset.name);
|
|
396
|
+
});
|
|
360
397
|
assetsDiv.appendChild(itemDiv);
|
|
361
398
|
}
|
|
362
399
|
|
|
@@ -364,7 +401,7 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
364
401
|
}
|
|
365
402
|
|
|
366
403
|
// Lights
|
|
367
|
-
if (this.sceneData.lights && this.sceneData.lights.length > 0) {
|
|
404
|
+
if (Array.isArray(this.sceneData.lights) && this.sceneData.lights.length > 0) {
|
|
368
405
|
const lightsDiv = document.createElement('div');
|
|
369
406
|
lightsDiv.style.cssText = 'margin-bottom:10px;';
|
|
370
407
|
|
|
@@ -394,6 +431,16 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
394
431
|
}
|
|
395
432
|
}
|
|
396
433
|
|
|
434
|
+
selectAssetByName(assetName) {
|
|
435
|
+
// Find and select asset in scene tree
|
|
436
|
+
for (const obj of this.scene.children) {
|
|
437
|
+
if (obj.userData.assetData && obj.userData.assetData.name === assetName) {
|
|
438
|
+
this.selectObject(obj);
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
397
444
|
updatePropertyPanel() {
|
|
398
445
|
const panelEl = this._getDomElement('propertyPanel');
|
|
399
446
|
panelEl.innerHTML = '';
|
|
@@ -8,6 +8,8 @@ import { Wunderbaum } from 'wunderbaum';
|
|
|
8
8
|
//@ts-ignore
|
|
9
9
|
import wunderbaumStyle from 'wunderbaum/dist/wunderbaum.css' with { type: 'css' };
|
|
10
10
|
import { defaultNewStyle, defaultNewControlScript } from "./IobrokerWebuiScreenEditor.js";
|
|
11
|
+
import { IobrokerWebui3DScreenEditor } from "./IobrokerWebui3DScreenEditor.js";
|
|
12
|
+
import { IobrokerWebui3DScreenViewer } from "./IobrokerWebui3DScreenViewer.js";
|
|
11
13
|
import { IobrokerWebuiIconsView } from "./IobrokerWebuiIconsView.js";
|
|
12
14
|
import { IobrokerWebuiScreensView } from "./IobrokerWebuiScreensView.js";
|
|
13
15
|
import { convertToXml, parseXml } from "../helper/XmlHelper.js";
|