iobroker.mywebui 1.42.28 → 1.42.30
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
|
@@ -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 = '
|
|
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 = '
|
|
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 = '
|
|
44
|
+
scaleIcon.src = _IMAGES_BASE + 'scale.svg';
|
|
43
45
|
|
|
44
46
|
const scale = new UIButton();
|
|
45
47
|
scale.dom.appendChild( scaleIcon );
|
|
@@ -20,8 +20,8 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
20
20
|
|
|
21
21
|
<!-- three.js editor mount point
|
|
22
22
|
position:relative → contains position:absolute children (viewport, sidebar, etc.)
|
|
23
|
-
|
|
24
|
-
<div id="editorContainer" style="flex:1;position:relative;overflow:hidden;min-height:0;
|
|
23
|
+
overflow:visible → allow position:fixed dropdowns to escape clip boundary -->
|
|
24
|
+
<div id="editorContainer" style="flex:1;position:relative;overflow:hidden;min-height:0;"></div>
|
|
25
25
|
|
|
26
26
|
<!-- Bottom Monaco panel for iobroker scene script -->
|
|
27
27
|
<div id="scriptPanel" style="height:0;flex-shrink:0;border-top:2px solid #3c3c3c;display:flex;flex-direction:column;overflow:hidden;background:#1e1e1e;transition:height 0.15s;">
|
|
@@ -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
|
-
|
|
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
|
-
|
|
123
|
+
shadowRoot.appendChild(link);
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
// signals.min.js uses UMD: if AMD define() is present it registers as AMD
|
|
@@ -126,6 +129,15 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
126
129
|
await this._loadScript(EDITOR_BASE + 'js/libs/signals.min.js', true);
|
|
127
130
|
await this._loadScript(EDITOR_BASE + 'js/libs/jsonlint.js');
|
|
128
131
|
|
|
132
|
+
// Also load editor CSS into document.head so dialogs appended to document.body are styled
|
|
133
|
+
if (!document.getElementById('three-editor-css-global')) {
|
|
134
|
+
const gLink = document.createElement('link');
|
|
135
|
+
gLink.id = 'three-editor-css-global';
|
|
136
|
+
gLink.rel = 'stylesheet';
|
|
137
|
+
gLink.href = EDITOR_BASE + 'css/main.css';
|
|
138
|
+
document.head.appendChild(gLink);
|
|
139
|
+
}
|
|
140
|
+
|
|
129
141
|
// Dynamically import all editor modules (they use the importmap for 'three')
|
|
130
142
|
const [
|
|
131
143
|
THREE,
|
|
@@ -141,6 +153,7 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
141
153
|
{ Animation },
|
|
142
154
|
{ AnimationResizer },
|
|
143
155
|
{ SetScriptValueCommand },
|
|
156
|
+
{ GLTFImportDialog },
|
|
144
157
|
] = await Promise.all([
|
|
145
158
|
import('three'),
|
|
146
159
|
import('three/addons/geometries/TextGeometry.js'),
|
|
@@ -155,8 +168,12 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
155
168
|
import(/* @vite-ignore */ EDITOR_BASE + 'js/Animation.js'),
|
|
156
169
|
import(/* @vite-ignore */ EDITOR_BASE + 'js/AnimationResizer.js'),
|
|
157
170
|
import(/* @vite-ignore */ EDITOR_BASE + 'js/commands/SetScriptValueCommand.js'),
|
|
171
|
+
import(/* @vite-ignore */ EDITOR_BASE + 'js/GLTFImportDialog.js'),
|
|
158
172
|
]);
|
|
159
173
|
|
|
174
|
+
// Auto-accept the GLB/GLTF import dialog (shadow DOM hides it from CSS, so skip UI)
|
|
175
|
+
GLTFImportDialog.prototype.show = () => Promise.resolve({ asScene: false });
|
|
176
|
+
|
|
160
177
|
window.THREE = THREE;
|
|
161
178
|
try { THREE.ObjectLoader.registerGeometry('TextGeometry', TextGeometry); } catch (_) {}
|
|
162
179
|
|
|
@@ -253,7 +270,12 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
253
270
|
this._resizeObserver = new ResizeObserver(() => editor.signals.windowResize.dispatch());
|
|
254
271
|
this._resizeObserver.observe(container);
|
|
255
272
|
|
|
256
|
-
|
|
273
|
+
// Dispatch resize after layout is complete (container may have 0 size on first tick)
|
|
274
|
+
requestAnimationFrame(() => {
|
|
275
|
+
editor.signals.windowResize.dispatch();
|
|
276
|
+
// Second dispatch in case WebGL canvas needs re-init
|
|
277
|
+
requestAnimationFrame(() => editor.signals.windowResize.dispatch());
|
|
278
|
+
});
|
|
257
279
|
}
|
|
258
280
|
|
|
259
281
|
// ── Script panel ─────────────────────────────────────────────────────────
|