iobroker.mywebui 1.42.34 → 1.42.35
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
|
@@ -273,8 +273,12 @@ export class IobrokerWebui3DScreenEditor extends BaseCustomWebComponentConstruct
|
|
|
273
273
|
// Dispatch resize after layout is complete (container may have 0 size on first tick)
|
|
274
274
|
requestAnimationFrame(() => {
|
|
275
275
|
editor.signals.windowResize.dispatch();
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
requestAnimationFrame(() => {
|
|
277
|
+
editor.signals.windowResize.dispatch();
|
|
278
|
+
// Force continuous render so ViewHelper gizmo is always visible
|
|
279
|
+
// The three.js editor renders on-demand; we keep it alive via sceneGraphChanged
|
|
280
|
+
editor.signals.sceneGraphChanged.dispatch();
|
|
281
|
+
});
|
|
278
282
|
});
|
|
279
283
|
}
|
|
280
284
|
|
|
@@ -13,12 +13,6 @@ export class IobrokerWebui3DScreenViewer extends BaseCustomWebComponentConstruct
|
|
|
13
13
|
background:rgba(0,0,0,0.45);padding:2px 7px;border-radius:3px;
|
|
14
14
|
pointer-events:none;user-select:none;">Persp</div>
|
|
15
15
|
|
|
16
|
-
<!-- Orientation gizmo canvas (top-right) -->
|
|
17
|
-
<canvas id="gizmoCanvas" width="96" height="96" style="
|
|
18
|
-
position:absolute;top:8px;right:8px;
|
|
19
|
-
width:96px;height:96px;cursor:pointer;
|
|
20
|
-
border-radius:4px;background:transparent;"></canvas>
|
|
21
|
-
|
|
22
16
|
<!-- Camera buttons (bottom-right) -->
|
|
23
17
|
<div id="camButtons" style="
|
|
24
18
|
position:absolute;bottom:12px;right:12px;
|
|
@@ -208,25 +202,19 @@ export class IobrokerWebui3DScreenViewer extends BaseCustomWebComponentConstruct
|
|
|
208
202
|
let viewHelper = null;
|
|
209
203
|
try {
|
|
210
204
|
const { ViewHelper } = await import('three/addons/helpers/ViewHelper.js');
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
clientY: gRect.top + (e.offsetY / gizmoCanvas.height) * gRect.height,
|
|
225
|
-
bubbles: true
|
|
226
|
-
});
|
|
227
|
-
renderer.domElement.dispatchEvent(synth);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
205
|
+
// ViewHelper renders into a sub-viewport of the main WebGL canvas
|
|
206
|
+
viewHelper = new ViewHelper(activeCamera, renderer.domElement);
|
|
207
|
+
viewHelper.center = controls.target;
|
|
208
|
+
// Top-right corner (8px from top, 8px from right)
|
|
209
|
+
viewHelper.location.top = 8;
|
|
210
|
+
viewHelper.location.right = 8;
|
|
211
|
+
viewHelper.location.left = null;
|
|
212
|
+
viewHelper.location.bottom = null;
|
|
213
|
+
|
|
214
|
+
// Forward clicks on the canvas to ViewHelper for camera snapping
|
|
215
|
+
renderer.domElement.addEventListener('pointerup', (e) => {
|
|
216
|
+
if (viewHelper.animating) viewHelper.handleClick(e);
|
|
217
|
+
});
|
|
230
218
|
} catch (_) { /* ViewHelper not available */ }
|
|
231
219
|
|
|
232
220
|
// ── Script context ───────────────────────────────────
|
|
@@ -290,18 +278,14 @@ export class IobrokerWebui3DScreenViewer extends BaseCustomWebComponentConstruct
|
|
|
290
278
|
renderer.clear();
|
|
291
279
|
renderer.render(scene, activeCamera);
|
|
292
280
|
|
|
293
|
-
//
|
|
281
|
+
// ViewHelper manages its own sub-viewport — just call render
|
|
294
282
|
if (viewHelper) {
|
|
295
|
-
const size = 96 * window.devicePixelRatio;
|
|
296
|
-
const cw = renderer.domElement.width;
|
|
297
|
-
const ch = renderer.domElement.height;
|
|
298
|
-
renderer.setViewport(cw - size, ch - size, size, size);
|
|
299
|
-
renderer.setScissor(cw - size, ch - size, size, size);
|
|
300
|
-
renderer.setScissorTest(true);
|
|
301
283
|
viewHelper.camera = activeCamera;
|
|
284
|
+
viewHelper.center = controls.target;
|
|
285
|
+
if (viewHelper.animating) viewHelper.update(dt);
|
|
286
|
+
renderer.autoClear = false;
|
|
302
287
|
viewHelper.render(renderer);
|
|
303
|
-
renderer.
|
|
304
|
-
renderer.setViewport(0, 0, cw, ch);
|
|
288
|
+
renderer.autoClear = false; // keep false for next frame
|
|
305
289
|
}
|
|
306
290
|
};
|
|
307
291
|
animate(0);
|