@umicat/three-sdk 0.17.0 → 0.17.1
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.
|
@@ -21,6 +21,7 @@ import { loadScene3D } from '../SceneLoader3D.js';
|
|
|
21
21
|
* real game.
|
|
22
22
|
*/
|
|
23
23
|
export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
24
|
+
hideNonCanvasStaticMarkup(renderer.domElement);
|
|
24
25
|
const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 2000);
|
|
25
26
|
const controls = new OrbitControls(camera, renderer.domElement);
|
|
26
27
|
controls.enableDamping = true;
|
|
@@ -126,3 +127,42 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
126
127
|
window.parent.postMessage({ type: 'umicat:editor:scene3dLoaded', sceneId, error: true }, '*');
|
|
127
128
|
}
|
|
128
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Hides every other top-level DOM node the game shipped, keeping only the
|
|
132
|
+
* canvas. Mirrors `@umicat/phaser-sdk`'s edit-mode markup hider (`UmicatGame.ts`)
|
|
133
|
+
* exactly, including its `data-umicat-keep` opt-out — same bug, same fix,
|
|
134
|
+
* different renderer.
|
|
135
|
+
*
|
|
136
|
+
* Two distinct problems, one cause: `index.html` markup has no owner in edit
|
|
137
|
+
* mode, because none of the game's own code runs to manage it. A static score
|
|
138
|
+
* HUD just clutters a scene that's supposed to read as empty of gameplay. A
|
|
139
|
+
* game with its own full-screen input-capturing overlay (a drawing surface
|
|
140
|
+
* that "the whole screen collects strokes" is a real, shipped example) is
|
|
141
|
+
* worse: that overlay sits ABOVE the canvas and silently swallows every
|
|
142
|
+
* pointer event meant for OrbitControls — confirmed live, orbit/zoom did
|
|
143
|
+
* nothing at all until this ran, with zero console errors, because the events
|
|
144
|
+
* simply never reached the renderer's own `domElement`.
|
|
145
|
+
*/
|
|
146
|
+
function hideNonCanvasStaticMarkup(canvas) {
|
|
147
|
+
if (typeof document === 'undefined' || !document.body)
|
|
148
|
+
return;
|
|
149
|
+
const hidden = [];
|
|
150
|
+
for (const el of Array.from(document.body.children)) {
|
|
151
|
+
if (!(el instanceof HTMLElement))
|
|
152
|
+
continue;
|
|
153
|
+
const tag = el.tagName;
|
|
154
|
+
if (tag === 'SCRIPT' || tag === 'STYLE' || tag === 'LINK' || tag === 'NOSCRIPT')
|
|
155
|
+
continue;
|
|
156
|
+
if (el === canvas)
|
|
157
|
+
continue;
|
|
158
|
+
if (el.hasAttribute('data-umicat-keep'))
|
|
159
|
+
continue; // opt OUT, for markup that IS design-time content
|
|
160
|
+
if (el.style.display === 'none')
|
|
161
|
+
continue;
|
|
162
|
+
el.style.display = 'none';
|
|
163
|
+
hidden.push(el.id ? `#${el.id}` : tag.toLowerCase());
|
|
164
|
+
}
|
|
165
|
+
if (hidden.length > 0) {
|
|
166
|
+
console.info(`[umicat/editor] hid ${hidden.join(', ')} — index.html markup with no game code running to remove it. Add data-umicat-keep to keep one visible in Edit.`);
|
|
167
|
+
}
|
|
168
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umicat/three-sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|