iobroker.mywebui 1.42.28 → 1.42.29

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.28",
4
+ "version": "1.42.29",
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.28",
3
+ "version": "1.42.29",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413 with 3D Editor",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -1,5 +1,7 @@
1
1
  import { UIPanel, UIButton } from './libs/ui.js';
2
2
 
3
+ const _IMAGES_BASE = new URL( '../images/', import.meta.url ).href;
4
+
3
5
  function Toolbar( editor ) {
4
6
 
5
7
  const signals = editor.signals;
@@ -12,7 +14,7 @@ function Toolbar( editor ) {
12
14
 
13
15
  const translateIcon = document.createElement( 'img' );
14
16
  translateIcon.title = strings.getKey( 'toolbar/translate' );
15
- translateIcon.src = 'images/translate.svg';
17
+ translateIcon.src = _IMAGES_BASE + 'translate.svg';
16
18
 
17
19
  const translate = new UIButton();
18
20
  translate.dom.className = 'Button selected';
@@ -26,7 +28,7 @@ function Toolbar( editor ) {
26
28
 
27
29
  const rotateIcon = document.createElement( 'img' );
28
30
  rotateIcon.title = strings.getKey( 'toolbar/rotate' );
29
- rotateIcon.src = 'images/rotate.svg';
31
+ rotateIcon.src = _IMAGES_BASE + 'rotate.svg';
30
32
 
31
33
  const rotate = new UIButton();
32
34
  rotate.dom.appendChild( rotateIcon );
@@ -39,7 +41,7 @@ function Toolbar( editor ) {
39
41
 
40
42
  const scaleIcon = document.createElement( 'img' );
41
43
  scaleIcon.title = strings.getKey( 'toolbar/scale' );
42
- scaleIcon.src = 'images/scale.svg';
44
+ scaleIcon.src = _IMAGES_BASE + 'scale.svg';
43
45
 
44
46
  const scale = new UIButton();
45
47
  scale.dom.appendChild( scaleIcon );
@@ -112,12 +112,15 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
112
112
 
113
113
  async _initThreeEditor(sceneName, sceneType) {
114
114
  // Load three.js editor CSS into document head once
115
- if (!document.getElementById('three-editor-css')) {
115
+ // Load three.js editor CSS into the shadow root (NOT document.head
116
+ // shadow DOM does not inherit styles from the outer document).
117
+ const shadowRoot = this.shadowRoot;
118
+ if (shadowRoot && !shadowRoot.querySelector('#three-editor-css')) {
116
119
  const link = document.createElement('link');
117
120
  link.id = 'three-editor-css';
118
121
  link.rel = 'stylesheet';
119
122
  link.href = EDITOR_BASE + 'css/main.css';
120
- document.head.appendChild(link);
123
+ shadowRoot.appendChild(link);
121
124
  }
122
125
 
123
126
  // signals.min.js uses UMD: if AMD define() is present it registers as AMD
@@ -253,7 +256,12 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
253
256
  this._resizeObserver = new ResizeObserver(() => editor.signals.windowResize.dispatch());
254
257
  this._resizeObserver.observe(container);
255
258
 
256
- editor.signals.windowResize.dispatch();
259
+ // Dispatch resize after layout is complete (container may have 0 size on first tick)
260
+ requestAnimationFrame(() => {
261
+ editor.signals.windowResize.dispatch();
262
+ // Second dispatch in case WebGL canvas needs re-init
263
+ requestAnimationFrame(() => editor.signals.windowResize.dispatch());
264
+ });
257
265
  }
258
266
 
259
267
  // ── Script panel ─────────────────────────────────────────────────────────